VTK-m  2.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
vtkm::rendering::Canvas Class Reference

#include <Canvas.h>

Inheritance diagram for vtkm::rendering::Canvas:
vtkm::rendering::CanvasRayTracer

Public Types

using ColorBufferType = vtkm::cont::ArrayHandle< vtkm::Vec4f_32 >
 
using DepthBufferType = vtkm::cont::ArrayHandle< vtkm::Float32 >
 
using FontTextureType = vtkm::rendering::Texture2D< 1 >
 

Public Member Functions

 Canvas (vtkm::Id width=1024, vtkm::Id height=1024)
 
virtual ~Canvas ()
 
virtual vtkm::rendering::CanvasNewCopy () const
 
virtual void Clear ()
 
virtual void BlendBackground ()
 
VTKM_CONT vtkm::Id GetWidth () const
 
VTKM_CONT vtkm::Id GetHeight () const
 
const VTKM_CONT ColorBufferTypeGetColorBuffer () const
 
VTKM_CONT ColorBufferTypeGetColorBuffer ()
 
const VTKM_CONT DepthBufferTypeGetDepthBuffer () const
 
VTKM_CONT DepthBufferTypeGetDepthBuffer ()
 
VTKM_CONT void ResizeBuffers (vtkm::Id width, vtkm::Id height)
 
const VTKM_CONT vtkm::rendering::ColorGetBackgroundColor () const
 
VTKM_CONT void SetBackgroundColor (const vtkm::rendering::Color &color)
 
const VTKM_CONT vtkm::rendering::ColorGetForegroundColor () const
 
VTKM_CONT void SetForegroundColor (const vtkm::rendering::Color &color)
 
VTKM_CONT vtkm::Id2 GetScreenPoint (vtkm::Float32 x, vtkm::Float32 y, vtkm::Float32 z, const vtkm::Matrix< vtkm::Float32, 4, 4 > &transfor) const
 
virtual void RefreshColorBuffer () const
 
virtual void RefreshDepthBuffer () const
 
virtual void SetViewToWorldSpace (const vtkm::rendering::Camera &camera, bool clip)
 
virtual void SetViewToScreenSpace (const vtkm::rendering::Camera &camera, bool clip)
 
virtual void SetViewportClipping (const vtkm::rendering::Camera &, bool)
 
virtual void SaveAs (const std::string &fileName) const
 
virtual vtkm::rendering::WorldAnnotatorCreateWorldAnnotator () const
 Creates a WorldAnnotator of a type that is paired with this Canvas. More...
 
virtual VTKM_CONT void AddColorSwatch (const vtkm::Vec2f_64 &point0, const vtkm::Vec2f_64 &point1, const vtkm::Vec2f_64 &point2, const vtkm::Vec2f_64 &point3, const vtkm::rendering::Color &color) const
 
VTKM_CONT void AddColorSwatch (const vtkm::Float64 x0, const vtkm::Float64 y0, const vtkm::Float64 x1, const vtkm::Float64 y1, const vtkm::Float64 x2, const vtkm::Float64 y2, const vtkm::Float64 x3, const vtkm::Float64 y3, const vtkm::rendering::Color &color) const
 
virtual VTKM_CONT void AddLine (const vtkm::Vec2f_64 &point0, const vtkm::Vec2f_64 &point1, vtkm::Float32 linewidth, const vtkm::rendering::Color &color) const
 
VTKM_CONT void AddLine (vtkm::Float64 x0, vtkm::Float64 y0, vtkm::Float64 x1, vtkm::Float64 y1, vtkm::Float32 linewidth, const vtkm::rendering::Color &color) const
 
virtual VTKM_CONT void AddColorBar (const vtkm::Bounds &bounds, const vtkm::cont::ColorTable &colorTable, bool horizontal) const
 
VTKM_CONT void AddColorBar (vtkm::Float32 x, vtkm::Float32 y, vtkm::Float32 width, vtkm::Float32 height, const vtkm::cont::ColorTable &colorTable, bool horizontal) const
 
