Blender  V3.3
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
Freestyle::Canvas Class Referenceabstract

#include <Canvas.h>

Inheritance diagram for Freestyle::Canvas:
Freestyle::AppCanvas

Public Types

typedef std::map< const char *, ImagePyramid *, ltstrmapsMap
 

Public Member Functions

 Canvas ()
 
 Canvas (const Canvas &iBrother)
 
virtual ~Canvas ()
 
virtual void preDraw ()
 
virtual void Draw ()
 
virtual void postDraw ()
 
virtual void Render (const StrokeRenderer *iRenderer)
 
virtual void RenderBasic (const StrokeRenderer *iRenderer)
 
virtual void RenderStroke (Stroke *iStroke)=0
 
virtual void init ()=0
 
void Clear ()
 
virtual void Erase ()
 
virtual void readColorPixels (int x, int y, int w, int h, RGBImage &oImage) const =0
 
virtual void readDepthPixels (int x, int y, int w, int h, GrayImage &oImage) const =0
 
virtual void update ()=0
 
bool isEmpty () const
 
void loadMap (const char *iFileName, const char *iMapName, unsigned iNbLevels=4, float iSigma=1.0f)
 
float readMapPixel (const char *iMapName, int level, int x, int y)
 
void loadSteerableViewMap (SteerableViewMap *iSVM)
 
SteerableViewMapgetSteerableViewMap ()
 
const FEdgeselectedFEdge () const
 
FEdgeselectedFEdge ()
 
virtual int width () const =0
 
virtual int height () const =0
 
virtual BBox< Vec2iborder () const =0
 
virtual BBox< Vec3rscene3DBBox () const =0
 
const StrokeRendererrenderer () const
 
StyleModulegetCurrentStyleModule ()
 
virtual bool getRecordFlag () const
 
int getStrokeCount () const
 
void setSelectedFEdge (FEdge *iFEdge)
 
void PushBackStyleModule (StyleModule *iStyleModule)
 
void InsertStyleModule (unsigned index, StyleModule *iStyleModule)
 
void RemoveStyleModule (unsigned index)
 
void SwapStyleModules (unsigned i1, unsigned i2)
 
void ReplaceStyleModule (unsigned index, StyleModule *iStyleModule)
 
void setVisible (unsigned index, bool iVisible)
 
void AddLayer (StrokeLayer *iLayer)
 
void resetModified (bool iMod=false)
 
void causalStyleModules (std::vector< unsigned > &vec, unsigned index=0)
 
void setModified (unsigned index, bool iMod)
 

Static Public Member Functions

static CanvasgetInstance ()
 

Static Public Attributes

static const int NB_STEERABLE_VIEWMAP = 5
 

Protected Attributes

std::deque< StrokeLayer * > _Layers
 
std::deque< StyleModule * > _StyleModules
 
FEdge_SelectedFEdge
 
StrokeRenderer_Renderer
 
StyleModule_current_sm
 
mapsMap _maps
 
SteerableViewMap_steerableViewMap
 
bool _basic
 
int stroke_count
 

Static Protected Attributes

static Canvas_pInstance = nullptr
 
static const char * _MapsPath = nullptr
 

Detailed Description

Class to define the canvas on which strokes are drawn. It's used to store state information about the drawing.

Definition at line 52 of file Canvas.h.

Member Typedef Documentation

◆ mapsMap

Definition at line 60 of file Canvas.h.

Constructor & Destructor Documentation

◆ Canvas() [1/2]

Freestyle::Canvas::Canvas ( )

Definition at line 41 of file Canvas.cpp.

References init.

◆ Canvas() [2/2]

Freestyle::Canvas::Canvas ( const Canvas iBrother)

Definition at line 52 of file Canvas.cpp.

References _basic, _current_sm, _Renderer, _SelectedFEdge, _steerableViewMap, and init.

◆ ~Canvas()

Freestyle::Canvas::~Canvas ( )
virtual

Definition at line 63 of file Canvas.cpp.

Member Function Documentation

◆ AddLayer()

void Freestyle::Canvas::AddLayer ( StrokeLayer iLayer)
inline

Definition at line 225 of file Canvas.h.

◆ border()

virtual BBox<Vec2i> Freestyle::Canvas::border ( ) const
pure virtual

◆ causalStyleModules()

void Freestyle::Canvas::causalStyleModules ( std::vector< unsigned > &  vec,
unsigned  index = 0 
)

Definition at line 266 of file Canvas.cpp.

References size().

Referenced by Freestyle::Controller::updateCausalStyleModules().

◆ Clear()

void Freestyle::Canvas::Clear ( )

Definition at line 118 of file Canvas.cpp.

Referenced by Freestyle::Controller::Clear(), and Freestyle::Controller::CloseFile().

◆ Draw()

void Freestyle::Canvas::Draw ( )
virtual

Definition at line 86 of file Canvas.cpp.

References Freestyle::TimeStamp::increment(), and instance.

Referenced by Freestyle::Controller::DrawStrokes().

◆ Erase()

void Freestyle::Canvas::Erase ( )
virtual

Reimplemented in Freestyle::AppCanvas.

Definition at line 147 of file Canvas.cpp.

References update().

Referenced by Freestyle::AppCanvas::Erase().

◆ getCurrentStyleModule()

StyleModule* Freestyle::Canvas::getCurrentStyleModule ( )
inline

Definition at line 189 of file Canvas.h.

◆ getInstance()

static Canvas* Freestyle::Canvas::getInstance ( )
inlinestatic

◆ getRecordFlag()

virtual bool Freestyle::Canvas::getRecordFlag ( ) const
inlinevirtual

Definition at line 194 of file Canvas.h.

◆ getSteerableViewMap()

SteerableViewMap* Freestyle::Canvas::getSteerableViewMap ( )
inline

◆ getStrokeCount()

int Freestyle::Canvas::getStrokeCount ( ) const
inline

Definition at line 199 of file Canvas.h.

Referenced by Freestyle::Controller::DrawStrokes().

◆ height()

virtual int Freestyle::Canvas::height ( ) const
pure virtual

◆ init()

virtual void Freestyle::Canvas::init ( )
pure virtual

Implemented in Freestyle::AppCanvas.

◆ InsertStyleModule()

void Freestyle::Canvas::InsertStyleModule ( unsigned  index,
StyleModule iStyleModule 
)

Definition at line 172 of file Canvas.cpp.

References size().

Referenced by Freestyle::Controller::InsertStyleModule().

◆ isEmpty()

bool Freestyle::Canvas::isEmpty ( ) const
inline

Definition at line 119 of file Canvas.h.

◆ loadMap()

void Freestyle::Canvas::loadMap ( const char *  iFileName,
const char *  iMapName,
unsigned  iNbLevels = 4,
float  iSigma = 1.0f 
)

Loads an image map. The map will be scaled (without preserving the ratio in order to fit the actual canvas size.). The image must be a gray values image...

Parameters
iFileNameThe name of the image file
iMapNameThe name that will be used to access this image
iNbLevelsThe number of levels in the map pyramid. (default = 4). If iNbLevels == 0, the complete pyramid is built.

Definition at line 297 of file Canvas.cpp.

References Freestyle::c, ImBuf::ftype, Freestyle::ImagePyramid::getNumberOfLevels(), Freestyle::GaussianFilter::getSmoothedPixel(), Freestyle::ImagePyramid::height(), height, IB_rect, IMB_allocImBuf(), IMB_dupImBuf(), IMB_FTYPE_BMP, IMB_loadiffname(), IMB_saveiff(), IMB_scaleImBuf(), Freestyle::ImagePyramid::pixel(), Freestyle::GrayImage::pixel(), ImBuf::rect, Freestyle::GrayImage::setPixel(), w(), Freestyle::ImagePyramid::width(), width, x, and y.

Referenced by Freestyle::ContextFunctions::LoadMapCF().

◆ loadSteerableViewMap()

void Freestyle::Canvas::loadSteerableViewMap ( SteerableViewMap iSVM)
inline

Sets the steerable viewmap

Definition at line 157 of file Canvas.h.

◆ postDraw()

void Freestyle::Canvas::postDraw ( )
virtual

Reimplemented in Freestyle::AppCanvas.

Definition at line 113 of file Canvas.cpp.

References update().

Referenced by Freestyle::AppCanvas::postDraw().

◆ preDraw()

void Freestyle::Canvas::preDraw ( )
virtual

Reimplemented in Freestyle::AppCanvas.

Definition at line 82 of file Canvas.cpp.

Referenced by Freestyle::AppCanvas::preDraw().

◆ PushBackStyleModule()

void Freestyle::Canvas::PushBackStyleModule ( StyleModule iStyleModule)

inserts a shader at pos index+1

Definition at line 165 of file Canvas.cpp.

◆ readColorPixels()

virtual void Freestyle::Canvas::readColorPixels ( int  x,
int  y,
int  w,
int  h,
RGBImage oImage 
) const
pure virtual

◆ readDepthPixels()

virtual void Freestyle::Canvas::readDepthPixels ( int  x,
int  y,
int  w,
int  h,
GrayImage oImage 
) const
pure virtual

◆ readMapPixel()

float Freestyle::Canvas::readMapPixel ( const char *  iMapName,
int  level,
int  x,
int  y 
)

Reads a pixel value in a map. Returns a value between 0 and 1.

Parameters
iMapNameThe name of the map
levelThe level of the pyramid from which the pixel must be read.
xThe abscissa of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
yThe ordinate of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.

Definition at line 447 of file Canvas.cpp.

References G, G_DEBUG_FREESTYLE, Freestyle::ImagePyramid::height(), height, Freestyle::ImagePyramid::pixel(), Freestyle::ImagePyramid::width(), x, and y.

Referenced by Freestyle::Functions0D::ReadMapPixelF0D::operator()(), and Freestyle::ContextFunctions::ReadMapPixelCF().

◆ RemoveStyleModule()

void Freestyle::Canvas::RemoveStyleModule ( unsigned  index)

Definition at line 185 of file Canvas.cpp.

Referenced by Freestyle::Controller::RemoveStyleModule().

◆ Render()

