![]() |
Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
|
#include <stage.h>
Public Types | |
enum | ToolMode { MODE_NONE , MODE_SELECT , MODE_NODE , MODE_STROKE , MODE_FILL , MODE_EYEDROP , MODE_ZOOM , MODE_MOVE_STAGE , MODE_DRAW_RECT , MODE_DRAW_TEXT , MODE_DRAW_POLY , MODE_DRAW_OVAL , MODE_DRAW_LINE , MODE_DRAW_PENCIL } |
Public Member Functions | |
KageStage (Kage *p_kage) | |
virtual | ~KageStage () |
void | printVectors (std::vector< VectorData > p_vectorData) |
void | cleanSlate () |
void | invalidateToRender () |
void | setFill (Gdk::Color p_Color) |
Gdk::Color | getFill () |
void | setStroke (Gdk::Color p_Color) |
Gdk::Color | getStroke () |
void | clearScreen (Cairo::RefPtr< Cairo::Context > p_context) |
for use with zoom; default value is _kage->_document._width; can be changed as preferred | |
void | renderFrame (Cairo::RefPtr< Cairo::Context > p_context, bool p_force=false) |
void | renderOnionFrame (Cairo::RefPtr< Cairo::Context > p_context, std::vector< VectorData > p_vectorData, double p_alpha) |
void | renderFrame (Cairo::RefPtr< Cairo::Context > p_context, std::vector< VectorData > p_vectorData, double p_alpha=1.0) |
void | renderFrameOffset (Cairo::RefPtr< Cairo::Context > p_context, bool p_force=false, double p_offsetX=0.0, double p_offsetY=0.0) |
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) |
unsigned int | addImage (unsigned int p_ID, double p_x, double p_y) |
unsigned int | addImage (unsigned int p_ID) |
This will return a Cairo::ImageSurface array-index to be used as ID for rendering on Stage or Library. | |
void | initNodeTool () |
void | handleShapes () |
void | handleShapes_modifyingShapeRotate () |
void | handleShapes_modifyingShape () |
void | handleShapes_scaleNorth () |
void | handleShapes_scaleEast () |
void | handleShapes_scaleWest () |
void | handleShapes_scaleSouth () |
void | handleShapes_moveShape (double p_diffX, double p_diffY) |
void | handleShapes_updateAnchors (double p_x, double p_y) |
void | handleShapesMouseDown () |
void | handleShapesMouseUp () |
void | handleNodes () |
void | handleNodes_selection () |
void | handleNodes_relocation () |
void | handleNodes_rendering () |
void | handleNodesMouseDown () |
void | handleNodesMouseUp () |
bool | handleNodes_getNearestShape (double p_x, double p_y, unsigned int p_index, std::vector< VectorData > p_v) |
void | handleDrawOvalMouseUp () |
void | handleDrawRectMouseUp () |
void | handleDrawPolyMouseUp () |
void | handleDrawPencilMouseDown (PointData p_point) |
void | handleDrawPencilMouseMove (PointData p_point) |
void | handleDrawPencilMouseUp () |
void | handleOval () |
void | handleRect () |
void | handlePoly () |
void | handlePencil () |
void | handleStroke () |
void | handleStrokeMouseMove () |
void | handleStrokeMouseUp () |
void | handleFill () |
void | handleFillMouseUp () |
void | handleEyedrop () |
void | handleEyedropMouseMove () |
void | handleEyedropMouseUp () |
void | updateShapeRotation (float l_rotation) |
updates selected Shapes's Rotation | |
void | updateImageAlpha (float l_alpha) |
updates selected Image's Alpha | |
bool | selectAllShapes () |
bool | deselectSelectedShapes () |
bool | deselectSelectedNodes () |
bool | cancelDrawingPoly () |
bool | cutSelectedShapes () |
bool | copySelectedShapes () |
bool | pasteSelectedShapes () |
bool | deleteSelectedShapes () |
bool | deleteSelectedNodes () |
bool | toggleLineSelectedNodes () |
void | updateNodeXY () |
bool | isSelectedNode (unsigned int p_index) |
void | addSelectedNode (unsigned int p_index) |
bool | isSelectedShape (unsigned int p_index) |
void | addSelectedShape (unsigned int p_index) |
void | trySingleSelectShape () |
void | tryMultiSelectShapes () |
void | tryMultiSelectShapes_populateShapes () |
unsigned int | getShape (unsigned int p_index, std::vector< VectorData > p_v) |
void | updateShapeColor (bool p_doFill=true, bool p_doStroke=true) |
void | updateShapeX (double p_value, bool p_stackDo=true) |
void | updateShapeY (double p_value, bool p_stackDo=true) |
void | updateShapeWidth (double p_value) |
void | updateShapeHeight (double p_value) |
void | updateNodeX (double p_value, bool p_stackDo=true) |
void | updateNodeY (double p_value, bool p_stackDo=true) |
bool | renderToPNG (std::string p_path, bool p_transparent) |
bool | renderToPNGOffset (std::string p_path, bool p_transparent, double p_offsetX=0.0, double p_offsetY=0.0) |
void | renderFrameToPNG (Cairo::RefPtr< Cairo::Context > p_context) |
void | renderFrameToPNGOffset (Cairo::RefPtr< Cairo::Context > p_context, double p_offsetX=0.0, double p_offsetY=0.0) |
PointData | applyZoomRatio (PointData p_value) |
void | setSelectedShapes (std::vector< unsigned int > p_selectedShapes) |
std::vector< unsigned int > | getSelectedShapes () |
void | unpressKeys () |
Data Fields | |
const unsigned int | _NO_SELECTION = -1 |
double | fpsElapse |
double | propX = 0 |
int | propXindex1 |
int | propXindex2 |
double | propY = 0 |
int | propYindex1 |
int | propYindex2 |
double | propWidth = 0 |
double | propHeight = 0 |
double | propRotation = 0 |
double | nodeX = 0 |
double | nodeY = 0 |
unsigned int | nodeIndexX = 0 |
unsigned int | nodeIndexY = 0 |
bool | _invalidated |
Glib::RefPtr< Gdk::Pixbuf > | _bg |
Cairo::RefPtr< Cairo::Surface > | _bgcr |
bool | _stackDo = false |
std::vector< VectorData > | _vectorDataCopyBuffer |
std::vector< VectorData > | _vectorDataZOrderBufferA |
std::vector< VectorData > | _vectorDataZOrderBufferB |
std::vector< VectorData > | _vectorDataZOrderBufferC |
Cairo::RefPtr< Cairo::Context > | cr |
bool | _isModifyingShape |
double | _zoomRatio |
PointData | _zoomReference |
PointData | __origin |
PointData | __stageArea |
PointData | _rotateReference |
bool | _rotateMode |
bool | _rotateApply |
std::vector< unsigned int > | selectedNodes |
std::vector< unsigned int > | selectedShapes |
Static Public Attributes | |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_000 |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_045 |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_090 |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_135 |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_MOVE |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_NE |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_NW |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_SW |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_SE |
static Glib::RefPtr< Gdk::Pixbuf > | imageSHAPE_ROTATE |
static ColorData | fillColor |
static StrokeColorData | stroke |
direct use for get only | |
static ColorData | pencilFillColor |
direct use for get only | |
static StrokeColorData | pencilStroke |
direct use for get only | |
static ToolMode | toolMode = MODE_NONE |
direct use for get only | |
static GdkPoint | moveStageXY |
static float | propAlpha = 1.0f |
static double | currentScale |
static PointData | origin |
static double | _zoomValue |
static std::vector< Cairo::RefPtr< Cairo::ImageSurface > > | cairoPNG |
static Cairo::RefPtr< Cairo::ImageSurface > | cairoImageSurface |
Protected Member Functions | |
virtual bool | on_expose_event (GdkEventExpose *e) |
virtual bool | on_key_press_event (GdkEventKey *e) override |
virtual bool | on_key_release_event (GdkEventKey *e) override |
virtual bool | on_event (GdkEvent *e) override |
bool | on_draw (const Cairo::RefPtr< Cairo::Context > &cr) override |
Called by Gtkmm when DrawingArea's display is invalidated. | |
bool | on_timeout () |
void | renderNode (double p_x, double p_y, unsigned int p_state=5) |
void | renderNodeControl (double p_x, double p_y, bool p_selected) |
bool | isMouseOnNode (double p_x, double p_y, unsigned int p_buffer=5) |
bool | isSelectionBoxNormalized () |
void | normalizeSelectionBox () |
bool | isNodeOnSelectionBox (double p_nodeX, double p_nodeY) |
void | drawSelectionArea () |
bool | deleteSelectedNode (unsigned int p_index) |
unsigned int | getSelectedShapeViaNode (unsigned int p_index, std::vector< VectorData > p_v) |
void | updateShapeXY () |
enum KageStage::ToolMode |
KageStage::KageStage | ( | Kage * | p_kage | ) |
|
virtual |
unsigned int KageStage::addImage | ( | unsigned int | p_ID | ) |
This will return a Cairo::ImageSurface array-index to be used as ID for rendering on Stage or Library.
p_ID | reference ID from Assets |
unsigned int KageStage::addImage | ( | unsigned int | p_ID, |
double | p_x, | ||
double | p_y ) |
void KageStage::addSelectedNode | ( | unsigned int | p_index | ) |
void KageStage::addSelectedShape | ( | unsigned int | p_index | ) |
bool KageStage::cancelDrawingPoly | ( | ) |
void KageStage::cleanSlate | ( | ) |
void KageStage::clearScreen | ( | Cairo::RefPtr< Cairo::Context > | p_context | ) |
for use with zoom; default value is _kage->_document._width; can be changed as preferred
bool KageStage::copySelectedShapes | ( | ) |
bool KageStage::cutSelectedShapes | ( | ) |
|
protected |
bool KageStage::deleteSelectedNodes | ( | ) |
bool KageStage::deleteSelectedShapes | ( | ) |
bool KageStage::deselectSelectedNodes | ( | ) |
bool KageStage::deselectSelectedShapes | ( | ) |
|
protected |
Gdk::Color KageStage::getFill | ( | ) |
std::vector< unsigned int > KageStage::getSelectedShapes | ( | ) |
|
protected |
unsigned int KageStage::getShape | ( | unsigned int | p_index, |
std::vector< VectorData > | p_v ) |
Gdk::Color KageStage::getStroke | ( | ) |
void KageStage::handleDrawOvalMouseUp | ( | ) |
void KageStage::handleDrawPencilMouseDown | ( | PointData | p_point | ) |
void KageStage::handleDrawPencilMouseMove | ( | PointData | p_point | ) |
void KageStage::handleDrawPencilMouseUp | ( | ) |
void KageStage::handleDrawPolyMouseUp | ( | ) |
void KageStage::handleDrawRectMouseUp | ( | ) |
void KageStage::handleEyedrop | ( | ) |
void KageStage::handleEyedropMouseMove | ( | ) |
void KageStage::handleEyedropMouseUp | ( | ) |
void KageStage::handleFill | ( | ) |
void KageStage::handleFillMouseUp | ( | ) |
void KageStage::handleNodes | ( | ) |
bool KageStage::handleNodes_getNearestShape | ( | double | p_x, |
double | p_y, | ||
unsigned int | p_index, | ||
std::vector< VectorData > | p_v ) |
void KageStage::handleNodes_relocation | ( | ) |
make sure last point before end fill is in-sync with MOVE(shape's start point)
get index of MOVE of selectedNode
register i for later use in ENDFILL
register i for later use in ENDFILL <– note from newer handling of Poly
get index of MOVE of selectedNode
void KageStage::handleNodes_rendering | ( | ) |
void KageStage::handleNodes_selection | ( | ) |
void KageStage::handleNodesMouseDown | ( | ) |
void KageStage::handleNodesMouseUp | ( | ) |
void KageStage::handleOval | ( | ) |
void KageStage::handlePencil | ( | ) |
void KageStage::handlePoly | ( | ) |
void KageStage::handleRect | ( | ) |
void KageStage::handleShapes | ( | ) |
void KageStage::handleShapes_modifyingShape | ( | ) |
NOTE: don't use ELSE-IF to apply changes ASAP
void KageStage::handleShapes_modifyingShapeRotate | ( | ) |
void KageStage::handleShapes_moveShape | ( | double | p_diffX, |
double | p_diffY ) |
register i for later use in ENDFILL
void KageStage::handleShapes_scaleEast | ( | ) |
register i for later use in ENDFILL
NOTE: current implementation thinks image origin is top-left (or X/Y) or image
void KageStage::handleShapes_scaleNorth | ( | ) |
register i for later use in ENDFILL
NOTE: current implementation thinks image origin is top-left (or X/Y) or image
void KageStage::handleShapes_scaleSouth | ( | ) |
register i for later use in ENDFILL
NOTE: current implementation thinks image origin is top-left (or X/Y) or image
void KageStage::handleShapes_scaleWest | ( | ) |
register i for later use in ENDFILL
NOTE: current implementation thinks image origin is top-left (or X/Y) or image
void KageStage::handleShapes_updateAnchors | ( | double | p_x, |
double | p_y ) |
void KageStage::handleShapesMouseDown | ( | ) |
void KageStage::handleShapesMouseUp | ( | ) |
check if still be used; as of 2019 Nov 24, nothing is calling it
void KageStage::handleStroke | ( | ) |
void KageStage::handleStrokeMouseMove | ( | ) |
void KageStage::handleStrokeMouseUp | ( | ) |
void KageStage::initNodeTool | ( | ) |
void KageStage::invalidateToRender | ( | ) |
|
protected |
|
protected |
bool KageStage::isSelectedNode | ( | unsigned int | p_index | ) |
bool KageStage::isSelectedShape | ( | unsigned int | p_index | ) |
|
protected |
|
protected |
|
overrideprotected |
Called by Gtkmm when DrawingArea's display is invalidated.
p_cr | Cairo context object on which lines/shapes/image is applied to. |
|
overrideprotectedvirtual |
struct _GdkEventConfigure { GdkEventType type; GdkWindow *window; gint8 send_event; gint16 x, y; gint16 width; gint16 height; };
|
protectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
protected |
bool KageStage::pasteSelectedShapes | ( | ) |
void KageStage::printVectors | ( | std::vector< VectorData > | p_vectorData | ) |
void KageStage::renderFrame | ( | Cairo::RefPtr< Cairo::Context > | p_context, |
bool | p_force = false ) |
void KageStage::renderFrame | ( | Cairo::RefPtr< Cairo::Context > | p_context, |
std::vector< VectorData > | p_vectorData, | ||
double | p_alpha = 1.0 ) |
void KageStage::renderFrameOffset | ( | Cairo::RefPtr< Cairo::Context > | p_context, |
bool | p_force = false, | ||
double | p_offsetX = 0.0, | ||
double | p_offsetY = 0.0 ) |
void KageStage::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 ) |
void KageStage::renderFrameToPNG | ( | Cairo::RefPtr< Cairo::Context > | p_context | ) |
void KageStage::renderFrameToPNGOffset | ( | Cairo::RefPtr< Cairo::Context > | p_context, |
double | p_offsetX = 0.0, | ||
double | p_offsetY = 0.0 ) |
|
protected |
|
protected |
void KageStage::renderOnionFrame | ( | Cairo::RefPtr< Cairo::Context > | p_context, |
std::vector< VectorData > | p_vectorData, | ||
double | p_alpha ) |
bool KageStage::renderToPNG | ( | std::string | p_path, |
bool | p_transparent ) |
bool KageStage::renderToPNGOffset | ( | std::string | p_path, |
bool | p_transparent, | ||
double | p_offsetX = 0.0, | ||
double | p_offsetY = 0.0 ) |
bool KageStage::selectAllShapes | ( | ) |
void KageStage::setFill | ( | Gdk::Color | p_Color | ) |
void KageStage::setSelectedShapes | ( | std::vector< unsigned int > | p_selectedShapes | ) |
void KageStage::setStroke | ( | Gdk::Color | p_Color | ) |
bool KageStage::toggleLineSelectedNodes | ( | ) |
void KageStage::tryMultiSelectShapes | ( | ) |
void KageStage::tryMultiSelectShapes_populateShapes | ( | ) |
void KageStage::trySingleSelectShape | ( | ) |
void KageStage::unpressKeys | ( | ) |
void KageStage::updateImageAlpha | ( | float | l_alpha | ) |
updates selected Image's Alpha
l_alpha |
void KageStage::updateNodeX | ( | double | p_value, |
bool | p_stackDo = true ) |
void KageStage::updateNodeXY | ( | ) |
void KageStage::updateNodeY | ( | double | p_value, |
bool | p_stackDo = true ) |
void KageStage::updateShapeColor | ( | bool | p_doFill = true, |
bool | p_doStroke = true ) |
void KageStage::updateShapeHeight | ( | double | p_value | ) |
void KageStage::updateShapeRotation | ( | float | l_rotation | ) |
updates selected Shapes's Rotation
l_rotation |
void KageStage::updateShapeWidth | ( | double | p_value | ) |
void KageStage::updateShapeX | ( | double | p_value, |
bool | p_stackDo = true ) |
|
protected |
void KageStage::updateShapeY | ( | double | p_value, |
bool | p_stackDo = true ) |
PointData KageStage::__origin |
PointData KageStage::__stageArea |
Glib::RefPtr<Gdk::Pixbuf> KageStage::_bg |
Cairo::RefPtr<Cairo::Surface> KageStage::_bgcr |
|
protected |
bool KageStage::_invalidated |
bool KageStage::_isModifyingShape |
|
protected |
|
protected |
|
protected |
const unsigned int KageStage::_NO_SELECTION = -1 |
|
protected |
|
protected |
|
protected |
|
protected |
bool KageStage::_rotateApply |
bool KageStage::_rotateMode |
PointData KageStage::_rotateReference |
bool KageStage::_stackDo = false |
std::vector<VectorData> KageStage::_vectorDataCopyBuffer |
std::vector<VectorData> KageStage::_vectorDataZOrderBufferA |
std::vector<VectorData> KageStage::_vectorDataZOrderBufferB |
std::vector<VectorData> KageStage::_vectorDataZOrderBufferC |
double KageStage::_zoomRatio |
PointData KageStage::_zoomReference |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
Cairo::RefPtr<Cairo::Context> KageStage::cr |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
double KageStage::fpsElapse |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
unsigned int KageStage::nodeIndexX = 0 |
unsigned int KageStage::nodeIndexY = 0 |
double KageStage::nodeX = 0 |
double KageStage::nodeY = 0 |
|
static |
|
static |
direct use for get only
|
static |
direct use for get only
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
double KageStage::propHeight = 0 |
double KageStage::propRotation = 0 |
double KageStage::propWidth = 0 |
double KageStage::propX = 0 |
int KageStage::propXindex1 |
int KageStage::propXindex2 |
double KageStage::propY = 0 |
int KageStage::propYindex1 |
int KageStage::propYindex2 |
|
protected |
std::vector<unsigned int> KageStage::selectedNodes |
|
protected |
std::vector<unsigned int> KageStage::selectedShapes |
|
protected |
|
protected |
|
static |
direct use for get only
|
static |
direct use for get only
|
protected |