Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CanvasPainter Class Reference
+ Collaboration diagram for CanvasPainter:
Collaboration graph
[legend]

Public Member Functions

 CanvasPainter (QPixmap &canvas)
 
void reset ()
 
void setViewTransform (const QTransform view, const QTransform viewInverse)
 
void setOnionSkinOptions (const OnionSkinPainterOptions &onionSkinOptions)
 
void setOptions (const CanvasPainterOptions &p)
 
void setTransformedSelection (QRect selection, QTransform transform)
 
void ignoreTransformedSelection ()
 
void setPaintSettings (const Object *object, int currentLayer, int frame, TiledBuffer *tilledBuffer)
 
void paint (const QRect &blitRect)
 
void paintCached (const QRect &blitRect)
 
void resetLayerCache ()
 

Private Member Functions

void initializePainter (QPainter &painter, QPaintDevice &device, const QRect &blitRect)
 CanvasPainter::initializePainter Enriches the painter with a context and sets it's initial matrix.
 
void paintOnionSkinOnLayer (QPainter &painter, const QRect &blitRect, Layer *layer)
 
void paintOnionSkin (QPainter &painter, const QRect &blitRect)
 
void renderPostLayers (QPainter &painter, const QRect &blitRect)
 
void renderPreLayers (QPainter &painter, const QRect &blitRect)
 
void paintCurrentFrame (QPainter &painter, const QRect &blitRect, int startLayer, int endLayer)
 Paints layers within the specified range for the current frame.
 
void paintTransformedSelection (QPainter &painter, BitmapImage *bitmapImage, const QRect &selection) const
 
void paintBitmapOnionSkinFrame (QPainter &painter, const QRect &blitRect, Layer *layer, int nFrame, bool colorize)
 
void paintVectorOnionSkinFrame (QPainter &painter, const QRect &blitRect, Layer *layer, int nFrame, bool colorize)
 
void paintOnionSkinFrame (QPainter &painter, QPainter &onionSkinPainter, int nFrame, bool colorize, qreal frameOpacity)
 
void paintCurrentBitmapFrame (QPainter &painter, const QRect &blitRect, Layer *layer, bool isCurrentLayer)
 
void paintCurrentVectorFrame (QPainter &painter, const QRect &blitRect, Layer *layer, bool isCurrentLayer)
 

Private Attributes

CanvasPainterOptions mOptions
 
const Object * mObject = nullptr
 
QPixmap & mCanvas
 
QTransform mViewTransform
 
QTransform mViewInverse
 
int mCurrentLayerIndex = 0
 
int mFrameNumber = 0
 
TiledBuffer * mTiledBuffer = nullptr
 
QImage mScaledBitmap
 
bool mRenderTransform = false
 
QRect mSelection
 
QTransform mSelectionTransform
 
QPixmap mPostLayersPixmap
 
QPixmap mPreLayersPixmap
 
QPixmap mCurrentLayerPixmap
 
QPixmap mOnionSkinPixmap
 
bool mPreLayersPixmapCacheValid = false
 
bool mPostLayersPixmapCacheValid = false
 
const QPointF mPointZero
 
OnionSkinSubPainter mOnionSkinSubPainter
 
OnionSkinPainterOptions mOnionSkinPainterOptions
 

Static Private Attributes

static const int OVERLAY_SAFE_CENTER_CROSS_SIZE = 25
 

Detailed Description

Definition at line 53 of file canvaspainter.h.

Constructor & Destructor Documentation

◆ CanvasPainter()

CanvasPainter::CanvasPainter ( QPixmap &  canvas)
explicit

Definition at line 31 of file canvaspainter.cpp.

◆ ~CanvasPainter()

CanvasPainter::~CanvasPainter ( )
virtual

Definition at line 36 of file canvaspainter.cpp.

Member Function Documentation

◆ ignoreTransformedSelection()

void CanvasPainter::ignoreTransformedSelection ( )

Definition at line 81 of file canvaspainter.cpp.

◆ initializePainter()

void CanvasPainter::initializePainter ( QPainter &  painter,
QPaintDevice &  device,
const QRect &  blitRect 
)
private

