2#include <NDEVR/Buffer.h>
3#include <NDEVR/String.h>
5#include <NDEVR/TranslatedString.h>
10 class QTImageEditorUI;
82 QColor
penColor()
const {
return m_pen_color; }
97 QImage
image()
const {
return m_image; }
216 void paintBackgroundImage();
226 bool modified =
false;
227 bool m_editing =
false;
231 QColor m_pen_color = QColor(0, 0, 0);
232 QColor m_fill_color = QColor(0, 0, 0, 0);
235 QImage m_background_image;
236 QPointF m_last_point;
378 void rotate(
bool rotate_right);
383 void mirror(
bool mirror_vert);
388 QImage pushToUndoStack();
391 Time m_image_update_time;
395 Ui::QTImageEditorUI* ui;
398 QTimer* m_update_check_timer;
The equivelent of std::vector but with a bit more control.
Finds any acceptable Image editors (MS Paint, GIMP Photoshop, etc) and allows them to be used as edit...
A compact way to present a list of options to the user.
A line edit allows users to enter and edit a single line of plain text with useful editing functions,...
The slider is the classic widget for controlling a bounded value.
A widget that is used to edit and display both plain and rich text in a multi-lined format.
A widget that provides a canvas for viewing and editing images with drawing tools.
bool isEditing() const
Returns whether a drawing or text editing operation is currently in progress.
void setFont(const QFont &font)
Sets the font used for text drawing mode.
void finishText()
Finishes and commits the current text editing operation.
void mouseMoveEvent(QMouseEvent *event) override
Handles mouse move events for drawing.
void clearSelection()
Clears the current selection or crop region.
void setImage(QImage image)
Sets the image to be displayed and edited.
bool isModified() const
Returns whether the image has been modified since the last save.
void drawText()
Renders text onto the image from the active text edit widget.
void editedSignal()
Emitted when the image has been edited.
void resizeImage(const QSize &new_size, ResizeMode resize_mode, bool lock_aspect_ratio)
Resizes the image to the given size using the specified mode.
QColor penColor() const
Returns the current pen color.
void resizeEvent(QResizeEvent *event) override
Handles resize events to update the background image.
QTImageEditorView(QWidget *parent=nullptr)
Constructs a QTImageEditorView widget.
void paintEvent(QPaintEvent *event) override
Paints the editor view including the image and any active drawing overlays.
void setScale(fltp08 scale)
Sets the display scale factor for the image.
void mouseReleaseEvent(QMouseEvent *event) override
Handles mouse release events for drawing.
ResizeMode
Describes how an image is positioned when resized.
void mousePressEvent(QMouseEvent *event) override
Handles mouse press events for drawing.
void checkTextEdit()
Checks if the text edit widget needs to be committed or dismissed.
void setEditMode(EditMode edit_mode)
Sets the active editing mode (drawing tool).
EditMode editMode() const
Returns the current edit mode.
int penWidth() const
Returns the current pen width.
void setPenWidth(fltp08 width)
Sets the pen width used for drawing operations.
QImage undoImage() const
Returns the image state before the last edit, for undo purposes.
QSize sizeHint() const override
Returns the recommended size for this widget.
void setFillColor(const QColor &color)
Sets the fill color used for shape drawing operations.
EditMode
The active drawing or editing tool for the image editor.
@ e_size
Sentinel value representing the number of edit modes.
void clearImage()
Clears the image to a blank state.
void setPenColor(const QColor &color)
Sets the pen color used for drawing operations.
fltp08 scale() const
Returns the current display scale factor.
void mousePressLocation(QPointF end_point)
Handles a mouse press at the given image-space location.
QImage image() const
Returns the current image being edited.
void updateCursorLocation(QPointF end_point)
Updates the cursor position during a drag operation.
void mouseReleaseLocation(QPointF end_point)
Handles a mouse release at the given image-space location.
void setOptimalScale()
Calculates and applies the optimal scale to fit the image in the view.
QTImageEditor(QWidget *parent=nullptr)
Constructs a QTImageEditor widget.
QSize sizeHint() const override
Returns the recommended size for this widget.
void colorsEdited()
Slot called when pen or fill colors have been changed by the user.
bool isEditing() const
Returns whether a drawing or text editing operation is currently in progress.
void mouseReleaseLocation(const Vector< 2, fltp08 > &end_point)
Handles a mouse release at the given normalized location.
const StringView imageID() const
Returns the resource identifier of the currently loaded image.
void setImage(const TranslatedString title, const StringView &image)
Sets the image to edit from a resource identifier.
void sizeChangedSlot()
Slot called when the image size has changed.
virtual void keyReleaseEvent(QKeyEvent *event) override
Handles key release events for shortcuts such as undo and redo.
QTImageEditorView * imageView() const
Returns the underlying image editor view widget.
void editedSignal()
Emitted when the image has been edited.
void showEvent(QShowEvent *event) override
Handles the show event to initialize the editor view.
void pushUpdate()
Pushes the current image state as a saved update to the resource system.
void editedSlot()
Slot called when the image has been edited, to update undo state.
QSize minimumSizeHint() const override
Returns the minimum recommended size for this widget.
void setEditMode(QTImageEditorView::EditMode mode)
Sets the active editing mode for the image editor view.
virtual ~QTImageEditor()
Destroys this QTImageEditor widget.
void refreshToImage(const StringView &image)
Reloads the image from the given resource identifier, discarding unsaved changes.
void setVertical(bool vertical)
Sets the layout orientation of the editor toolbar.
void mousePressLocation(const Vector< 2, fltp08 > &end_point)
Handles a mouse press at the given normalized location.
void updateCursorLocation(const Vector< 2, fltp08 > &end_point)
Updates the cursor position during a drag operation.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Represents a timestamp with utilities for manipulation and conversion.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
The primary namespace for the NDEVR SDK.
@ e_center
Center text both horizontally and vertically.
double fltp08
Defines an alias representing an 8 byte floating-point number.
@ e_size
Number of entries in this enum; used for iteration.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.