Interface IPaintTo3D
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.
Namespace: CADability
Assembly: CADability.dll
Syntax
public interface IPaintTo3D
Properties
| Improve this Doc View SourceCapabilities
Returns the capabilities of this implementation of the paint interface
Declaration
PaintCapabilities Capabilities { get; }
Property Value
| Type | Description |
|---|---|
| PaintCapabilities |
DelayAll
Depricated, not implemented in any current paint interface
Declaration
bool DelayAll { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DelayText
Depricated, not implemented in any current paint interface
Declaration
bool DelayText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DontRecalcTriangulation
Deprecated, currently not used
Declaration
bool DontRecalcTriangulation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
FacesBehindEdgesOffset
Internal use only.
Declaration
IDisposable FacesBehindEdgesOffset { get; }
Property Value
| Type | Description |
|---|---|
| System.IDisposable |
IsBitmap
Declaration
bool IsBitmap { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PaintEdges
Determins whether curves are included in painting
Declaration
bool PaintEdges { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PaintSurfaceEdges
Determins whether edges of faces should also be painted
Declaration
bool PaintSurfaceEdges { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PaintSurfaces
Determins whether surfaces (triangles) are included in painting
Declaration
bool PaintSurfaces { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PixelToWorld
Returns a factor that translates a one pixel distance into world coordinates
Declaration
double PixelToWorld { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Precision
Gets or sets the precision of the display. (used for tesselation or curve approximation)
Declaration
double Precision { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
SelectColor
Gets or sets the select color
Declaration
Color SelectColor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color |
SelectMode
Gets or sets the flag whether the next objects should be painted in the "select mode"
Declaration
bool SelectMode { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
TriangulateText
Will text objects be tesselated
Declaration
bool TriangulateText { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
UseLineWidth
Should the line width be applied to painting curves
Declaration
bool UseLineWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceArc(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.
Declaration
void Arc(GeoPoint center, GeoVector majorAxis, GeoVector minorAxis, double startParameter, double sweepParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | center | The center of the arc |
| GeoVector | majorAxis | Major axis, also defines the radius |
| GeoVector | minorAxis | Minor axis, also defines the radius. When painting a circular arc, minorAxis and majorAxis must have the same length |
| System.Double | startParameter | Radian value of the starting position (0 is direction of majorAxis) |
| System.Double | sweepParameter | Radian for the sweep angle |
AvoidColor(Color)
Never use this color for drawing (because it is the background color)
Declaration
void AvoidColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color | Color to avoid |
Blending(Boolean)
OpenGL specific, set blending mode
Declaration
void Blending(bool on)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | on |
Clear(Color)
Clear the whole area with this color. Used before painting objects.
Declaration
void Clear(Color background)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | background | 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.
Declaration
void CloseFigure()
CloseList()
Close the display list OpenList().
Declaration
IPaintTo3DList CloseList()
Returns
| Type | Description |
|---|---|
| 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.
Declaration
void ClosePath(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.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, Int32, Int32) has been called or must be called prior to this method.
Declaration
void DisplayBitmap(GeoPoint p, Bitmap bitmap)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Where to Paint |
| System.Drawing.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.
Declaration
void DisplayIcon(GeoPoint p, Bitmap icon)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Where to draw the icon (world coordinates) |
| System.Drawing.Bitmap | icon | The icon to draw |
Dispose()
Will be called when the assoziated control is closed.
Declaration
void Dispose()
FilledPolyline(GeoPoint[])
Deprecated, will not be used from within CADability.
Declaration
void FilledPolyline(GeoPoint[] points)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | points |
FillRect2D(PointF, PointF)
Fill the axis oriented rectangle with the current color. Usually used for background painting.
Declaration
void FillRect2D(PointF p1, PointF p2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.PointF | p1 | Lower left point of the rectangle |
| System.Drawing.PointF | p2 | Upper right point of the rectangle |
FinishPaint()
Call when a frame is finished and the display buffers should now be switched (if using two display buffers)
Declaration
void FinishPaint()
FreeUnusedLists()
Only used internally, no need to call.
Declaration
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.
Declaration
void Line2D(PointF p1, PointF p2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.PointF | p1 | Start point |
| System.Drawing.PointF | p2 | End point |
Line2D(Int32, Int32, Int32, Int32)
Paint a 2D line in the pixel coordinates system of the display. Usually used for background painting.
Declaration
void Line2D(int sx, int sy, int ex, int ey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | sx | Start x-coordinate |
| System.Int32 | sy | Start y-coordinate |
| System.Int32 | ex | End x-coordinate |
| System.Int32 | ey | End y-coordinate |
List(IPaintTo3DList)
Paint the provided display list.
Declaration
void List(IPaintTo3DList paintThisList)
Parameters
| Type | Name | Description |
|---|---|---|
| IPaintTo3DList | paintThisList | Display list to paint |
MakeCurrent()
Will be called before any other paint methods are called. May be called multiple times after
Declaration
void MakeCurrent()
MakeList(List<IPaintTo3DList>)
Makes a new display list as an assembly of the provided lists.
Declaration
IPaintTo3DList MakeList(List<IPaintTo3DList> sublists)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<IPaintTo3DList> | sublists | List to assemble |
Returns
| Type | Description |
|---|---|
| IPaintTo3DList | Created display list |
Nurbs(GeoPoint[], Double[], Double[], Int32)
Deprecated, not used anymore and not implemented by the CADability display drivers.
Declaration
void Nurbs(GeoPoint[] poles, double[] weights, double[] knots, int degree)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | poles | |
| System.Double[] | weights | |
| System.Double[] | knots | |
| System.Int32 | degree |
OpenList()
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[], Single, PointSymbol), Triangle(GeoPoint[], GeoVector[], Int32[]), RectangularBitmap(Bitmap, GeoPoint, GeoVector, GeoVector), Text(GeoVector, GeoVector, GeoPoint, String, String, FontStyle, Text.AlignMode, Text.LineAlignMode), DisplayIcon(GeoPoint, Bitmap), DisplayBitmap(GeoPoint, Bitmap), List(IPaintTo3DList)
Declaration
void OpenList()
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.
Declaration
void OpenPath()
PaintFaces(PaintTo3D.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.
Declaration
void PaintFaces(PaintTo3D.PaintMode paintMode)
Parameters
| Type | Name | Description |
|---|---|---|
| PaintTo3D.PaintMode | paintMode | Paint faces, curves or both (PaintTo3D.PaintMode) |
Point2D(Int32, Int32)
Deprecated, currently not used and not implemented
Declaration
void Point2D(int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | |
| System.Int32 | y |
Points(GeoPoint[], Single, PointSymbol)
Draws simple pixel based points e.g. for background grid display.
Declaration
void Points(GeoPoint[] points, float size, PointSymbol pointSymbol)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | points | |
| System.Single | size | |
| PointSymbol | pointSymbol |
Polyline(GeoPoint[])
Draws a sequence of lines.
Declaration
void Polyline(GeoPoint[] points)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | points | The points to connect |
PopModOp()
Undoes the previously called PushMultModOp(ModOp)
Declaration
void PopModOp()
PopState()
Restores the previously saved state
Declaration
void PopState()
PrepareBitmap(Bitmap)
Similar to PrepareBitmap(Bitmap, Int32, Int32) with origin set to (0,0)
Declaration
void PrepareBitmap(Bitmap bitmap)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | bitmap | The bitmap. |
PrepareBitmap(Bitmap, Int32, Int32)
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)
Declaration
void PrepareBitmap(Bitmap bitmap, int xoffset, int yoffset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | bitmap | The bitmap |
| System.Int32 | xoffset | x-component of the origin that defines the insertion point (e.g. to center the bitmap) |
| System.Int32 | yoffset | 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)
Declaration
void PrepareIcon(Bitmap icon)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | icon | The icon |
PreparePointSymbol(PointSymbol)
Assure that the point symbol is loaded
Declaration
void PreparePointSymbol(PointSymbol pointSymbol)
Parameters
| Type | Name | Description |
|---|---|---|
| PointSymbol | pointSymbol |
PrepareText(String, String, FontStyle)
Assure that the charactres in textString will be available when
Text(GeoVector, GeoVector, GeoPoint, String, String, FontStyle, Text.AlignMode, Text.LineAlignMode) is called.
Declaration
void PrepareText(string fontName, string textString, FontStyle fontStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fontName | Name of the font |
| System.String | textString | String to be painted |
| System.Drawing.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
Declaration
void PushMultModOp(ModOp insertion)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp | insertion | New matrix |
PushState()
Saves the current state.
Declaration
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, Int32, Int32) must be called
before this method is called.
Declaration
void RectangularBitmap(Bitmap bitmap, GeoPoint location, GeoVector directionWidth, GeoVector directionHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | bitmap | The bitmap to draw |
| GeoPoint | location | Location of the lower left corner of the bitmap |
| GeoVector | directionWidth | Direction of the lower edge of the bitmap |
| GeoVector | directionHeight | Direction of the left edge of the bitmap |
Resize(Int32, Int32)
Called when the size of the container associated with this interface changes.
Declaration
void Resize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | width | New width in pixels |
| System.Int32 | height | New height in pixels |
SelectedList(IPaintTo3DList, Int32)
Paint the provided display list using the display mode.
Declaration
void SelectedList(IPaintTo3DList paintThisList, int wobbleRadius)
Parameters
| Type | Name | Description |
|---|---|---|
| IPaintTo3DList | paintThisList | List to paint |
| System.Int32 | wobbleRadius | 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.
Declaration
void SetClip(Rectangle clipRectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Rectangle | clipRectangle | Rectangle to use for clipping |
SetColor(Color)
Sets the color for the next paint methods
Declaration
void SetColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color | The color to use for drawing |
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.
Declaration
void SetLinePattern(LinePattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| LinePattern | pattern |
SetLineWidth(LineWidth)
Sets the line width for subsequent curve drawing
Declaration
void SetLineWidth(LineWidth lineWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| LineWidth | lineWidth | Line width in world coordinates |
SetProjection(Projection, BoundingCube)
Sets the projection to use in subsequent calls to paint methods.
Declaration
void SetProjection(Projection projection, BoundingCube boundingCube)
Parameters
| Type | Name | Description |
|---|---|---|
| Projection | projection | The projection |
| BoundingCube | boundingCube | The bounding cube, may be used for clipping |
Text(GeoVector, GeoVector, GeoPoint, String, String, FontStyle, Text.AlignMode, Text.LineAlignMode)
Draw a text with the provided parameters and the current color.
Declaration
void Text(GeoVector lineDirection, GeoVector glyphDirection, GeoPoint location, string fontName, string textString, FontStyle fontStyle, Text.AlignMode alignment, Text.LineAlignMode lineAlignment)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | lineDirection | Direction of the base line of the text |
| GeoVector | glyphDirection | Direction of the glyph of the characters (for horizontal text this is the y-axis) |
| GeoPoint | location | Location where to draw the text (using alignement) |
| System.String | fontName | Name of the font |
| System.String | textString | String to draw |
| System.Drawing.FontStyle | fontStyle | Style of the font (e.g. bold) |
| Text.AlignMode | alignment | Left, right or center (horizontal) alignement |
| Text.LineAlignMode | lineAlignment | Vertical alignement |
Triangle(GeoPoint[], GeoVector[], Int32[])
Draw a set of solid-filled triangles with the current color.
Declaration
void Triangle(GeoPoint[] vertex, GeoVector[] normals, int[] indextriples)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | vertex | The coordinates of the vertices |
| GeoVector[] | normals | The coordinates of the normal vectors in the vertices |
| System.Int32[] | indextriples | Triples of indices which define traingles. Length must be a multiple of 3 |
UseZBuffer(Boolean)
Usually set to true, switch off to paint coordinate axis etc.
Declaration
void UseZBuffer(bool use)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | use |