CanvasPainter::initializePainter Enriches the painter with a context and sets it's initial matrix.

Parameters
painterThe in/out painter
pixmapThe paint device ie. a pixmap
blitRectThe rect where the blitting will occur

Definition at line 125 of file canvaspainter.cpp.

◆ paint()

void CanvasPainter::paint ( const QRect &  blitRect)

Definition at line 173 of file canvaspainter.cpp.

◆ paintBitmapOnionSkinFrame()

void CanvasPainter::paintBitmapOnionSkinFrame ( QPainter &  painter,
const QRect &  blitRect,
Layer *  layer,
int  nFrame,
bool  colorize 
)
private

Definition at line 240 of file canvaspainter.cpp.

◆ paintCached()

void CanvasPainter::paintCached ( const QRect &  blitRect)

Definition at line 86 of file canvaspainter.cpp.

◆ paintCurrentBitmapFrame()

void CanvasPainter::paintCurrentBitmapFrame ( QPainter &  painter,
const QRect &  blitRect,
Layer *  layer,
bool  isCurrentLayer 
)
private

Definition at line 298 of file canvaspainter.cpp.

◆ paintCurrentFrame()

void CanvasPainter::paintCurrentFrame ( QPainter &  painter,
const QRect &  blitRect,
int  startLayer,
int  endLayer 
)
private

Paints layers within the specified range for the current frame.

Parameters
painterThe painter to paint to
startLayerThe first layer to paint (inclusive)
endLayerThe last layer to paint (inclusive)

Definition at line 412 of file canvaspainter.cpp.

◆ paintCurrentVectorFrame()

void CanvasPainter::paintCurrentVectorFrame ( QPainter &  painter,
const QRect &  blitRect,
Layer *  layer,
bool  isCurrentLayer 
)
private

Definition at line 334 of file canvaspainter.cpp.

◆ paintOnionSkin()

void CanvasPainter::paintOnionSkin ( QPainter &  painter,
const QRect &  blitRect 
)
private

Definition at line 225 of file canvaspainter.cpp.

◆ paintOnionSkinFrame()

void CanvasPainter::paintOnionSkinFrame ( QPainter &  painter,
QPainter &  onionSkinPainter,
int  nFrame,
bool  colorize,
qreal  frameOpacity 
)
private

Definition at line 271 of file canvaspainter.cpp.

◆ paintOnionSkinOnLayer()

void CanvasPainter::paintOnionSkinOnLayer ( QPainter &  painter,
const QRect &  blitRect,
Layer *  layer 
)
private

Definition at line 203 of file canvaspainter.cpp.

◆ paintTransformedSelection()

void CanvasPainter::paintTransformedSelection ( QPainter &  painter,
BitmapImage *  bitmapImage,
const QRect &  selection 
) const
private

Definition at line 373 of file canvaspainter.cpp.

◆ paintVectorOnionSkinFrame()

void CanvasPainter::paintVectorOnionSkinFrame ( QPainter &  painter,
const QRect &  blitRect,
Layer *  layer,
int  nFrame,
bool  colorize 
)
private

Definition at line 256 of file canvaspainter.cpp.

◆ renderPostLayers()

void CanvasPainter::renderPostLayers ( QPainter &  painter,
const QRect &  blitRect 
)
private

Definition at line 154 of file canvaspainter.cpp.

◆ renderPreLayers()

void CanvasPainter::renderPreLayers ( QPainter &  painter,
const QRect &  blitRect 
)
private

Definition at line 143 of file canvaspainter.cpp.

◆ reset()

void CanvasPainter::reset ( )

Definition at line 40 of file canvaspainter.cpp.

◆ resetLayerCache()

void CanvasPainter::resetLayerCache ( )

Definition at line 119 of file canvaspainter.cpp.

◆ setOnionSkinOptions()

void CanvasPainter::setOnionSkinOptions ( const OnionSkinPainterOptions &  onionSkinOptions)
inline

Definition at line 63 of file canvaspainter.h.

◆ setOptions()

void CanvasPainter::setOptions ( const CanvasPainterOptions &  p)
inline

Definition at line 64 of file canvaspainter.h.

◆ setPaintSettings()

void CanvasPainter::setPaintSettings ( const Object *  object,
int  currentLayer,
int  frame,
TiledBuffer *  tilledBuffer 
)

Definition at line 162 of file canvaspainter.cpp.

◆ setTransformedSelection()

void CanvasPainter::setTransformedSelection ( QRect  selection,
QTransform  transform 
)

Definition at line 65 of file canvaspainter.cpp.

◆ setViewTransform()

void CanvasPainter::setViewTransform ( const QTransform  view,
const QTransform  viewInverse 
)

Definition at line 57 of file canvaspainter.cpp.

Member Data Documentation

◆ mCanvas

QPixmap& CanvasPainter::mCanvas
private

Definition at line 104 of file canvaspainter.h.

◆ mCurrentLayerIndex

int CanvasPainter::mCurrentLayerIndex = 0
private

Definition at line 108 of file canvaspainter.h.

◆ mCurrentLayerPixmap

QPixmap CanvasPainter::mCurrentLayerPixmap
private

Definition at line 122 of file canvaspainter.h.

◆ mFrameNumber

int CanvasPainter::mFrameNumber = 0
private

Definition at line 109 of file canvaspainter.h.

◆ mObject

const Object* CanvasPainter::mObject = nullptr
private

Definition at line 103 of file canvaspainter.h.

◆ mOnionSkinPainterOptions

OnionSkinPainterOptions CanvasPainter::mOnionSkinPainterOptions
private

Definition at line 133 of file canvaspainter.h.

◆ mOnionSkinPixmap

QPixmap CanvasPainter::mOnionSkinPixmap
private

Definition at line 123 of file canvaspainter.h.

◆ mOnionSkinSubPainter

OnionSkinSubPainter CanvasPainter::mOnionSkinSubPainter
private

Definition at line 132 of file canvaspainter.h.

◆ mOptions

CanvasPainterOptions CanvasPainter::mOptions
private

Definition at line 101 of file canvaspainter.h.

◆ mPointZero

const QPointF CanvasPainter::mPointZero
private

Definition at line 129 of file canvaspainter.h.

◆ mPostLayersPixmap

QPixmap CanvasPainter::mPostLayersPixmap
private

Definition at line 120 of file canvaspainter.h.

◆ mPostLayersPixmapCacheValid

bool CanvasPainter::mPostLayersPixmapCacheValid = false
private

Definition at line 125 of file canvaspainter.h.

◆ mPreLayersPixmap

QPixmap CanvasPainter::mPreLayersPixmap
private

Definition at line 121 of file canvaspainter.h.

◆ mPreLayersPixmapCacheValid

bool CanvasPainter::mPreLayersPixmapCacheValid = false
private

Definition at line 124 of file canvaspainter.h.

◆ mRenderTransform

bool CanvasPainter::mRenderTransform = false
private

Definition at line 115 of file canvaspainter.h.

◆ mScaledBitmap

QImage CanvasPainter::mScaledBitmap
private

Definition at line 112 of file canvaspainter.h.

◆ mSelection

QRect CanvasPainter::mSelection
private

Definition at line 116 of file canvaspainter.h.

◆ mSelectionTransform

QTransform CanvasPainter::mSelectionTransform
private

Definition at line 117 of file canvaspainter.h.

◆ mTiledBuffer

TiledBuffer* CanvasPainter::mTiledBuffer = nullptr
private

Definition at line 110 of file canvaspainter.h.

◆ mViewInverse

QTransform CanvasPainter::mViewInverse
private

Definition at line 106 of file canvaspainter.h.

◆ mViewTransform

QTransform CanvasPainter::mViewTransform
private

Definition at line 105 of file canvaspainter.h.

◆ OVERLAY_SAFE_CENTER_CROSS_SIZE

const int CanvasPainter::OVERLAY_SAFE_CENTER_CROSS_SIZE = 25
staticprivate

Definition at line 135 of file canvaspainter.h.


The documentation for this class was generated from the following files:
  • core_lib/src/canvaspainter.h
  • core_lib/src/canvaspainter.cpp
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39