Table of Contents

Interface IPaintTo3D

Namespace
CADability
Assembly
CADability.dll

Interface to paint on a OpenGL, DirectX, GDI or some other output device. This interface may still change in future it is provided for informational purposes only.

public interface IPaintTo3D

Properties

Capabilities

Returns the capabilities of this implementation of the paint interface

PaintCapabilities Capabilities { get; }

Property Value

PaintCapabilities

DelayAll

Depricated, not implemented in any current paint interface

bool DelayAll { get; set; }

Property Value

bool

DelayText

Depricated, not implemented in any current paint interface

bool DelayText { get; set; }

Property Value

bool

DontRecalcTriangulation

Deprecated, currently not used

bool DontRecalcTriangulation { get; set; }

Property Value

bool

FacesBehindEdgesOffset

Internal use only.

IDisposable FacesBehindEdgesOffset { get; }

Property Value

IDisposable

IsBitmap

bool IsBitmap { get; }

Property Value

bool

PaintEdges

Determins whether curves are included in painting

bool PaintEdges { get; }

Property Value

bool

PaintSurfaceEdges

Determins whether edges of faces should also be painted

bool PaintSurfaceEdges { get; set; }

Property Value

bool

PaintSurfaces

Determins whether surfaces (triangles) are included in painting

bool PaintSurfaces { get; }

Property Value

bool

PixelToWorld

Returns a factor that translates a one pixel distance into world coordinates

double PixelToWorld { get; }

Property Value

double

Precision

Gets or sets the precision of the display. (used for tesselation or curve approximation)

double Precision { get; set; }

Property Value

double

SelectColor

Gets or sets the select color

Color SelectColor { get; set; }

Property Value

Color

SelectMode

Gets or sets the flag whether the next objects should be painted in the "select mode"

bool SelectMode { get; set; }

Property Value

bool

TriangulateText

Will text objects be tesselated

bool TriangulateText { get; set; }

Property Value

bool

UseLineWidth

Should the line width be applied to painting curves

bool UseLineWidth { get; set; }

Property Value

bool

Methods

Arc(GeoPoint, GeoVector, GeoVector, double, double)