void Freestyle::Canvas::Render ( const StrokeRenderer iRenderer)
virtual

Definition at line 277 of file Canvas.cpp.

Referenced by Freestyle::Controller::RenderStrokes().

◆ RenderBasic()

void Freestyle::Canvas::RenderBasic ( const StrokeRenderer iRenderer)
virtual

Definition at line 287 of file Canvas.cpp.

◆ renderer()

const StrokeRenderer* Freestyle::Canvas::renderer ( ) const
inline

Definition at line 184 of file Canvas.h.

◆ RenderStroke()

virtual void Freestyle::Canvas::RenderStroke ( Stroke iStroke)
pure virtual

Implemented in Freestyle::AppCanvas.

◆ ReplaceStyleModule()

void Freestyle::Canvas::ReplaceStyleModule ( unsigned  index,
StyleModule iStyleModule 
)

Definition at line 232 of file Canvas.cpp.

Referenced by Freestyle::Controller::ReloadStyleModule().

◆ resetModified()

void Freestyle::Canvas::resetModified ( bool  iMod = false)

Definition at line 258 of file Canvas.cpp.

References size().

Referenced by Freestyle::Controller::resetModified().

◆ scene3DBBox()

virtual BBox<Vec3r> Freestyle::Canvas::scene3DBBox ( ) const
pure virtual

Implemented in Freestyle::AppCanvas.

◆ selectedFEdge() [1/2]

FEdge* Freestyle::Canvas::selectedFEdge ( )
inline

Definition at line 174 of file Canvas.h.

◆ selectedFEdge() [2/2]

const FEdge* Freestyle::Canvas::selectedFEdge ( ) const
inline

accessors

Definition at line 169 of file Canvas.h.

Referenced by Freestyle::ContextFunctions::GetSelectedFEdgeCF().

◆ setModified()

void Freestyle::Canvas::setModified ( unsigned  index,
bool  iMod 
)

◆ setSelectedFEdge()

void Freestyle::Canvas::setSelectedFEdge ( FEdge iFEdge)
inline

modifiers

Definition at line 205 of file Canvas.h.

◆ setVisible()

void Freestyle::Canvas::setVisible ( unsigned  index,
bool  iVisible 
)

Definition at line 248 of file Canvas.cpp.

References Freestyle::StyleModule::setDisplayed().

Referenced by Freestyle::Controller::toggleLayer().

◆ SwapStyleModules()

void Freestyle::Canvas::SwapStyleModules ( unsigned  i1,
unsigned  i2 
)

Definition at line 219 of file Canvas.cpp.

References i1.

Referenced by Freestyle::Controller::SwapStyleModules().

◆ update()

virtual void Freestyle::Canvas::update ( )
pure virtual

Implemented in Freestyle::AppCanvas.

◆ width()

virtual int Freestyle::Canvas::width ( ) const
pure virtual

Member Data Documentation

◆ _basic

bool Freestyle::Canvas::_basic
protected

Definition at line 74 of file Canvas.h.

Referenced by Canvas(), and Freestyle::AppCanvas::RenderStroke().

◆ _current_sm

StyleModule* Freestyle::Canvas::_current_sm
protected

Definition at line 70 of file Canvas.h.

Referenced by Canvas().

◆ _Layers

std::deque<StrokeLayer *> Freestyle::Canvas::_Layers
protected

Definition at line 65 of file Canvas.h.

Referenced by Freestyle::AppCanvas::postDraw().

◆ _maps

mapsMap Freestyle::Canvas::_maps
protected

Definition at line 71 of file Canvas.h.

◆ _MapsPath

const char * Freestyle::Canvas::_MapsPath = nullptr
staticprotected

Definition at line 72 of file Canvas.h.

Referenced by Freestyle::AppCanvas::AppCanvas().

◆ _pInstance

Canvas * Freestyle::Canvas::_pInstance = nullptr
staticprotected

Definition at line 64 of file Canvas.h.

◆ _Renderer

StrokeRenderer* Freestyle::Canvas::_Renderer
protected

Definition at line 69 of file Canvas.h.

Referenced by Canvas(), Freestyle::AppCanvas::init(), and Freestyle::AppCanvas::RenderStroke().

◆ _SelectedFEdge

FEdge* Freestyle::Canvas::_SelectedFEdge
protected

Definition at line 67 of file Canvas.h.

Referenced by Canvas().

◆ _steerableViewMap

SteerableViewMap* Freestyle::Canvas::_steerableViewMap
protected

Definition at line 73 of file Canvas.h.

Referenced by Canvas().

◆ _StyleModules

std::deque<StyleModule *> Freestyle::Canvas::_StyleModules
protected

Definition at line 66 of file Canvas.h.

Referenced by Freestyle::AppCanvas::postDraw().

◆ NB_STEERABLE_VIEWMAP

const int Freestyle::Canvas::NB_STEERABLE_VIEWMAP = 5
static

Definition at line 61 of file Canvas.h.

Referenced by Freestyle::Controller::ComputeSteerableViewMap().

◆ stroke_count

int Freestyle::Canvas::stroke_count
protected

Definition at line 75 of file Canvas.h.


The documentation for this class was generated from the following files: