VTK-m
2.2
|
Represents the image space that is the target of rendering. More...
#include <Canvas.h>
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) | |
Construct a canvas of a given width and height. More... | |
virtual | ~Canvas () |
virtual vtkm::rendering::Canvas * | NewCopy () const |
Create a new Canvas object of the same subtype as this one. More... | |
virtual void | Clear () |
Clear out the image buffers. More... | |
virtual void | BlendBackground () |
Blend the foreground data with the background color. More... | |
vtkm::Id | GetWidth () const |
The width of the image. More... | |
vtkm::Id | GetHeight () const |
The height of the image. More... | |
const ColorBufferType & | GetColorBuffer () const |
Get the color channels of the image. More... | |
ColorBufferType & | GetColorBuffer () |
Get the color channels of the image. More... | |
const DepthBufferType & | GetDepthBuffer () const |
Get the depth channel of the image. More... | |
DepthBufferType & | GetDepthBuffer () |
Get the depth channel of the image. More... | |
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::DataSet | GetDataSet (const char *colorFieldName, const char *depthFieldName="depth") const |
Gets the image in this Canvas as a vtkm::cont::DataSet . More... | |
void | ResizeBuffers (vtkm::Id width, vtkm::Id height) |
Change the size of the image. More... | |
const vtkm::rendering::Color & | GetBackgroundColor () const |
Specify the background color. More... | |
void | SetBackgroundColor (const vtkm::rendering::Color &color) |
Specify the background color. More... | |
const vtkm::rendering::Color & | GetForegroundColor () const |
Specify the foreground color used for annotations. More... | |
void | SetForegroundColor (const vtkm::rendering::Color &color) |
Specify the foreground color used for annotations. More... | |
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 |
Save the rendered image. More... | |
virtual vtkm::rendering::WorldAnnotator * | CreateWorldAnnotator () const |
Creates a WorldAnnotator of a type that is paired with this Canvas. More... | |
virtual 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 |
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 void | AddLine (const vtkm::Vec2f_64 &point0, const vtkm::Vec2f_64 &point1, vtkm::Float32 linewidth, const vtkm::rendering::Color &color) const |
void | AddLine (vtkm::Float64 x0, vtkm::Float64 y0, vtkm::Float64 x1, vtkm::Float64 y1, vtkm::Float32 linewidth, const vtkm::rendering::Color &color) const |
virtual void | AddColorBar (const vtkm::Bounds &bounds, const vtkm::cont::ColorTable &colorTable, bool horizontal) const |
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 |
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 |
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 |
void | BeginTextRenderingBatch () const |
void | EndTextRenderingBatch () const |
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 |
Represents the image space that is the target of rendering.
Construct a canvas of a given width and height.
|
virtual |
|
virtual |
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 |
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 |
|
virtual |
|
virtual |
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 |
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 |
|
virtual |
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 |
void vtkm::rendering::Canvas::BeginTextRenderingBatch | ( | ) | const |
|
virtual |
Blend the foreground data with the background color.
When a render is started, it is given a zeroed background rather than the background color specified by SetBackgroundColor()
. This is because when blending pixel fragments of transparent objects the background color can interfere. Call this method after the render is completed for the final blend to get the proper background color.
|
virtual |
Clear out the image buffers.
|
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.
void vtkm::rendering::Canvas::EndTextRenderingBatch | ( | ) | const |
|
private |
const vtkm::rendering::Color& vtkm::rendering::Canvas::GetBackgroundColor | ( | ) | const |
Specify the background color.
ColorBufferType& vtkm::rendering::Canvas::GetColorBuffer | ( | ) |
Get the color channels of the image.
const ColorBufferType& vtkm::rendering::Canvas::GetColorBuffer | ( | ) | const |
Get the color channels of the image.
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
.
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
.
DepthBufferType& vtkm::rendering::Canvas::GetDepthBuffer | ( | ) |
Get the depth channel of the image.
const DepthBufferType& vtkm::rendering::Canvas::GetDepthBuffer | ( | ) | const |
Get the depth channel of the image.
const vtkm::rendering::Color& vtkm::rendering::Canvas::GetForegroundColor | ( | ) | const |
Specify the foreground color used for annotations.
vtkm::Id vtkm::rendering::Canvas::GetHeight | ( | ) | const |
The height of the image.
|
private |
|
private |
vtkm::Id2 vtkm::rendering::Canvas::GetScreenPoint | ( | vtkm::Float32 | x, |
vtkm::Float32 | y, | ||
vtkm::Float32 | z, | ||
const vtkm::Matrix< vtkm::Float32, 4, 4 > & | transfor | ||
) | const |
vtkm::Id vtkm::rendering::Canvas::GetWidth | ( | ) | const |
The width of the image.
|
private |
|
virtual |
Create a new Canvas
object of the same subtype as this one.
Reimplemented in vtkm::rendering::CanvasRayTracer.
|
inlinevirtual |
|
inlinevirtual |
Change the size of the image.
|
virtual |
Save the rendered image.
If the filename ends with ".png", it will be saved in the portable network graphic format. Otherwise, the file will be saved in Netbpm portable pixmap format.
void vtkm::rendering::Canvas::SetBackgroundColor | ( | const vtkm::rendering::Color & | color | ) |
Specify the background color.
void vtkm::rendering::Canvas::SetForegroundColor | ( | const vtkm::rendering::Color & | color | ) |
Specify the foreground color used for annotations.
|
inlinevirtual |
|
virtual |
|
virtual |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |