Blender V4.3
Freestyle::Canvas Class Referenceabstract

#include <Canvas.h>

Inherited by 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, uint 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 (uint index, StyleModule *iStyleModule)
 
void RemoveStyleModule (uint index)
 
void SwapStyleModules (uint i1, uint i2)
 
void ReplaceStyleModule (uint index, StyleModule *iStyleModule)
 
void setVisible (uint index, bool iVisible)
 
void AddLayer (StrokeLayer *iLayer)
 
void resetModified (bool iMod=false)
 
void causalStyleModules (std::vector< uint > &vec, uint index=0)
 
void setModified (uint 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 54 of file Canvas.h.

Member Typedef Documentation

◆ mapsMap

typedef std::map<const char *, ImagePyramid *, ltstr> Freestyle::Canvas::mapsMap

Definition at line 62 of file Canvas.h.

Constructor & Destructor Documentation

◆ Canvas() [1/2]

Freestyle::Canvas::Canvas ( )

◆ Canvas() [2/2]

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

◆ ~Canvas()

Freestyle::Canvas::~Canvas ( )
virtual

Definition at line 67 of file Canvas.cpp.

References _maps, _pInstance, _Renderer, _steerableViewMap, and Clear().

Member Function Documentation

◆ AddLayer()

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

Definition at line 227 of file Canvas.h.

References _Layers.

◆ border()

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

◆ causalStyleModules()

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

Definition at line 274 of file Canvas.cpp.

References _StyleModules, and size().

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

◆ Clear()

void Freestyle::Canvas::Clear ( )

◆ Draw()

◆ Erase()

void Freestyle::Canvas::Erase ( )
virtual

◆ getCurrentStyleModule()

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

Definition at line 191 of file Canvas.h.

References _current_sm.

◆ getInstance()

◆ getRecordFlag()

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

Definition at line 196 of file Canvas.h.

◆ getSteerableViewMap()

◆ getStrokeCount()

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

Definition at line 201 of file Canvas.h.

References stroke_count.

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

◆ height()

◆ init()

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

Implemented in Freestyle::AppCanvas.

◆ InsertStyleModule()

void Freestyle::Canvas::InsertStyleModule ( uint index,
StyleModule * iStyleModule )

◆ isEmpty()

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

Definition at line 121 of file Canvas.h.

References _Layers.

◆ loadMap()

void Freestyle::Canvas::loadMap ( const char * iFileName,
const char * iMapName,
uint 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 305 of file Canvas.cpp.

References _maps, _MapsPath, Box, ImBuf::byte_buffer, Freestyle::c, ImBufByteBuffer::data, ImBuf::ftype, Freestyle::ImagePyramid::getNumberOfLevels(), Freestyle::GaussianFilter::getSmoothedPixel(), height(), Freestyle::ImagePyramid::height(), IB_rect, IMB_allocImBuf(), IMB_dupImBuf(), IMB_FTYPE_BMP, IMB_loadiffname(), IMB_saveiff(), IMB_scale(), int, Freestyle::ImagePyramid::pixel(), Freestyle::GrayImage::setPixel(), w(), width(), Freestyle::ImagePyramid::width(), Freestyle::x, and y.

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

◆ loadSteerableViewMap()

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

Sets the steerable viewmap

Definition at line 159 of file Canvas.h.

References _steerableViewMap.

◆ postDraw()

void Freestyle::Canvas::postDraw ( )
virtual

Reimplemented in Freestyle::AppCanvas.

Definition at line 115 of file Canvas.cpp.

References update().

Referenced by Draw(), and Freestyle::AppCanvas::postDraw().

◆ preDraw()

void Freestyle::Canvas::preDraw ( )
virtual

Reimplemented in Freestyle::AppCanvas.

Definition at line 86 of file Canvas.cpp.

Referenced by Draw(), and Freestyle::AppCanvas::preDraw().

◆ PushBackStyleModule()

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

inserts a shader at pos index+1

Definition at line 170 of file Canvas.cpp.

References _Layers, and _StyleModules.

◆ 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 452 of file Canvas.cpp.

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

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

◆ RemoveStyleModule()

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

Definition at line 190 of file Canvas.cpp.

References _Layers, and _StyleModules.

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

◆ Render()

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

Definition at line 285 of file Canvas.cpp.

References _Layers, and _StyleModules.

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

◆ RenderBasic()

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

Definition at line 295 of file Canvas.cpp.

References _Layers, and _StyleModules.

◆ renderer()

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

Definition at line 186 of file Canvas.h.

References _Renderer.

◆ RenderStroke()

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

Implemented in Freestyle::AppCanvas.

◆ ReplaceStyleModule()

void Freestyle::Canvas::ReplaceStyleModule ( uint index,
StyleModule * iStyleModule )

Definition at line 239 of file Canvas.cpp.

References _StyleModules.

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

◆ resetModified()

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

Definition at line 266 of file Canvas.cpp.

References _StyleModules, setModified(), and 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 176 of file Canvas.h.

References _SelectedFEdge.

◆ selectedFEdge() [2/2]

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

accessors

Definition at line 171 of file Canvas.h.

References _SelectedFEdge.

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

◆ setModified()

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

◆ setSelectedFEdge()

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

modifiers

Definition at line 207 of file Canvas.h.

References _SelectedFEdge.

◆ setVisible()

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

◆ SwapStyleModules()

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

Definition at line 226 of file Canvas.cpp.

References _Layers, and _StyleModules.

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

◆ update()

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

Implemented in Freestyle::AppCanvas.

Referenced by Erase(), and postDraw().

◆ width()

Member Data Documentation

◆ _basic

bool Freestyle::Canvas::_basic
protected

Definition at line 76 of file Canvas.h.

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

◆ _current_sm

StyleModule* Freestyle::Canvas::_current_sm
protected

Definition at line 72 of file Canvas.h.

Referenced by Canvas(), Canvas(), Draw(), and getCurrentStyleModule().

◆ _Layers

◆ _maps

mapsMap Freestyle::Canvas::_maps
protected

Definition at line 73 of file Canvas.h.

Referenced by loadMap(), readMapPixel(), and ~Canvas().

◆ _MapsPath

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

Definition at line 74 of file Canvas.h.

Referenced by Freestyle::AppCanvas::AppCanvas(), and loadMap().

◆ _pInstance

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

Definition at line 66 of file Canvas.h.

Referenced by Canvas(), Canvas(), getInstance(), and ~Canvas().

◆ _Renderer

StrokeRenderer* Freestyle::Canvas::_Renderer
protected

◆ _SelectedFEdge

FEdge* Freestyle::Canvas::_SelectedFEdge
protected

Definition at line 69 of file Canvas.h.

Referenced by Canvas(), Canvas(), selectedFEdge(), selectedFEdge(), and setSelectedFEdge().

◆ _steerableViewMap

SteerableViewMap* Freestyle::Canvas::_steerableViewMap
protected

Definition at line 75 of file Canvas.h.

Referenced by Canvas(), Canvas(), Clear(), Erase(), getSteerableViewMap(), loadSteerableViewMap(), and ~Canvas().

◆ _StyleModules

◆ NB_STEERABLE_VIEWMAP

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

Definition at line 63 of file Canvas.h.

Referenced by Canvas(), and Freestyle::Controller::ComputeSteerableViewMap().

◆ stroke_count

int Freestyle::Canvas::stroke_count
protected

Definition at line 77 of file Canvas.h.

Referenced by Clear(), Draw(), Erase(), and getStrokeCount().


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