#include <vtkContext2D.h>
This defines the interface for drawing onto a 2D context. The context must be set up with a vtkContextDevice2D derived class that provides the functions to facilitate the low level calls to the context. Currently only an OpenGL based device is provided, but this could be extended in the future.
Definition at line 54 of file vtkContext2D.h.
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
virtual void | PrintSelf (ostream &os, vtkIndent indent) |
bool | Begin (vtkContextDevice2D *device) |
virtual vtkContextDevice2D * | GetDevice () |
bool | End () |
bool | GetBufferIdMode () const |
void | BufferIdModeBegin (vtkAbstractContextBufferId *bufferId) |
void | BufferIdModeEnd () |
void | DrawLine (float x1, float y1, float x2, float y2) |
void | DrawLine (float p[4]) |
void | DrawLine (vtkPoints2D *points) |
void | DrawPoly (float *x, float *y, int n) |
void | DrawPoly (vtkPoints2D *points) |
void | DrawPoly (float *points, int n) |
void | DrawPoint (float x, float y) |
void | DrawPoints (float *x, float *y, int n) |
void | DrawPoints (vtkPoints2D *points) |
void | DrawPoints (float *points, int n) |
void | DrawPointSprites (vtkImageData *sprite, vtkPoints2D *points) |
void | DrawPointSprites (vtkImageData *sprite, float *points, int n) |
void | DrawRect (float x, float y, float w, float h) |
void | DrawPolygon (float *x, float *y, int n) |
void | DrawPolygon (vtkPoints2D *points) |
void | DrawPolygon (float *points, int n) |
void | DrawEllipse (float x, float y, float rx, float ry) |
void | DrawImage (float x, float y, vtkImageData *image) |
void | DrawImage (float x, float y, float scale, vtkImageData *image) |
void | DrawImage (const vtkRectf &pos, vtkImageData *image) |
void | ApplyPen (vtkPen *pen) |
vtkPen * | GetPen () |
void | ApplyBrush (vtkBrush *brush) |
vtkBrush * | GetBrush () |
void | ApplyTextProp (vtkTextProperty *prop) |
vtkTextProperty * | GetTextProp () |
void | SetTransform (vtkTransform2D *transform) |
vtkTransform2D * | GetTransform () |
void | AppendTransform (vtkTransform2D *transform) |
void | ApplyId (vtkIdType id) |
void | DrawPoly (float *points, int n, unsigned char *colors, int nc_comps) |
void | DrawPointSprites (vtkImageData *sprite, vtkPoints2D *points, vtkUnsignedCharArray *colors) |
void | DrawPointSprites (vtkImageData *sprite, float *points, int n, unsigned char *colors, int nc_comps) |
void | DrawQuad (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) |
void | DrawQuad (float *p) |
void | DrawQuadStrip (vtkPoints2D *points) |
void | DrawQuadStrip (float *p, int n) |
void | DrawWedge (float x, float y, float outRadius, float inRadius, float startAngle, float stopAngle) |
void | DrawEllipseWedge (float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle) |
void | DrawArc (float x, float y, float r, float startAngle, float stopAngle) |
void | DrawEllipticArc (float x, float y, float rX, float rY, float startAngle, float stopAngle) |
void | DrawStringRect (vtkPoints2D *rect, const vtkStdString &string) |
void | DrawStringRect (vtkPoints2D *rect, const vtkUnicodeString &string) |
void | DrawStringRect (vtkPoints2D *rect, const char *string) |
void | DrawString (vtkPoints2D *point, const vtkStdString &string) |
void | DrawString (float x, float y, const vtkStdString &string) |
void | DrawString (vtkPoints2D *point, const vtkUnicodeString &string) |
void | DrawString (float x, float y, const vtkUnicodeString &string) |
void | DrawString (vtkPoints2D *point, const char *string) |
void | DrawString (float x, float y, const char *string) |
void | ComputeStringBounds (const vtkStdString &string, vtkPoints2D *bounds) |
void | ComputeStringBounds (const vtkStdString &string, float bounds[4]) |
void | ComputeStringBounds (const vtkUnicodeString &string, vtkPoints2D *bounds) |
void | ComputeStringBounds (const vtkUnicodeString &string, float bounds[4]) |
void | ComputeStringBounds (const char *string, vtkPoints2D *bounds) |
void | ComputeStringBounds (const char *string, float bounds[4]) |
void | PushMatrix () |
void | PopMatrix () |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkContext2D * | SafeDownCast (vtkObject *o) |
static vtkContext2D * | New () |
static int | FloatToInt (float x) |
Protected Member Functions | |
vtkContext2D () | |
~vtkContext2D () | |
Protected Attributes | |
vtkContextDevice2D * | Device |
vtkTransform2D * | Transform |
vtkAbstractContextBufferId * | BufferId |
typedef vtkObject vtkContext2D::Superclass |
vtkContext2D::vtkContext2D | ( | ) | [protected] |
vtkContext2D::~vtkContext2D | ( | ) | [protected] |
virtual const char* vtkContext2D::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkContext2D::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkContext2D::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkContext2D* vtkContext2D::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
virtual void vtkContext2D::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
static vtkContext2D* vtkContext2D::New | ( | ) | [static] |
Creates a 2D Painter object.
Reimplemented from vtkObject.
bool vtkContext2D::Begin | ( | vtkContextDevice2D * | device | ) |
Begin painting on a vtkContextDevice2D, no painting can occur before this call has been made. Only one painter is allowed at a time on any given paint device. Returns true if successful, otherwise false.
virtual vtkContextDevice2D* vtkContext2D::GetDevice | ( | ) | [virtual] |
bool vtkContext2D::End | ( | ) |
Ends painting on the device, you would not usually need to call this as it should be called by the destructor. Returns true if the painter is no longer active, otherwise false.
bool vtkContext2D::GetBufferIdMode | ( | ) | const |
Tell if the context is in BufferId creation mode. Initial value is false.
void vtkContext2D::BufferIdModeBegin | ( | vtkAbstractContextBufferId * | bufferId | ) |
Start BufferId creation Mode.
bufferId_exists: bufferId!=0
void vtkContext2D::BufferIdModeEnd | ( | ) |
Finalize BufferId creation Mode. It makes sure that the content of the bufferId passed in argument of BufferIdModeBegin() is correctly set.
void vtkContext2D::DrawLine | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2 | |||
) |
Draw a line between the specified points.
void vtkContext2D::DrawLine | ( | float | p[4] | ) |
Draw a line between the specified points.
void vtkContext2D::DrawLine | ( | vtkPoints2D * | points | ) |
Draw a line between the specified points. Note: Fastest path - points packed in x and y.
void vtkContext2D::DrawPoly | ( | float * | x, | |
float * | y, | |||
int | n | |||
) |
Draw a poly line between the specified points.
void vtkContext2D::DrawPoly | ( | vtkPoints2D * | points | ) |
Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates.
void vtkContext2D::DrawPoly | ( | float * | points, | |
int | n | |||
) |
Draw a poly line between the specified points, where the float array is of size 2*n and the points are packed x1, y1, x2, y2 etc. Note: Fastest code path - points packed in x and y.
void vtkContext2D::DrawPoly | ( | float * | points, | |
int | n, | |||
unsigned char * | colors, | |||
int | nc_comps | |||
) |
Draw a poly line between the specified points, where the float array is of size 2*n and the points are packed x1, y1, x2, y2 etc. The line will be colored by the colors array, which must have nc_comps components (defining a single color). Note: Fastest code path - points packed in x and y.
void vtkContext2D::DrawPoint | ( | float | x, | |
float | y | |||
) |
Draw a point at the supplied x and y coordinate
void vtkContext2D::DrawPoints | ( | float * | x, | |
float * | y, | |||
int | n | |||
) |
Draw the specified number of points using the x and y arrays supplied
void vtkContext2D::DrawPoints | ( | vtkPoints2D * | points | ) |
Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates.
void vtkContext2D::DrawPoints | ( | float * | points, | |
int | n | |||
) |
Draw a poly line between the specified points, where the float array is of size 2*n and the points are packed x1, y1, x2, y2 etc. Note: Fastest code path - points packed in x and y.
void vtkContext2D::DrawPointSprites | ( | vtkImageData * | sprite, | |
vtkPoints2D * | points | |||
) |
Draw a series of point sprites, images centred at the points supplied. The supplied vtkImageData is the sprite to be drawn, only squares will be drawn and the size is set using SetPointSize.
void vtkContext2D::DrawPointSprites | ( | vtkImageData * | sprite, | |
vtkPoints2D * | points, | |||
vtkUnsignedCharArray * | colors | |||
) |
Draw a series of point sprites, images centred at the points supplied. The supplied vtkImageData is the sprite to be drawn, only squares will be drawn and the size is set using SetPointSize. Points will be colored by the colors array, which must be the same length as points.
void vtkContext2D::DrawPointSprites | ( | vtkImageData * | sprite, | |
float * | points, | |||
int | n, | |||
unsigned char * | colors, | |||
int | nc_comps | |||
) |
Draw a series of point sprites, images centred at the points supplied. The supplied vtkImageData is the sprite to be drawn, only squares will be drawn and the size is set using SetPointSize. Points will be colored by the colors array, which must be the same length as points.
void vtkContext2D::DrawPointSprites | ( | vtkImageData * | sprite, | |
float * | points, | |||
int | n | |||
) |
Draw a series of point sprites, images centred at the points supplied. The supplied vtkImageData is the sprite to be drawn, only squares will be drawn and the size is set using SetPointSize.
void vtkContext2D::DrawRect | ( | float | x, | |
float | y, | |||
float | w, | |||
float | h | |||
) |
Draw a rectangle with origin at x, y and width w, height h
void vtkContext2D::DrawQuad | ( | float | x1, | |
float | y1, | |||
float | x2, | |||
float | y2, | |||
float | x3, | |||
float | y3, | |||
float | x4, | |||
float | y4 | |||
) |
Draw a quadrilateral at the specified points (4 points, 8 floats in x, y).
void vtkContext2D::DrawQuad | ( | float * | p | ) |
Draw a quadrilateral at the specified points (4 points, 8 floats in x, y).
void vtkContext2D::DrawQuadStrip | ( | vtkPoints2D * | points | ) |
Draw a strip of quads
void vtkContext2D::DrawQuadStrip | ( | float * | p, | |
int | n | |||
) |
Draw a strip of quads
void vtkContext2D::DrawPolygon | ( | float * | x, | |
float * | y, | |||
int | n | |||
) |
Draw a polygon specified specified by the points using the x and y arrays supplied
void vtkContext2D::DrawPolygon | ( | vtkPoints2D * | points | ) |
Draw a polygon defined by the specified points - fastest code path due to memory layout of the coordinates.
void vtkContext2D::DrawPolygon | ( | float * | points, | |
int | n | |||
) |
Draw a polygon defined by the specified points, where the float array is of size 2*n and the points are packed x1, y1, x2, y2 etc. Note: Fastest code path - points packed in x and y.
void vtkContext2D::DrawEllipse | ( | float | x, | |
float | y, | |||
float | rx, | |||
float | ry | |||
) |
Draw an ellipse with center at x, y and radii rx, ry.
positive_ry: ry>=0
void vtkContext2D::DrawWedge | ( | float | x, | |
float | y, | |||
float | outRadius, | |||
float | inRadius, | |||
float | startAngle, | |||
float | stopAngle | |||
) |
Draw a circular wedge with center at x, y, outer radius outRadius, inner radius inRadius between angles startAngle and stopAngle (expressed in degrees).
positive_inRadius: inRadius>=0
ordered_radii: inRadius<=outRadius
void vtkContext2D::DrawEllipseWedge | ( | float | x, | |
float | y, | |||
float | outRx, | |||
float | outRy, | |||
float | inRx, | |||
float | inRy, | |||
float | startAngle, | |||
float | stopAngle | |||
) |
Draw an elliptic wedge with center at x, y, outer radii outRx, outRy, inner radii inRx, inRy between angles startAngle and stopAngle (expressed in degrees).
positive_outRy: outRy>=0
positive_inRx: inRx>=0
positive_inRy: inRy>=0
ordered_rx: inRx<=outRx
ordered_ry: inRy<=outRy
void vtkContext2D::DrawArc | ( | float | x, | |
float | y, | |||
float | r, | |||
float | startAngle, | |||
float | stopAngle | |||
) |
Draw a circular arc with center at x,y with radius r between angles startAngle and stopAngle (expressed in degrees).
void vtkContext2D::DrawEllipticArc | ( | float | x, | |
float | y, | |||
float | rX, | |||
float | rY, | |||
float | startAngle, | |||
float | stopAngle | |||
) |
Draw an elliptic arc with center at x,y with radii rX and rY between angles startAngle and stopAngle (expressed in degrees).
positive_rY: rY>=0
void vtkContext2D::DrawImage | ( | float | x, | |
float | y, | |||
vtkImageData * | image | |||
) |
Draw the supplied image at the given x, y location (bottom corner).
void vtkContext2D::DrawImage | ( | float | x, | |
float | y, | |||
float | scale, | |||
vtkImageData * | image | |||
) |
Draw the supplied image at the given x, y location (bottom corner). Scale the supplied image by scale.
void vtkContext2D::DrawImage | ( | const vtkRectf & | pos, | |
vtkImageData * | image | |||
) |
Draw the supplied image at the given position. The origin, width, and height are specified by the supplied vtkRectf variable pos. The image will be drawn scaled to that size.
void vtkContext2D::DrawStringRect | ( | vtkPoints2D * | rect, | |
const vtkStdString & | string | |||
) |
Draw some text to the screen in a bounding rectangle with the alignment of the text properties respecting the rectangle. The points should be supplied as bottom corner (x, y), width, height.
void vtkContext2D::DrawStringRect | ( | vtkPoints2D * | rect, | |
const vtkUnicodeString & | string | |||
) |
Draw some text to the screen in a bounding rectangle with the alignment of the text properties respecting the rectangle. The points should be supplied as bottom corner (x, y), width, height.
void vtkContext2D::DrawStringRect | ( | vtkPoints2D * | rect, | |
const char * | string | |||
) |
Draw some text to the screen in a bounding rectangle with the alignment of the text properties respecting the rectangle. The points should be supplied as bottom corner (x, y), width, height.
void vtkContext2D::DrawString | ( | vtkPoints2D * | point, | |
const vtkStdString & | string | |||
) |
Draw some text to the screen.
void vtkContext2D::DrawString | ( | float | x, | |
float | y, | |||
const vtkStdString & | string | |||
) |
Draw some text to the screen.
void vtkContext2D::DrawString | ( | vtkPoints2D * | point, | |
const vtkUnicodeString & | string | |||
) |
Draw some text to the screen.
void vtkContext2D::DrawString | ( | float | x, | |
float | y, | |||
const vtkUnicodeString & | string | |||
) |
Draw some text to the screen.
void vtkContext2D::DrawString | ( | vtkPoints2D * | point, | |
const char * | string | |||
) |
Draw some text to the screen.
void vtkContext2D::DrawString | ( | float | x, | |
float | y, | |||
const char * | string | |||
) |
Draw some text to the screen.
void vtkContext2D::ComputeStringBounds | ( | const vtkStdString & | string, | |
vtkPoints2D * | bounds | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ComputeStringBounds | ( | const vtkStdString & | string, | |
float | bounds[4] | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ComputeStringBounds | ( | const vtkUnicodeString & | string, | |
vtkPoints2D * | bounds | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ComputeStringBounds | ( | const vtkUnicodeString & | string, | |
float | bounds[4] | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ComputeStringBounds | ( | const char * | string, | |
vtkPoints2D * | bounds | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ComputeStringBounds | ( | const char * | string, | |
float | bounds[4] | |||
) |
Compute the bounds of the supplied string. The bounds will be copied to the supplied bounds variable, the first two elements are the bottom corner of the string, and the second two elements are the width and height of the bounding box. NOTE: This function does not take account of the text rotation.
void vtkContext2D::ApplyPen | ( | vtkPen * | pen | ) |
Apply the supplied pen which controls the outlines of shapes, as well as lines, points and related primitives. This makes a deep copy of the vtkPen object in the vtkContext2D, it does not hold a pointer to the supplied object.
vtkPen* vtkContext2D::GetPen | ( | ) |
Get the pen which controls the outlines of shapes, as well as lines, points and related primitives. This object can be modified and the changes will be reflected in subsequent drawing operations.
void vtkContext2D::ApplyBrush | ( | vtkBrush * | brush | ) |
Apply the supplied brush which controls the outlines of shapes, as well as lines, points and related primitives. This makes a deep copy of the vtkBrush object in the vtkContext2D, it does not hold a pointer to the supplied object.
vtkBrush* vtkContext2D::GetBrush | ( | ) |
Get the pen which controls the outlines of shapes as well as lines, points and related primitives.
void vtkContext2D::ApplyTextProp | ( | vtkTextProperty * | prop | ) |
Apply the supplied text property which controls how text is rendered. This makes a deep copy of the vtkTextProperty object in the vtkContext2D, it does not hold a pointer to the supplied object.
vtkTextProperty* vtkContext2D::GetTextProp | ( | ) |
Get the text properties object for the vtkContext2D.
void vtkContext2D::SetTransform | ( | vtkTransform2D * | transform | ) |
Set the transform for the context, the underlying device will use the matrix of the transform. Note, this is set immediately, later changes to the matrix will have no effect until it is set again.
vtkTransform2D* vtkContext2D::GetTransform | ( | ) |
Compute the current transform applied to the context.
void vtkContext2D::AppendTransform | ( | vtkTransform2D * | transform | ) |
Append the transform for the context, the underlying device will use the matrix of the transform. Note, this is set immediately, later changes to the matrix will have no effect until it is set again. The matrix of the transform will multiply the current context transform.
void vtkContext2D::PushMatrix | ( | ) |
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when available).
void vtkContext2D::PopMatrix | ( | ) |
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when available).
void vtkContext2D::ApplyId | ( | vtkIdType | id | ) |
Apply id as a color.
int vtkContext2D::FloatToInt | ( | float | x | ) | [inline, static] |
Float to int conversion, performs truncation but with a rounding tolerance for float values that are within 1/256 of their closest integer.
Definition at line 356 of file vtkContext2D.h.
vtkContextDevice2D* vtkContext2D::Device [protected] |
Definition at line 341 of file vtkContext2D.h.
vtkTransform2D* vtkContext2D::Transform [protected] |
Definition at line 342 of file vtkContext2D.h.
vtkAbstractContextBufferId* vtkContext2D::BufferId [protected] |
Definition at line 344 of file vtkContext2D.h.