VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkContext2D Class Reference

Class for drawing 2D primitives to a graphical context. More...

#include <vtkContext2D.h>

Inheritance diagram for vtkContext2D:
[legend]
Collaboration diagram for vtkContext2D:
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkContext2DNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
bool Begin (vtkContextDevice2D *device)
 Begin painting on a vtkContextDevice2D, no painting can occur before this call has been made. More...
 
virtual vtkContextDevice2DGetDevice ()
 
bool End ()
 Ends painting on the device, you would not usually need to call this as it should be called by the destructor. More...
 
bool GetBufferIdMode () const
 Tell if the context is in BufferId creation mode. More...
 
void BufferIdModeBegin (vtkAbstractContextBufferId *bufferId)
 Start BufferId creation Mode. More...
 
void BufferIdModeEnd ()
 Finalize BufferId creation Mode. More...
 
void DrawLine (float x1, float y1, float x2, float y2)
 Draw a line between the specified points. More...
 
void DrawLine (float p[4])
 Draw a line between the specified points. More...
 
void DrawLine (vtkPoints2D *points)
 Draw a line between the specified points. More...
 
void DrawPoly (float *x, float *y, int n)
 Draw a poly line between the specified points. More...
 
void DrawPoly (vtkPoints2D *points)
 Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates. More...
 
void 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. More...
 
void 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. More...
 
void DrawLines (vtkPoints2D *points)
 Draw multiple lines between the specified pairs of points. More...
 
void DrawLines (float *points, int n)
 Draw multiple lines between the specified pairs of points. More...
 
void DrawPoint (float x, float y)
 Draw a point at the supplied x and y coordinate. More...
 
void DrawPoints (float *x, float *y, int n)
 Draw the specified number of points using the x and y arrays supplied. More...
 
void DrawPoints (vtkPoints2D *points)
 Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates. More...
 
void 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. More...
 
void DrawPointSprites (vtkImageData *sprite, vtkPoints2D *points)
 Draw a series of point sprites, images centred at the points supplied. More...
 
void DrawPointSprites (vtkImageData *sprite, vtkPoints2D *points, vtkUnsignedCharArray *colors)
 Draw a series of point sprites, images centred at the points supplied. More...
 
void DrawPointSprites (vtkImageData *sprite, float *points, int n, unsigned char *colors, int nc_comps)
 
void DrawPointSprites (vtkImageData *sprite, float *points, int n)
 Draw a series of point sprites, images centred at the points supplied. More...
 
virtual void DrawMarkers (int shape, bool highlight, float *points, int n, unsigned char *colors, int nc_comps)
 Draw a series of markers centered at the points supplied. More...
 
virtual void DrawMarkers (int shape, bool highlight, float *points, int n)
 
virtual void DrawMarkers (int shape, bool highlight, vtkPoints2D *points)
 
virtual void DrawMarkers (int shape, bool highlight, vtkPoints2D *points, vtkUnsignedCharArray *colors)
 
void DrawRect (float x, float y, float w, float h)
 Draw a rectangle with origin at x, y and width w, height h. More...
 
void 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). More...
 
void DrawQuad (float *p)
 
void DrawQuadStrip (vtkPoints2D *points)
 Draw a strip of quads. More...
 
void DrawQuadStrip (float *p, int n)
 
void DrawPolygon (float *x, float *y, int n)
 Draw a polygon specified specified by the points using the x and y arrays supplied. More...
 
void DrawPolygon (vtkPoints2D *points)
 Draw a polygon defined by the specified points - fastest code path due to memory layout of the coordinates. More...
 
void 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. More...
 
void DrawPolygon (float *x, float *y, int n, unsigned char *color, int nc_comps)
 Draw a polygon specified specified by the points using the x and y arrays supplied. More...
 
void DrawPolygon (vtkPoints2D *points, unsigned char *color, int nc_comps)
 Draw a polygon defined by the specified points - fastest code path due to memory layout of the coordinates. More...
 