virtual void AddText (const vtkm::Vec2f_32 &position, vtkm::Float32 scale, vtkm::Float32 angle, vtkm::Float32 windowAspect, const vtkm::Vec2f_32 &anchor, const vtkm::rendering::Color &color, const std::string &text) const
 
VTKM_CONT void AddText (vtkm::Float32 x, vtkm::Float32 y, vtkm::Float32 scale, vtkm::Float32 angle, vtkm::Float32 windowAspect, vtkm::Float32 anchorX, vtkm::Float32 anchorY, const vtkm::rendering::Color &color, const std::string &text) const
 
VTKM_CONT void AddText (const vtkm::Matrix< vtkm::Float32, 4, 4 > &transform, vtkm::Float32 scale, const vtkm::Vec2f_32 &anchor, const vtkm::rendering::Color &color, const std::string &text, const vtkm::Float32 &depth=0) const
 
VTKM_CONT void BeginTextRenderingBatch () const
 
VTKM_CONT void EndTextRenderingBatch () const
 
VTKM_CONT vtkm::cont::DataSet GetDataSet (const std::string &colorFieldName="color", const std::string &depthFieldName="depth") const
 Gets the image in this Canvas as a vtkm::cont::DataSet. More...
 
VTKM_CONT vtkm::cont::DataSet GetDataSet (const char *colorFieldName, const char *depthFieldName="depth") const
 Gets the image in this Canvas as a vtkm::cont::DataSet. More...
 

Private Member Functions

bool LoadFont () const
 
bool EnsureFontLoaded () const
 
const vtkm::Matrix< vtkm::Float32, 4, 4 > & GetModelView () const
 
const vtkm::Matrix< vtkm::Float32, 4, 4 > & GetProjection () const
 

Private Attributes

std::shared_ptr< CanvasInternals > Internals
 

Friends

class AxisAnnotation2D
 
class ColorBarAnnotation
 
class ColorLegendAnnotation
 
class TextAnnotationScreen
 
class TextRenderer
 
class WorldAnnotator
 

Member Typedef Documentation

◆ ColorBufferType

◆ DepthBufferType

◆ FontTextureType

Constructor & Destructor Documentation

◆ Canvas()

vtkm::rendering::Canvas::Canvas ( vtkm::Id  width = 1024,
vtkm::Id  height = 1024 
)

◆ ~Canvas()

virtual vtkm::rendering::Canvas::~Canvas ( )
virtual

Member Function Documentation

◆ AddColorBar() [1/2]

virtual VTKM_CONT void vtkm::rendering::Canvas::AddColorBar ( const vtkm::Bounds bounds,
const vtkm::cont::ColorTable colorTable,
bool  horizontal 
) const
virtual

◆ AddColorBar() [2/2]

VTKM_CONT void vtkm::rendering::Canvas::AddColorBar ( vtkm::Float32  x,
vtkm::Float32  y,
vtkm::Float32  width,
vtkm::Float32  height,
const vtkm::cont::ColorTable colorTable,
bool  horizontal 
) const

◆ AddColorSwatch() [1/2]

VTKM_CONT void vtkm::rendering::Canvas::AddColorSwatch ( const vtkm::Float64  x0,
const vtkm::Float64  y0,
const vtkm::Float64  x1,
const vtkm::Float64  y1,
const vtkm::Float64  x2,
const vtkm::Float64  y2,
const vtkm::Float64  x3,
const vtkm::Float64  y3,
const vtkm::rendering::Color color 
) const

◆ AddColorSwatch() [2/2]

virtual VTKM_CONT void vtkm::rendering::Canvas::AddColorSwatch ( const vtkm::Vec2f_64 point0,
const vtkm::Vec2f_64 point1,
const vtkm::Vec2f_64 point2,
const vtkm::Vec2f_64 point3,
const vtkm::rendering::Color color 
) const
virtual

◆ AddLine() [1/2]