Draws an (elliptical) arc according to the provided parameters. May only be used when the implementation supports arcs (see CanDoArcs.

void Arc(GeoPoint center, GeoVector majorAxis, GeoVector minorAxis, double startParameter, double sweepParameter)

Parameters

center GeoPoint

The center of the arc

majorAxis GeoVector

Major axis, also defines the radius

minorAxis GeoVector

Minor axis, also defines the radius. When painting a circular arc, minorAxis and majorAxis must have the same length

startParameter double

Radian value of the starting position (0 is direction of majorAxis)

sweepParameter double

Radian for the sweep angle

AvoidColor(Color)

Never use this color for drawing (because it is the background color)

void AvoidColor(Color color)

Parameters

color Color

Color to avoid

Blending(bool)

OpenGL specific, set blending mode

void Blending(bool on)

Parameters

on bool

Clear(Color)

Clear the whole area with this color. Used before painting objects.

void Clear(Color background)

Parameters

background Color

Color to clear display with

CloseFigure()

Closes a subfigure while defining a path. Subfigures are the enclosing path and the holes to be spared. Only valid after OpenPath() and before ClosePath(Color) have been called.

void CloseFigure()

CloseList()

Close the display list OpenList(string).

IPaintTo3DList CloseList()

Returns

IPaintTo3DList

An object resembling the display list

ClosePath(Color)

Closes the path which was started with OpenPath() and fills the interior with the provided color.

void ClosePath(Color color)

Parameters

color Color

Color to fill the path with.

DisplayBitmap(GeoPoint, Bitmap)

Displays the provided bitmap at the provided location. The bitmap always faces the viewer. PrepareBitmap(Bitmap, int, int) has been called or must be called prior to this method.

void DisplayBitmap(GeoPoint p, Bitmap bitmap)

Parameters

p GeoPoint

Where to Paint

bitmap Bitmap

Th ebitmap to paint

DisplayIcon(GeoPoint, Bitmap)

Displays the provided icon at the provided position. PrepareIcon(Bitmap) has been called or must be called before this method is called. The icon aleasy faces the viewer, no perspective of the projection is applied.

void DisplayIcon(GeoPoint p, Bitmap icon)

Parameters

p GeoPoint

Where to draw the icon (world coordinates)

icon Bitmap

The icon to draw

Dispose()

Will be called when the assoziated control is closed.

void Dispose()

FillRect2D(PointF, PointF)

Fill the axis oriented rectangle with the current color. Usually used for background painting.

void FillRect2D(PointF p1, PointF p2)

Parameters

p1 PointF

Lower left point of the rectangle

p2 PointF

Upper right point of the rectangle

FilledPolyline(GeoPoint[])

Deprecated, will not be used from within CADability.

void FilledPolyline(GeoPoint[] points)

Parameters

points GeoPoint[]

FinishPaint()

Call when a frame is finished and the display buffers should now be switched (if using two display buffers)

void FinishPaint()

FreeUnusedLists()

Only used internally, no need to call.

void FreeUnusedLists()

Line2D(PointF, PointF)

Paint a 2D line in the pixel coordinates system of the display. Usually used for background painting. Currently not used.

void Line2D(PointF p1, PointF p2)

Parameters

p1 PointF

Start point

p2 PointF

End point

Line2D(int, int, int, int)

Paint a 2D line in the pixel coordinates system of the display. Usually used for background painting.

void Line2D(int sx, int sy, int ex, int ey)

Parameters

sx int

Start x-coordinate

sy int

Start y-coordinate

ex int

End x-coordinate

ey int

End y-coordinate

List(IPaintTo3DList)

Paint the provided display list.

void List(IPaintTo3DList paintThisList)

Parameters

paintThisList IPaintTo3DList

Display list to paint

MakeCurrent()

Will be called before any other paint methods are called. May be called multiple times after the implementation has been initialized (its Init method has been called)

void MakeCurrent()

MakeList(List<IPaintTo3DList>)

Makes a new display list as an assembly of the provided lists.

IPaintTo3DList MakeList(List<IPaintTo3DList> sublists)

Parameters

sublists List<IPaintTo3DList>

List to assemble

Returns

IPaintTo3DList

Created display list

Nurbs(GeoPoint[], double[], double[], int)

Deprecated, not used anymore and not implemented by the CADability display drivers.

void Nurbs(GeoPoint[] poles, double[] weights, double[] knots, int degree)

Parameters

poles GeoPoint[]
weights double[]
knots double[]
degree int

OpenList(string)

Opens a new display list. All subsequent calls to paint methods will be stred in the list. When CloseList() will be called the object resembling the list will be returned. Only the following method calls are allowed while a displaylist is open: Polyline(GeoPoint[]), FilledPolyline(GeoPoint[]), Points(GeoPoint[], float, PointSymbol), Triangle(GeoPoint[], GeoVector[], int[]), RectangularBitmap(Bitmap, GeoPoint, GeoVector, GeoVector), Text(GeoVector, GeoVector, GeoPoint, string, string, FontStyle, AlignMode, LineAlignMode), DisplayIcon(GeoPoint, Bitmap), DisplayBitmap(GeoPoint, Bitmap), List(IPaintTo3DList)

void OpenList(string name = null)

Parameters

name string

OpenPath()

When the implementation supports Paths (see CanFillPaths), this call will start recording calls to Polyline(GeoPoint[]) and Arc(GeoPoint, GeoVector, GeoVector, double, double) until ClosePath(Color) is called.

void OpenPath()

PaintFaces(PaintMode)

Faces are painted with a small offset to the backgroung, wheras curves are painted with a small offset to the front. This ensures proper visibility of edges that lie on faces.

void PaintFaces(PaintTo3D.PaintMode paintMode)

Parameters

paintMode PaintTo3D.PaintMode

Paint faces, curves or both (PaintTo3D.PaintMode)

Point2D(int, int)

Deprecated, currently not used and not implemented

void Point2D(int x, int y)

Parameters

x int
y int

Points(GeoPoint[], float, PointSymbol)

Draws simple pixel based points e.g. for background grid display.

void Points(GeoPoint[] points, float size, PointSymbol pointSymbol)

Parameters

points GeoPoint[]
size float
pointSymbol PointSymbol

the PointSymbol (dot, cross, circle etc.) to draw at each point

Polyline(GeoPoint[])

Draws a sequence of lines.

void Polyline(GeoPoint[] points)

Parameters

points GeoPoint[]

The points to connect

PopModOp()

Undoes the previously called PushMultModOp(ModOp)

void PopModOp()

PopState()

Restores the previously saved state

void PopState()

PrepareBitmap(Bitmap)

Similar to PrepareBitmap(Bitmap, int, int) with origin set to (0,0)

void PrepareBitmap(Bitmap bitmap)

Parameters

bitmap Bitmap

The bitmap.

PrepareBitmap(Bitmap, int, int)

Assure that the bitmap will be available when DisplayIcon(GeoPoint, Bitmap) will subsequently be called. (Some implementations cache the bitmap or transform it into an convenient format)

void PrepareBitmap(Bitmap bitmap, int xoffset, int yoffset)

Parameters

bitmap Bitmap

The bitmap

xoffset int

x-component of the origin that defines the insertion point (e.g. to center the bitmap)

yoffset int

y-component of the origin

PrepareIcon(Bitmap)

Assure that the icon will be available when DisplayIcon(GeoPoint, Bitmap) will subsequently be called. (Some implementations cache the icon or transform it into an convenient format)

void PrepareIcon(Bitmap icon)

Parameters

icon Bitmap

The icon

PreparePointSymbol(PointSymbol)

Assure that the point symbol is loaded

void PreparePointSymbol(PointSymbol pointSymbol)

Parameters

pointSymbol PointSymbol

PrepareText(string, string, FontStyle)

Assure that the charactres in textString will be available when Text(GeoVector, GeoVector, GeoPoint, string, string, FontStyle, AlignMode, LineAlignMode) is called.

void PrepareText(string fontName, string textString, FontStyle fontStyle)

Parameters

fontName string

Name of the font

textString string

String to be painted

fontStyle FontStyle

Additional font style (bold, italic, etc.)

PushMultModOp(ModOp)

Sets a matrix to multiply all objects beeing displayed with. This matrix will be applied additionally to the current matrix

void PushMultModOp(ModOp insertion)

Parameters

insertion ModOp

New matrix

PushState()

Saves the current state.

void PushState()

RectangularBitmap(Bitmap, GeoPoint, GeoVector, GeoVector)

Draws a rectangular bitmap at the provided location with directionWidth specifying the direction of the lower edge of the bitmap and directionHeight specifying the direction of the left edge of the bitmap. PrepareBitmap(Bitmap, int, int) must be called before this method is called.

void RectangularBitmap(Bitmap bitmap, GeoPoint location, GeoVector directionWidth, GeoVector directionHeight)

Parameters

bitmap Bitmap

The bitmap to draw

location GeoPoint

Location of the lower left corner of the bitmap

directionWidth GeoVector

Direction of the lower edge of the bitmap

directionHeight GeoVector

Direction of the left edge of the bitmap

Resize(int, int)

Called when the size of the container associated with this interface changes.

void Resize(int width, int height)

Parameters

width int

New width in pixels

height int

New height in pixels

SelectedList(IPaintTo3DList, int)

Paint the provided display list using the display mode.

void SelectedList(IPaintTo3DList paintThisList, int wobbleRadius)

Parameters

paintThisList IPaintTo3DList

List to paint

wobbleRadius int

Wobble radius to paint the same list multiple times with small offsets

SetClip(Rectangle)

Sets a clip rectangle for subsequent paint commands. If clipRectangle is empty, no clipping will occur.

void SetClip(Rectangle clipRectangle)

Parameters

clipRectangle Rectangle

Rectangle to use for clipping

SetColor(Color, int)

Sets the color for the next paint methods, if lockColor == 1: the color is kept unchanged until lockColor==-1 is called, lockColor==0: normal color setting

void SetColor(Color color, int lockColor = 0)

Parameters

color Color

The color to use for drawing

lockColor int

1: lock the color, it is kept until SetColor is called with -1; -1: unlock the color; 0: normal color setting

SetLinePattern(LinePattern)

Sets the line pattern for subsequent curve drawing. A pattern consists of pairs of double values: stroke length followed by gap length. If the parameter is null or an empty array, solidlines or curves will be drawn.

void SetLinePattern(LinePattern pattern)

Parameters

pattern LinePattern

SetLineWidth(LineWidth)

Sets the line width for subsequent curve drawing

void SetLineWidth(LineWidth lineWidth)

Parameters

lineWidth LineWidth

Line width in world coordinates

SetProjection(Projection, BoundingCube)

Sets the projection to use in subsequent calls to paint methods.

void SetProjection(Projection projection, BoundingCube boundingCube)

Parameters

projection Projection

The projection

boundingCube BoundingCube

The bounding cube, may be used for clipping

Text(GeoVector, GeoVector, GeoPoint, string, string, FontStyle, AlignMode, LineAlignMode)

Draw a text with the provided parameters and the current color.

void Text(GeoVector lineDirection, GeoVector glyphDirection, GeoPoint location, string fontName, string textString, FontStyle fontStyle, Text.AlignMode alignment, Text.LineAlignMode lineAlignment)

Parameters

lineDirection GeoVector

Direction of the base line of the text

glyphDirection GeoVector

Direction of the glyph of the characters (for horizontal text this is the y-axis)

location GeoPoint

Location where to draw the text (using alignement)

fontName string

Name of the font

textString string

String to draw

fontStyle FontStyle

Style of the font (e.g. bold)

alignment Text.AlignMode

Left, right or center (horizontal) alignement

lineAlignment Text.LineAlignMode

Vertical alignement

Triangle(GeoPoint[], GeoVector[], int[])

Draw a set of solid-filled triangles with the current color.

void Triangle(GeoPoint[] vertex, GeoVector[] normals, int[] indextriples)

Parameters

vertex GeoPoint[]

The coordinates of the vertices

normals GeoVector[]

The coordinates of the normal vectors in the vertices

indextriples int[]

Triples of indices which define traingles. Length must be a multiple of 3

UseZBuffer(bool)

Usually set to true, switch off to paint coordinate axis etc.

void UseZBuffer(bool use)

Parameters

use bool