void DrawPolygon (float *points, int n, unsigned char *color, int nc_comps)
 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. More...
 
void DrawEllipse (float x, float y, float rx, float ry)
 Draw an ellipse with center at x, y and radii rx, ry. More...
 
void 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). More...
 
void 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). More...
 
void 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). More...
 
void 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). More...
 
void DrawImage (float x, float y, vtkImageData *image)
 Draw the supplied image at the given x, y location (bottom corner). More...
 
void DrawImage (float x, float y, float scale, vtkImageData *image)
 Draw the supplied image at the given x, y location (bottom corner). More...
 
void DrawImage (const vtkRectf &pos, vtkImageData *image)
 Draw the supplied image at the given position. More...
 
void DrawPolyData (float x, float y, vtkPolyData *polyData, vtkUnsignedCharArray *colors, int scalarMode)
 Draw the supplied polyData at the given x, y position (bottom corner). More...
 
void 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. More...
 
void DrawStringRect (vtkPoints2D *rect, const vtkUnicodeString &string)
 
void DrawStringRect (vtkPoints2D *rect, const char *string)
 
void DrawString (vtkPoints2D *point, const vtkStdString &string)
 Draw some text to the screen. More...
 
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)
 Compute the bounds of the supplied string. More...
 
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 ComputeJustifiedStringBounds (const char *string, float bounds[4])
 Compute the bounds of the supplied string while taking into account the justification and rotation of the currently applied text property. More...
 
int ComputeFontSizeForBoundedString (const vtkStdString &string, float width, float height)
 Calculate the largest possible font size where the supplied string will fit within the specified bounds. More...
 
void DrawMathTextString (vtkPoints2D *point, const vtkStdString &string)
 Draw a MathText formatted equation to the screen. More...
 
void DrawMathTextString (float x, float y, const vtkStdString &string)
 
void DrawMathTextString (vtkPoints2D *point, const char *string)
 
void DrawMathTextString (float x, float y, const char *string)
 
void DrawMathTextString (vtkPoints2D *point, const vtkStdString &string, const vtkStdString &fallback)
 Draw a MathText formatted equation to the screen. More...
 
void DrawMathTextString (float x, float y, const vtkStdString &string, const vtkStdString &fallback)
 
void DrawMathTextString (vtkPoints2D *point, const char *string, const char *fallback)
 
void DrawMathTextString (float x, float y, const char *string, const char *fallback)
 
bool MathTextIsSupported ()
 Return true if MathText rendering available on the current device. More...
 
void ApplyPen (vtkPen *pen)
 Apply the supplied pen which controls the outlines of shapes, as well as lines, points and related primitives. More...
 
vtkPenGetPen ()
 Get the pen which controls the outlines of shapes, as well as lines, points and related primitives. More...
 
void ApplyBrush (vtkBrush *brush)
 Apply the supplied brush which controls the outlines of shapes, as well as lines, points and related primitives. More...
 
vtkBrushGetBrush ()
 Get the pen which controls the outlines of shapes as well as lines, points and related primitives. More...
 
void ApplyTextProp (vtkTextProperty *prop)
 Apply the supplied text property which controls how text is rendered. More...
 
vtkTextPropertyGetTextProp ()
 Get the text properties object for the vtkContext2D. More...
 
void SetTransform (vtkTransform2D *transform)
 Set the transform for the context, the underlying device will use the matrix of the transform. More...
 
vtkTransform2DGetTransform ()
 Compute the current transform applied to the context. More...
 
void AppendTransform (vtkTransform2D *transform)
 Append the transform for the context, the underlying device will use the matrix of the transform. More...
 
void PushMatrix ()
 Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when available). More...
 
void PopMatrix ()
 
void ApplyId (vtkIdType id)
 Apply id as a color. More...
 
virtual vtkContext3DGetContext3D ()
 Get the vtkContext3D device, in order to do some 3D rendering. More...
 
