22#ifndef GTKMM_KAGE_STAGE_H
23 #define GTKMM_KAGE_STAGE_H
25 #include <gtkmm/drawingarea.h>
33 #include <cairomm/context.h>
34 #include <gdkmm/general.h>
95 #define IMAGE_ID_BUFF 0
97 #define IMAGE_WIDTH_HEIGHT 2
98 #define IMAGE_SCALEX_SCALEY 3
99 #define IMAGE_ROTATE_ALPHA 4
101 void printVectors(std::vector<VectorData> p_vectorData);
106 void setFill(Gdk::Color p_Color);
111 void clearScreen(Cairo::RefPtr<Cairo::Context> p_context);
112 void renderFrame(Cairo::RefPtr<Cairo::Context> p_context,
bool p_force =
false);
113 void renderOnionFrame(Cairo::RefPtr<Cairo::Context> p_context, std::vector<VectorData> p_vectorData,
double p_alpha);
114 void renderFrame(Cairo::RefPtr<Cairo::Context> p_context, std::vector<VectorData> p_vectorData,
double p_alpha = 1.0);
115 void renderFrameOffset(Cairo::RefPtr<Cairo::Context> p_context,
bool p_force =
false,
double p_offsetX = 0.0,
double p_offsetY = 0.0);
116 void renderFrameOffset(Cairo::RefPtr<Cairo::Context> p_context, std::vector<VectorData> p_vectorData,
double p_alpha = 1.0,
double p_offsetX = 0.0,
double p_offsetY = 0.0);
117 unsigned int addImage(
unsigned int p_ID,
double p_x,
double p_y);
118 unsigned int addImage(
unsigned int p_ID);
156 Glib::RefPtr<Gdk::Pixbuf>
_bg;
157 Cairo::RefPtr<Cairo::Surface>
_bgcr;
181 unsigned int getShape(
unsigned int p_index, std::vector<VectorData> p_v);
184 void updateShapeX(
double p_value,
bool p_stackDo =
true);
185 void updateShapeY(
double p_value,
bool p_stackDo =
true);
188 void updateNodeX(
double p_value,
bool p_stackDo =
true);
189 void updateNodeY(
double p_value,
bool p_stackDo =
true);
196 bool renderToPNG(std::string p_path,
bool p_transparent);
197 bool renderToPNGOffset(std::string p_path,
bool p_transparent,
double p_offsetX = 0.0,
double p_offsetY = 0.0);
199 void renderFrameToPNGOffset(Cairo::RefPtr<Cairo::Context> p_context,
double p_offsetX = 0.0,
double p_offsetY = 0.0);
201 Cairo::RefPtr<Cairo::Context>
cr;
224 static std::vector<Cairo::RefPtr<Cairo::ImageSurface>>
cairoPNG;
251 virtual bool on_event(GdkEvent *e)
override;
253 bool on_draw(
const Cairo::RefPtr<Cairo::Context>&
cr)
override;
268 void renderNode(
double p_x,
double p_y,
unsigned int p_state = 5);
270 bool isMouseOnNode(
double p_x,
double p_y,
unsigned int p_buffer = 5);
type
Definition anchor.h:30
Kage * _kage
Definition stage.h:228
AnchorData anchor_lowerRight
Definition stage.h:287
bool on_draw(const Cairo::RefPtr< Cairo::Context > &cr) override
Called by Gtkmm when DrawingArea's display is invalidated.
Definition stage.cpp:921
bool isSelectedShape(unsigned int p_index)
Definition shape.cpp:36
Glib::RefPtr< Gdk::Window > window
Definition stage.h:240
static std::vector< Cairo::RefPtr< Cairo::ImageSurface > > cairoPNG
Definition stage.h:224
double polyXhead
Definition stage.h:237
unsigned int mouseOnNode
Definition stage.h:256
unsigned int drawCtr
Definition stage.h:246
void renderOnionFrame(Cairo::RefPtr< Cairo::Context > p_context, std::vector< VectorData > p_vectorData, double p_alpha)
Definition stage.cpp:1137
double polyYhead
Definition stage.h:237
AnchorData anchor_center
Definition stage.h:286
bool isMouseOnNode(double p_x, double p_y, unsigned int p_buffer=5)
Definition node.cpp:1017
void handleShapes_scaleNorth()
Definition shape.cpp:57
double polyXtail
Definition stage.h:238
GdkPoint _mouseLocation
Definition stage.h:242
bool deleteSelectedNodes()
Definition node.cpp:1041
double nodeX
Definition stage.h:89
PointData draw1
Definition stage.h:229
void clearScreen(Cairo::RefPtr< Cairo::Context > p_context)
for use with zoom; default value is _kage->_document._width; can be changed as preferred
Definition stage.cpp:982
double propHeight
Definition stage.h:87
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_NE
Definition stage.h:46
PointData drawFree2
Definition stage.h:232
void updateNodeXY()
Definition node.cpp:1205
unsigned int selectedNode
Definition stage.h:260
double propY
Definition stage.h:83
void handleFill()
Definition stage.cpp:1475
void handleStrokeMouseUp()
Definition stage.cpp:1468
void renderFrameOffset(Cairo::RefPtr< Cairo::Context > p_context, bool p_force=false, double p_offsetX=0.0, double p_offsetY=0.0)
Definition stage.cpp:1120
unsigned int mouseOnNodeIndex
Definition stage.h:259
PointData applyZoomRatio(PointData p_value)
Definition stage.cpp:669
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_SW
Definition stage.h:48
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_000
Definition stage.h:41
Gdk::Color getStroke()
Definition stage.cpp:730
bool keyDownDown
Definition stage.h:294
static Cairo::RefPtr< Cairo::ImageSurface > cairoImageSurface
Definition stage.h:225
VectorDataManager _polyVectors
Definition stage.h:239
std::vector< unsigned int > selectedNodes
Definition stage.h:264
PointData drawFree1
Definition stage.h:231
std::vector< VectorData > _vectorDataZOrderBufferC
Definition stage.h:194
Cairo::RefPtr< Cairo::Surface > _bgcr
Definition stage.h:157
void updateNodeY(double p_value, bool p_stackDo=true)
Definition node.cpp:121
AnchorData anchor_rotate
Definition stage.h:289
PointData _rotateReference
Definition stage.h:212
bool pasteSelectedShapes()
Definition shape.cpp:1396
bool toggleLineSelectedNodes()
Definition node.cpp:1151
void invalidateToRender()
Definition stage.cpp:899
PointData selectionBox2
Definition stage.h:273
bool handleNodes_getNearestShape(double p_x, double p_y, unsigned int p_index, std::vector< VectorData > p_v)
Definition node.cpp:740
bool keyUpDown
Definition stage.h:293
void handleShapes_modifyingShape()
Definition shape.cpp:757
double fpsElapse
Definition stage.h:79
PointData _zoomReference
Definition stage.h:208
const unsigned int _NO_SELECTION
Definition stage.h:71
static float propAlpha
Definition stage.h:93
bool deleteSelectedShapes()
Definition shape.cpp:1430
bool keyLeftDown
Definition stage.h:295
bool keyShiftDown
Definition stage.h:291
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_SE
Definition stage.h:49
virtual bool on_key_press_event(GdkEventKey *e) override
Definition stage.cpp:77
short int drawFreeCtr
Definition stage.h:235
static PointData origin
Definition stage.h:202
void handleDrawOvalMouseUp()
Definition oval.cpp:28
void normalizeSelectionBox()
Definition node.cpp:980
int propXindex1
Definition stage.h:81
bool _isModifyingShape
Definition stage.h:204
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_135
Definition stage.h:44
void updateShapeColor(bool p_doFill=true, bool p_doStroke=true)
Definition shape.cpp:362
void handlePoly()
Definition poly.cpp:88
unsigned int nodeIndexX
Definition stage.h:91
PointData drawFree4
Definition stage.h:234
PointData draw2
Definition stage.h:230
bool isSelectedNode(unsigned int p_index)
Definition node.cpp:38
void handleDrawPolyMouseUp()
Definition poly.cpp:28
static ToolMode toolMode
direct use for get only
Definition stage.h:77
double propX
Definition stage.h:80
void handleShapes_scaleEast()
Definition shape.cpp:120
virtual bool on_key_release_event(GdkEventKey *e) override
Definition stage.cpp:176
void renderNodeControl(double p_x, double p_y, bool p_selected)
Definition node.cpp:958
void handleNodes_rendering()
Definition node.cpp:498
double propWidth
Definition stage.h:86
unsigned int getSelectedShapeViaNode(unsigned int p_index, std::vector< VectorData > p_v)
Definition node.cpp:773
void updateShapeXY()
Definition shape.cpp:1478
std::vector< VectorData > _vectorDataZOrderBufferB
Definition stage.h:193
PointData selectionBox1
Definition stage.h:272
void handleDrawPencilMouseUp()
Definition pencil.cpp:78
void handleDrawRectMouseUp()
Definition rect.cpp:28
int _registerWidth
Definition stage.h:298
virtual bool on_event(GdkEvent *e) override
Definition stage.cpp:305
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_045
Definition stage.h:42
static StrokeColorData stroke
direct use for get only
Definition stage.h:73
bool draw
Definition stage.h:245
bool _rotateMode
Definition stage.h:216
GdkPoint _copyBufferMouse
Definition stage.h:244
void updateShapeWidth(double p_value)
Definition shape.cpp:544
void handleEyedrop()
Definition stage.cpp:1486
void initNodeTool()
Definition node.cpp:28
void handleDrawPencilMouseMove(PointData p_point)
Definition pencil.cpp:47
Glib::RefPtr< Gdk::Pixbuf > _bg
Definition stage.h:156
void trySingleSelectShape()
Definition shape.cpp:1163
double nodeY
Definition stage.h:90
bool renderToPNG(std::string p_path, bool p_transparent)
Definition stage.cpp:1020
int propXindex2
Definition stage.h:82
int propYindex2
Definition stage.h:85
void handleShapesMouseDown()
void handleNodes_selection()
Definition node.cpp:182
unsigned int addImage(unsigned int p_ID, double p_x, double p_y)
Definition stage.cpp:1153
unsigned int selectedShape
Definition stage.h:262
static double currentScale
Definition stage.h:110
unsigned int getShape(unsigned int p_index, std::vector< VectorData > p_v)
Definition shape.cpp:1272
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_MOVE
Definition stage.h:45
PointData drawFree3
Definition stage.h:233
GdkPoint drawConstraint
Definition stage.h:236
void unpressKeys()
Definition stage.cpp:293
void updateShapeHeight(double p_value)
Definition shape.cpp:611
Gdk::Color getFill()
Definition stage.cpp:704
void renderFrame(Cairo::RefPtr< Cairo::Context > p_context, bool p_force=false)
Definition stage.cpp:1065
void renderNode(double p_x, double p_y, unsigned int p_state=5)
Definition node.cpp:937
std::vector< VectorData > _vectorDataCopyBuffer
Definition stage.h:191
double propRotation
Definition stage.h:88
void drawSelectionArea()
Definition stage.cpp:1445
Cairo::RefPtr< Cairo::Context > cr
Definition stage.h:201
bool isSelectionBoxNormalized()
Definition node.cpp:974
void handleFillMouseUp()
Definition stage.cpp:1479
bool keyRightDown
Definition stage.h:296
void handleNodes_relocation()
Definition node.cpp:307
void handleShapes_modifyingShapeRotate()
Definition shape.cpp:681
PointData __stageArea
Definition stage.h:210
void tryMultiSelectShapes_populateShapes()
Definition shape.cpp:1195
void handleShapes_updateAnchors(double p_x, double p_y)
Definition shape.cpp:347
void addSelectedShape(unsigned int p_index)
Definition shape.cpp:48
void setStroke(Gdk::Color p_Color)
Definition stage.cpp:718
void handleShapesMouseUp()
Definition shape.cpp:1285
static GdkPoint moveStageXY
Definition stage.h:78
double polyYtail
Definition stage.h:238
void handlePencil()
Definition pencil.cpp:115
KageStage(Kage *p_kage)
Definition stage.cpp:46
bool keyControlDown
Definition stage.h:292
unsigned int mouseOnShape
Definition stage.h:261
int propYindex1
Definition stage.h:84
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_ROTATE
Definition stage.h:50
unsigned int mouseOnNodeHover
Definition stage.h:258
void handleNodesMouseUp()
Definition node.cpp:662
void updateShapeRotation(float l_rotation)
updates selected Shapes's Rotation
Definition stage.cpp:1572
static double _zoomValue
Definition stage.h:207
std::vector< unsigned int > getSelectedShapes()
Definition shape.cpp:32
void setSelectedShapes(std::vector< unsigned int > p_selectedShapes)
Definition shape.cpp:28
double _nodeToMouseDistance
Definition stage.h:283
bool _stackDo
Definition stage.h:190
void handleOval()
Definition oval.cpp:75
bool cutSelectedShapes()
Definition shape.cpp:1294
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_090
Definition stage.h:43
bool renderToPNGOffset(std::string p_path, bool p_transparent, double p_offsetX=0.0, double p_offsetY=0.0)
Definition stage.cpp:1074
std::vector< unsigned int > selectedShapes
Definition stage.h:265
void handleShapes_scaleSouth()
Definition shape.cpp:243
void setFill(Gdk::Color p_Color)
Definition stage.cpp:692
double _zoomRatio
Definition stage.h:206
void handleEyedropMouseUp()
Definition stage.cpp:1562
static ColorData fillColor
Definition stage.h:72
AnchorData::type mouseOnAnchor
Definition stage.h:267
void handleShapes_scaleWest()
Definition shape.cpp:180
bool deleteSelectedNode(unsigned int p_index)
Definition node.cpp:1073
void addSelectedNode(unsigned int p_index)
Definition node.cpp:53
int _registerHeight
Definition stage.h:299
bool copySelectedShapes()
Definition shape.cpp:1316
void renderFrameToPNG(Cairo::RefPtr< Cairo::Context > p_context)
Definition stage.cpp:1062
void updateShapeX(double p_value, bool p_stackDo=true)
Definition shape.cpp:403
bool _rotateApply
Definition stage.h:217
void handleEyedropMouseMove()
Definition stage.cpp:1554
AnchorData anchor_upperLeft
Definition stage.h:285
void handleShapes_moveShape(double p_diffX, double p_diffY)
Definition shape.cpp:303
void handleRect()
Definition rect.cpp:58
unsigned int _mouseLocationShapeIndex
Definition stage.h:243
static ColorData pencilFillColor
direct use for get only
Definition stage.h:75
PointData mouseOnNodeOffset
Definition stage.h:257
void tryMultiSelectShapes()
Definition shape.cpp:1205
void handleNodesMouseDown()
Definition node.cpp:659
void updateNodeX(double p_value, bool p_stackDo=true)
Definition node.cpp:63
bool _invalidated
Definition stage.h:104
bool cancelDrawingPoly()
Definition poly.cpp:132
unsigned int nodeIndexY
Definition stage.h:92
PointData __origin
Definition stage.h:209
ToolMode
Definition stage.h:55
@ MODE_FILL
Definition stage.h:60
@ MODE_NODE
Definition stage.h:58
@ MODE_ZOOM
Definition stage.h:62
@ MODE_DRAW_TEXT
Definition stage.h:65
@ MODE_DRAW_RECT
Definition stage.h:64
@ MODE_MOVE_STAGE
Definition stage.h:63
@ MODE_DRAW_LINE
Definition stage.h:68
@ MODE_DRAW_POLY
Definition stage.h:66
@ MODE_DRAW_PENCIL
Definition stage.h:69
@ MODE_DRAW_OVAL
Definition stage.h:67
@ MODE_STROKE
Definition stage.h:59
@ MODE_EYEDROP
Definition stage.h:61
@ MODE_NONE
Definition stage.h:56
@ MODE_SELECT
Definition stage.h:57
void handleShapes()
Definition shape.cpp:985
std::vector< VectorData > _vectorDataZOrderBufferA
Definition stage.h:192
void updateImageAlpha(float l_alpha)
updates selected Image's Alpha
Definition stage.cpp:1584
bool mouseDown
Definition stage.h:241
bool deselectSelectedShapes()
Definition shape.cpp:1374
void updateShapeY(double p_value, bool p_stackDo=true)
Definition shape.cpp:473
void handleNodes()
Definition node.cpp:177
bool selectAllShapes()
Definition shape.cpp:1351
virtual bool on_expose_event(GdkEventExpose *e)
Definition stage.cpp:287
ToolMode prevTool
Definition stage.h:227
void cleanSlate()
Definition stage.cpp:858
void handleDrawPencilMouseDown(PointData p_point)
Definition pencil.cpp:28
bool deselectSelectedNodes()
Definition node.cpp:1025
void renderFrameToPNGOffset(Cairo::RefPtr< Cairo::Context > p_context, double p_offsetX=0.0, double p_offsetY=0.0)
Definition stage.cpp:1116
static StrokeColorData pencilStroke
direct use for get only
Definition stage.h:76
bool isNodeOnSelectionBox(double p_nodeX, double p_nodeY)
Definition node.cpp:1008
void printVectors(std::vector< VectorData > p_vectorData)
Definition stage.cpp:744
void handleStrokeMouseMove()
Definition stage.cpp:1464
static Glib::RefPtr< Gdk::Pixbuf > imageSHAPE_NW
Definition stage.h:47
virtual ~KageStage()
Definition stage.cpp:73
Definition strokecolor.h:27
Definition vectordatamanager.h:35