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
DelayAll
Depricated, not implemented in any current paint interface
bool DelayAll { get; set; }
Property Value
DelayText
Depricated, not implemented in any current paint interface
bool DelayText { get; set; }
Property Value
DontRecalcTriangulation
Deprecated, currently not used
bool DontRecalcTriangulation { get; set; }
Property Value
FacesBehindEdgesOffset
Internal use only.
IDisposable FacesBehindEdgesOffset { get; }
Property Value
IsBitmap
bool IsBitmap { get; }
Property Value
PaintEdges
Determins whether curves are included in painting
bool PaintEdges { get; }
Property Value
PaintSurfaceEdges
Determins whether edges of faces should also be painted
bool PaintSurfaceEdges { get; set; }
Property Value
PaintSurfaces
Determins whether surfaces (triangles) are included in painting
bool PaintSurfaces { get; }
Property Value
PixelToWorld
Returns a factor that translates a one pixel distance into world coordinates
double PixelToWorld { get; }
Property Value
Precision
Gets or sets the precision of the display. (used for tesselation or curve approximation)
double Precision { get; set; }
Property Value
SelectColor
Gets or sets the select color
Color SelectColor { get; set; }
Property Value
SelectMode
Gets or sets the flag whether the next objects should be painted in the "select mode"
bool SelectMode { get; set; }
Property Value
TriangulateText
Will text objects be tesselated
bool TriangulateText { get; set; }
Property Value
UseLineWidth
Should the line width be applied to painting curves
bool UseLineWidth { get; set; }
Property Value
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
centerGeoPointThe center of the arc
majorAxisGeoVectorMajor axis, also defines the radius
minorAxisGeoVectorMinor axis, also defines the radius. When painting a circular arc, minorAxis and majorAxis must have the same length
startParameterdoubleRadian value of the starting position (0 is direction of majorAxis)
sweepParameterdoubleRadian for the sweep angle
AvoidColor(Color)
Never use this color for drawing (because it is the background color)
void AvoidColor(Color color)
Parameters
colorColorColor to avoid
Blending(bool)
OpenGL specific, set blending mode
void Blending(bool on)
Parameters
onbool
Clear(Color)
Clear the whole area with this color. Used before painting objects.
void Clear(Color background)
Parameters
backgroundColorColor 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
colorColorColor 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
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
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
FilledPolyline(GeoPoint[])
Deprecated, will not be used from within CADability.
void FilledPolyline(GeoPoint[] points)
Parameters
pointsGeoPoint[]
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
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
List(IPaintTo3DList)
Paint the provided display list.
void List(IPaintTo3DList paintThisList)
Parameters
paintThisListIPaintTo3DListDisplay 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
sublistsList<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
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
namestring
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
paintModePaintTo3D.PaintModePaint faces, curves or both (PaintTo3D.PaintMode)
Point2D(int, int)
Deprecated, currently not used and not implemented
void Point2D(int x, int y)
Parameters
Points(GeoPoint[], float, PointSymbol)
Draws simple pixel based points e.g. for background grid display.
void Points(GeoPoint[] points, float size, PointSymbol pointSymbol)
Parameters
pointsGeoPoint[]sizefloatpointSymbolPointSymbolthe PointSymbol (dot, cross, circle etc.) to draw at each point
Polyline(GeoPoint[])
Draws a sequence of lines.
void Polyline(GeoPoint[] points)
Parameters
pointsGeoPoint[]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
bitmapBitmapThe 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
bitmapBitmapThe bitmap
xoffsetintx-component of the origin that defines the insertion point (e.g. to center the bitmap)
yoffsetinty-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
iconBitmapThe icon
PreparePointSymbol(PointSymbol)
Assure that the point symbol is loaded
void PreparePointSymbol(PointSymbol pointSymbol)
Parameters
pointSymbolPointSymbol
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
fontNamestringName of the font
textStringstringString to be painted
fontStyleFontStyleAdditional 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
insertionModOpNew 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
bitmapBitmapThe bitmap to draw
locationGeoPointLocation of the lower left corner of the bitmap
directionWidthGeoVectorDirection of the lower edge of the bitmap
directionHeightGeoVectorDirection 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
SelectedList(IPaintTo3DList, int)
Paint the provided display list using the display mode.
void SelectedList(IPaintTo3DList paintThisList, int wobbleRadius)
Parameters
paintThisListIPaintTo3DListList to paint
wobbleRadiusintWobble 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
clipRectangleRectangleRectangle 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
colorColorThe color to use for drawing
lockColorint1: 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
patternLinePattern
SetLineWidth(LineWidth)
Sets the line width for subsequent curve drawing
void SetLineWidth(LineWidth lineWidth)
Parameters
lineWidthLineWidthLine 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
projectionProjectionThe projection
boundingCubeBoundingCubeThe 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
lineDirectionGeoVectorDirection of the base line of the text
glyphDirectionGeoVectorDirection of the glyph of the characters (for horizontal text this is the y-axis)
locationGeoPointLocation where to draw the text (using alignement)
fontNamestringName of the font
textStringstringString to draw
fontStyleFontStyleStyle of the font (e.g. bold)
alignmentText.AlignModeLeft, right or center (horizontal) alignement
lineAlignmentText.LineAlignModeVertical 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
vertexGeoPoint[]The coordinates of the vertices
normalsGeoVector[]The coordinates of the normal vectors in the vertices
indextriplesint[]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
usebool