virtual VTKM_CONT void vtkm::rendering::Canvas::AddLine ( const vtkm::Vec2f_64 point0,
const vtkm::Vec2f_64 point1,
vtkm::Float32  linewidth,
const vtkm::rendering::Color color 
) const
virtual

◆ AddLine() [2/2]

VTKM_CONT void vtkm::rendering::Canvas::AddLine ( vtkm::Float64  x0,
vtkm::Float64  y0,
vtkm::Float64  x1,
vtkm::Float64  y1,
vtkm::Float32  linewidth,
const vtkm::rendering::Color color 
) const

◆ AddText() [1/3]

VTKM_CONT void vtkm::rendering::Canvas::AddText ( const vtkm::Matrix< vtkm::Float32, 4, 4 > &  transform,
vtkm::Float32  scale,
const vtkm::Vec2f_32 anchor,
const vtkm::rendering::Color color,
const std::string &  text,
const vtkm::Float32 depth = 0 
) const

◆ AddText() [2/3]

virtual void vtkm::rendering::Canvas::AddText ( const vtkm::Vec2f_32 position,
vtkm::Float32  scale,
vtkm::Float32  angle,
vtkm::Float32  windowAspect,
const vtkm::Vec2f_32 anchor,
const vtkm::rendering::Color color,
const std::string &  text 
) const
virtual

◆ AddText() [3/3]

VTKM_CONT void vtkm::rendering::Canvas::AddText ( vtkm::Float32  x,
vtkm::Float32  y,
vtkm::Float32  scale,
vtkm::Float32  angle,
vtkm::Float32  windowAspect,
vtkm::Float32  anchorX,
vtkm::Float32  anchorY,
const vtkm::rendering::Color color,
const std::string &  text 
) const

◆ BeginTextRenderingBatch()

VTKM_CONT void vtkm::rendering::Canvas::BeginTextRenderingBatch ( ) const

◆ BlendBackground()

virtual void vtkm::rendering::Canvas::BlendBackground ( )
virtual

◆ Clear()

virtual void vtkm::rendering::Canvas::Clear ( )
virtual

◆ CreateWorldAnnotator()

virtual vtkm::rendering::WorldAnnotator* vtkm::rendering::Canvas::CreateWorldAnnotator ( ) const
virtual

Creates a WorldAnnotator of a type that is paired with this Canvas.

Other types of world annotators might work, but this provides a default.

The WorldAnnotator is created with the C++ new keyword (so it should be deleted with delete later). A pointer to the created WorldAnnotator is returned.

◆ EndTextRenderingBatch()

VTKM_CONT void vtkm::rendering::Canvas::EndTextRenderingBatch ( ) const

◆ EnsureFontLoaded()

bool vtkm::rendering::Canvas::EnsureFontLoaded ( ) const
private

◆ GetBackgroundColor()

const VTKM_CONT vtkm::rendering::Color& vtkm::rendering::Canvas::GetBackgroundColor ( ) const

◆ GetColorBuffer() [1/2]

VTKM_CONT ColorBufferType& vtkm::rendering::Canvas::GetColorBuffer ( )

◆ GetColorBuffer() [2/2]

const VTKM_CONT ColorBufferType& vtkm::rendering::Canvas::GetColorBuffer ( ) const

◆ GetDataSet() [1/2]

VTKM_CONT vtkm::cont::DataSet vtkm::rendering::Canvas::GetDataSet ( const char *  colorFieldName,
const char *  depthFieldName = "depth" 
) const

Gets the image in this Canvas as a vtkm::cont::DataSet.

The returned DataSet will be a uniform structured 2D grid. The color and depth buffers will be attached as field with the given names. If the name for the color or depth field is empty, then that respective field will not be added.

The arrays of the color and depth buffer are shallow copied. Thus, changes in the Canvas may cause unexpected behavior in the DataSet.

◆ GetDataSet() [2/2]

VTKM_CONT vtkm::cont::DataSet vtkm::rendering::Canvas::GetDataSet ( const std::string &  colorFieldName = "color",
const std::string &  depthFieldName = "depth" 
) const

Gets the image in this Canvas as a vtkm::cont::DataSet.