virtual void SetContext3D (vtkContext3D *context)
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
void PrintRevisions (ostream &)
 Legacy. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkContext2DSafeDownCast (vtkObjectBase *o)
 
static vtkContext2DNew ()
 Creates a 2D Painter object. More...
 
static int FloatToInt (float x)
 Float to int conversion, performs truncation but with a rounding tolerance for float values that are within 1/256 of their closest integer. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkContext2D ()
 
 ~vtkContext2D () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkContextDevice2DDevice
 
vtkTransform2DTransform
 
vtkAbstractContextBufferIdBufferId
 
vtkContext3DContext3D
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

Class for drawing 2D primitives to a graphical context.

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 52 of file vtkContext2D.h.

Member Typedef Documentation

◆ Superclass

Definition at line 55 of file vtkContext2D.h.

Constructor & Destructor Documentation

◆ vtkContext2D()

vtkContext2D::vtkContext2D ( )
protected

◆ ~vtkContext2D()

vtkContext2D::~vtkContext2D ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkContext2D::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool 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 vtkObjectBase.

◆ SafeDownCast()

static vtkContext2D* vtkContext2D::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkContext2D::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkContext2D* vtkContext2D::NewInstance ( ) const

◆ PrintSelf()

void vtkContext2D::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ New()

static vtkContext2D* vtkContext2D::New ( )
static

Creates a 2D Painter object.

◆ Begin()

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.

◆ GetDevice()

virtual vtkContextDevice2D* vtkContext2D::GetDevice ( )
virtual

◆ End()

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.

◆ GetBufferIdMode()

bool vtkContext2D::GetBufferIdMode ( ) const

Tell if the context is in BufferId creation mode.

Initial value is false.

◆ BufferIdModeBegin()

void vtkContext2D::BufferIdModeBegin ( vtkAbstractContextBufferId bufferId)

Start BufferId creation Mode.

Precondition
not_yet: !GetBufferIdMode()
bufferId_exists: bufferId!=0
Postcondition
started: GetBufferIdMode()

◆ BufferIdModeEnd()

void vtkContext2D::BufferIdModeEnd ( )

Finalize BufferId creation Mode.

It makes sure that the content of the bufferId passed in argument of BufferIdModeBegin() is correctly set.

Precondition
started: GetBufferIdMode()
Postcondition
done: !GetBufferIdMode()

◆ DrawLine() [1/3]

void vtkContext2D::DrawLine ( float  x1,
float  y1,
float  x2,
float  y2 
)

Draw a line between the specified points.

◆ DrawLine() [2/3]

void vtkContext2D::DrawLine ( float  p[4])

Draw a line between the specified points.

◆ DrawLine() [3/3]

void vtkContext2D::DrawLine ( vtkPoints2D points)

Draw a line between the specified points.

Note: Fastest path - points packed in x and y.

◆ DrawPoly() [1/4]

void vtkContext2D::DrawPoly ( float *  x,
float *  y,
int  n 
)

Draw a poly line between the specified points.

◆ DrawPoly() [2/4]

void vtkContext2D::DrawPoly ( vtkPoints2D points)

Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates.

◆ DrawPoly() [3/4]

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.

◆ DrawPoly() [4/4]

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.

◆ DrawLines() [1/2]

void vtkContext2D::DrawLines ( vtkPoints2D points)

Draw multiple lines between the specified pairs of points.

See also
DrawPoly()

◆ DrawLines() [2/2]

void vtkContext2D::DrawLines ( float *  points,
int  n 
)

Draw multiple lines between the specified pairs of points.

See also
DrawPoly()

◆ DrawPoint()

void vtkContext2D::DrawPoint ( float  x,
float  y 
)

Draw a point at the supplied x and y coordinate.

◆ DrawPoints() [1/3]

void vtkContext2D::DrawPoints ( float *  x,
float *  y,
int  n 
)

Draw the specified number of points using the x and y arrays supplied.

◆ DrawPoints() [2/3]

void vtkContext2D::DrawPoints ( vtkPoints2D points)

Draw a poly line between the specified points - fastest code path due to memory layout of the coordinates.

◆ DrawPoints() [3/3]

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.

◆ DrawPointSprites() [1/4]

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.

◆ DrawPointSprites() [2/4]

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.

◆ DrawPointSprites() [3/4]

void vtkContext2D::DrawPointSprites ( vtkImageData sprite,
float *  points,
int  n,
unsigned char *  colors,
int  nc_comps 
)

◆ DrawPointSprites() [4/4]

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.

◆ DrawMarkers() [1/4]

virtual void vtkContext2D::DrawMarkers ( int  shape,
bool  highlight,
float *  points,
int  n,
unsigned char *  colors,
int  nc_comps 
)
virtual

Draw a series of markers centered at the points supplied.

The shape argument controls the marker shape, and can be one of

  • VTK_MARKER_CROSS
  • VTK_MARKER_PLUS
  • VTK_MARKER_SQUARE
  • VTK_MARKER_CIRCLE
  • VTK_MARKER_DIAMOND Marker size is determined by the current pen width.
    Parameters
    colorsis an optional array of colors.
    nc_compsis the number of components for the color.

◆ DrawMarkers() [2/4]

virtual void vtkContext2D::DrawMarkers ( int  shape,
bool  highlight,
float *  points,
int  n 
)
virtual

◆ DrawMarkers() [3/4]

virtual void vtkContext2D::DrawMarkers ( int  shape,
bool  highlight,
vtkPoints2D points 
)
virtual

◆ DrawMarkers() [4/4]

virtual void vtkContext2D::DrawMarkers ( int  shape,
bool  highlight,
vtkPoints2D points,
vtkUnsignedCharArray colors 
)
virtual

◆ DrawRect()

void vtkContext2D::DrawRect ( float  x,
float  y,
float  w,
float  h 
)

Draw a rectangle with origin at x, y and width w, height h.

◆ DrawQuad() [1/2]

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).

◆ DrawQuad() [2/2]

void vtkContext2D::DrawQuad ( float *  p)

◆ DrawQuadStrip() [1/2]

void vtkContext2D::DrawQuadStrip ( vtkPoints2D points)

Draw a strip of quads.

◆ DrawQuadStrip() [2/2]

void vtkContext2D::DrawQuadStrip ( float *  p,
int  n 
)

◆ DrawPolygon() [1/6]

void vtkContext2D::DrawPolygon ( float *  x,
float *  y,
int  n 
)

Draw a polygon specified specified by the points using the x and y arrays supplied.

◆ DrawPolygon() [2/6]

void vtkContext2D::DrawPolygon ( vtkPoints2D points)

Draw a polygon defined by the specified points - fastest code path due to memory layout of the coordinates.

◆ DrawPolygon() [3/6]

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.

◆ DrawPolygon() [4/6]

void vtkContext2D::DrawPolygon ( float *  x,
float *  y,
int  n,
unsigned char *  color,
int  nc_comps 
)

Draw a polygon specified specified by the points using the x and y arrays supplied.

◆ DrawPolygon() [5/6]

void vtkContext2D::DrawPolygon ( vtkPoints2D points,
unsigned char *  color,
int  nc_comps 
)

Draw a polygon defined by the specified points - fastest code path due to memory layout of the coordinates.

◆ DrawPolygon() [6/6]

void vtkContext2D::DrawPolygon ( float *  points,
int  n,
unsigned char *  color,
int  nc_comps 
)

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.

◆ DrawEllipse()

void vtkContext2D::DrawEllipse ( float  x,
float  y,
float  rx,
float  ry 
)

Draw an ellipse with center at x, y and radii rx, ry.

Precondition
positive_rx: rx>=0
positive_ry: ry>=0

◆ DrawWedge()

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).

Precondition
positive_outRadius: outRadius>=0
positive_inRadius: inRadius>=0
ordered_radii: inRadius<=outRadius

◆ DrawEllipseWedge()

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).

Precondition
positive_outRx: outRx>=0
positive_outRy: outRy>=0
positive_inRx: inRx>=0
positive_inRy: inRy>=0
ordered_rx: inRx<=outRx
ordered_ry: inRy<=outRy

◆ DrawArc()

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).

Precondition
positive_radius: r>=0

◆ DrawEllipticArc()

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).

Precondition
positive_rX: rX>=0
positive_rY: rY>=0

◆ DrawImage() [1/3]

void vtkContext2D::DrawImage ( float  x,
float  y,
vtkImageData image 
)

Draw the supplied image at the given x, y location (bottom corner).

◆ DrawImage() [2/3]

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.

◆ DrawImage() [3/3]

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.

◆ DrawPolyData()

void vtkContext2D::DrawPolyData ( float  x,
float  y,
vtkPolyData polyData,
vtkUnsignedCharArray colors,
int  scalarMode 
)

Draw the supplied polyData at the given x, y position (bottom corner).

Note
Supports only 2D meshes.

◆ DrawStringRect() [1/3]

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.

◆ DrawStringRect() [2/3]

void vtkContext2D::DrawStringRect ( vtkPoints2D rect,
const vtkUnicodeString string 
)

◆ DrawStringRect() [3/3]

void vtkContext2D::DrawStringRect ( vtkPoints2D rect,
const char *  string 
)

◆ DrawString() [1/6]

void vtkContext2D::DrawString ( vtkPoints2D point,
const vtkStdString string 
)

Draw some text to the screen.

◆ DrawString() [2/6]

void vtkContext2D::DrawString ( float  x,
float  y,
const vtkStdString string 
)

◆ DrawString() [3/6]

void vtkContext2D::DrawString ( vtkPoints2D point,
const vtkUnicodeString string 
)

◆ DrawString() [4/6]

void vtkContext2D::DrawString ( float  x,
float  y,
const vtkUnicodeString string 
)

◆ DrawString() [5/6]

void vtkContext2D::DrawString ( vtkPoints2D point,
const char *  string 
)

◆ DrawString() [6/6]

void vtkContext2D::DrawString ( float  x,
float  y,
const char *  string 
)

◆ ComputeStringBounds() [1/6]

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:the text justification from the current text property is NOT considered when computing these bounds.

◆ ComputeStringBounds() [2/6]

void vtkContext2D::ComputeStringBounds ( const vtkStdString string,
float  bounds[4] 
)

◆ ComputeStringBounds() [3/6]

void vtkContext2D::ComputeStringBounds ( const vtkUnicodeString string,
vtkPoints2D bounds 
)

◆ ComputeStringBounds() [4/6]

void vtkContext2D::ComputeStringBounds ( const vtkUnicodeString string,
float  bounds[4] 
)

◆ ComputeStringBounds() [5/6]

void vtkContext2D::ComputeStringBounds ( const char *  string,
vtkPoints2D bounds 
)

◆ ComputeStringBounds() [6/6]

void vtkContext2D::ComputeStringBounds ( const char *  string,
float  bounds[4] 
)

◆ ComputeJustifiedStringBounds()

void vtkContext2D::ComputeJustifiedStringBounds ( const char *  string,
float  bounds[4] 
)

Compute the bounds of the supplied string while taking into account the justification and rotation of the currently applied text property.

◆ ComputeFontSizeForBoundedString()

int vtkContext2D::ComputeFontSizeForBoundedString ( const vtkStdString string,
float  width,
float  height 
)

Calculate the largest possible font size where the supplied string will fit within the specified bounds.

In addition to being returned, this font size is also used to update the vtkTextProperty used by this object. NOTE: text rotation is ignored for the purposes of this function.

◆ DrawMathTextString() [1/8]

void vtkContext2D::DrawMathTextString ( vtkPoints2D point,
const vtkStdString string 
)

Draw a MathText formatted equation to the screen.

See http://matplotlib.sourceforge.net/users/mathtext.html for more information. MathText requires matplotlib and python, and the vtkMatplotlib module must be enabled manually during build configuration. This method will do nothing but print a warning if vtkMathTextUtilities::GetInstance() returns NULL.

◆ DrawMathTextString() [2/8]

void vtkContext2D::DrawMathTextString ( float  x,
float  y,
const vtkStdString string 
)

◆ DrawMathTextString() [3/8]

void vtkContext2D::DrawMathTextString ( vtkPoints2D point,
const char *  string 
)

◆ DrawMathTextString() [4/8]

void vtkContext2D::DrawMathTextString ( float  x,
float  y,
const char *  string 
)

◆ DrawMathTextString() [5/8]

void vtkContext2D::DrawMathTextString ( vtkPoints2D point,
const vtkStdString string,
const vtkStdString fallback 
)

Draw a MathText formatted equation to the screen.

See http://matplotlib.sourceforge.net/users/mathtext.html for more information. MathText requires matplotlib and python, and the vtkMatplotlib module must be enabled manually during build configuration. If MathText is not available on the target device the non-MathText string in "fallback" is rendered using DrawString.

◆ DrawMathTextString() [6/8]

void vtkContext2D::DrawMathTextString ( float  x,
float  y,
const vtkStdString string,
const vtkStdString fallback 
)

◆ DrawMathTextString() [7/8]

void vtkContext2D::DrawMathTextString ( vtkPoints2D point,
const char *  string,
const char *  fallback 
)

◆ DrawMathTextString() [8/8]

void vtkContext2D::DrawMathTextString ( float  x,
float  y,
const char *  string,
const char *  fallback 
)

◆ MathTextIsSupported()

bool vtkContext2D::MathTextIsSupported ( )

Return true if MathText rendering available on the current device.

◆ ApplyPen()

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.

◆ GetPen()

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.

◆ ApplyBrush()

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.

◆ GetBrush()

vtkBrush* vtkContext2D::GetBrush ( )

Get the pen which controls the outlines of shapes as well as lines, points and related primitives.

◆ ApplyTextProp()

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.

◆ GetTextProp()

vtkTextProperty* vtkContext2D::GetTextProp ( )

Get the text properties object for the vtkContext2D.

◆ SetTransform()

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.

◆ GetTransform()

vtkTransform2D* vtkContext2D::GetTransform ( )

Compute the current transform applied to the context.

◆ AppendTransform()

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.

◆ PushMatrix()

void vtkContext2D::PushMatrix ( )

Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when available).

◆ PopMatrix()

void vtkContext2D::PopMatrix ( )

◆ ApplyId()

void vtkContext2D::ApplyId ( vtkIdType  id)

Apply id as a color.

◆ FloatToInt()

int vtkContext2D::FloatToInt ( float  x)
inlinestatic

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 566 of file vtkContext2D.h.

◆ GetContext3D()

virtual vtkContext3D* vtkContext2D::GetContext3D ( )
virtual

Get the vtkContext3D device, in order to do some 3D rendering.

This API is very experimental, and may be moved around.

◆ SetContext3D()

virtual void vtkContext2D::SetContext3D ( vtkContext3D context)
virtual

Member Data Documentation

◆ Device

vtkContextDevice2D* vtkContext2D::Device
protected

Definition at line 539 of file vtkContext2D.h.

◆ Transform

vtkTransform2D* vtkContext2D::Transform
protected

Definition at line 540 of file vtkContext2D.h.

◆ BufferId

vtkAbstractContextBufferId* vtkContext2D::BufferId
protected

Definition at line 542 of file vtkContext2D.h.

◆ Context3D

vtkContext3D* vtkContext2D::Context3D
protected

Definition at line 543 of file vtkContext2D.h.


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