The returned DataSet will be a uniform structured 2D grid. The color and depth buffers will be attached as field with the given names. If the name for the color or depth field is empty, then that respective field will not be added.

The arrays of the color and depth buffer are shallow copied. Thus, changes in the Canvas may cause unexpected behavior in the DataSet.

◆ GetDepthBuffer() [1/2]

VTKM_CONT DepthBufferType& vtkm::rendering::Canvas::GetDepthBuffer ( )

◆ GetDepthBuffer() [2/2]

const VTKM_CONT DepthBufferType& vtkm::rendering::Canvas::GetDepthBuffer ( ) const

◆ GetForegroundColor()

const VTKM_CONT vtkm::rendering::Color& vtkm::rendering::Canvas::GetForegroundColor ( ) const

◆ GetHeight()

VTKM_CONT vtkm::Id vtkm::rendering::Canvas::GetHeight ( ) const

◆ GetModelView()

const vtkm::Matrix<vtkm::Float32, 4, 4>& vtkm::rendering::Canvas::GetModelView ( ) const
private

◆ GetProjection()

const vtkm::Matrix<vtkm::Float32, 4, 4>& vtkm::rendering::Canvas::GetProjection ( ) const
private

◆ GetScreenPoint()

VTKM_CONT vtkm::Id2 vtkm::rendering::Canvas::GetScreenPoint ( vtkm::Float32  x,
vtkm::Float32  y,
vtkm::Float32  z,
const vtkm::Matrix< vtkm::Float32, 4, 4 > &  transfor 
) const

◆ GetWidth()

VTKM_CONT vtkm::Id vtkm::rendering::Canvas::GetWidth ( ) const

◆ LoadFont()

bool vtkm::rendering::Canvas::LoadFont ( ) const
private

◆ NewCopy()

virtual vtkm::rendering::Canvas* vtkm::rendering::Canvas::NewCopy ( ) const
virtual

◆ RefreshColorBuffer()

virtual void vtkm::rendering::Canvas::RefreshColorBuffer ( ) const
inlinevirtual

◆ RefreshDepthBuffer()

virtual void vtkm::rendering::Canvas::RefreshDepthBuffer ( ) const
inlinevirtual

◆ ResizeBuffers()

VTKM_CONT void vtkm::rendering::Canvas::ResizeBuffers ( vtkm::Id  width,
vtkm::Id  height 
)

◆ SaveAs()

virtual void vtkm::rendering::Canvas::SaveAs ( const std::string &  fileName) const
virtual

◆ SetBackgroundColor()

VTKM_CONT void vtkm::rendering::Canvas::SetBackgroundColor ( const vtkm::rendering::Color color)

◆ SetForegroundColor()

VTKM_CONT void vtkm::rendering::Canvas::SetForegroundColor ( const vtkm::rendering::Color color)

◆ SetViewportClipping()

virtual void vtkm::rendering::Canvas::SetViewportClipping ( const vtkm::rendering::Camera ,
bool   
)
inlinevirtual

◆ SetViewToScreenSpace()

virtual void vtkm::rendering::Canvas::SetViewToScreenSpace ( const vtkm::rendering::Camera camera,
bool  clip 
)
virtual

◆ SetViewToWorldSpace()

virtual void vtkm::rendering::Canvas::SetViewToWorldSpace ( const vtkm::rendering::Camera camera,
bool  clip 
)
virtual

Friends And Related Function Documentation

◆ AxisAnnotation2D

friend class AxisAnnotation2D
friend

◆ ColorBarAnnotation

friend class ColorBarAnnotation
friend

◆ ColorLegendAnnotation

friend class ColorLegendAnnotation
friend

◆ TextAnnotationScreen

friend class TextAnnotationScreen
friend

◆ TextRenderer

friend class TextRenderer
friend

◆ WorldAnnotator

friend class WorldAnnotator
friend

Member Data Documentation

◆ Internals

std::shared_ptr<CanvasInternals> vtkm::rendering::Canvas::Internals
private

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