SkiaGeoCanvas¶
Namespace: ThinkGeo.Core
Represents the SkiaGeoCanvas class.
public class SkiaGeoCanvas : GeoCanvas
Inheritance object → GeoCanvas → SkiaGeoCanvas
Properties¶
SupportKeyColor¶
Gets or sets the SupportKeyColor.
public bool SupportKeyColor { get; }
Property Value¶
FontDisplayDensity¶
Returns the ScaleFactor so that text wrap width is compared in the same physical-pixel units that SkiaGraphics.MeasureString uses (which multiplies font size by ScaleFactor).
public double FontDisplayDensity { get; }
Property Value¶
DrawingQuality¶
Gets or sets the rendering-quality preset for Skia-based drawing.
public DrawingQuality DrawingQuality { get; set; }
Property Value¶
Remarks:
Setting this property applies the matching preset returned by RenderingOptions.FromDrawingQuality(DrawingQuality) and replaces the current SkiaGeoCanvas.RenderingOptions value. Use this property when one of the built-in quality presets is sufficient. For finer control, set SkiaGeoCanvas.RenderingOptions directly instead.
RenderingOptions¶
Gets or sets all Skia rendering options.
public RenderingOptions RenderingOptions { get; set; }
Property Value¶
AntiAlias¶
Gets or sets antialiasing for image, vector, and text rendering.
public bool AntiAlias { get; set; }
Property Value¶
CurrentScale¶
This property gets the current scale of the view.
public double CurrentScale { get; }
Property Value¶
Exceptions¶
InvalidOperationException
In the event you attempt to call this property when the GeoCanvas' IsDrawing mode is false, it will throw an InvalidOperationException.
MapUnit¶
This property returns the MapUnit passed in on the BeginDrawingAPI in the GeoCanvas.
public GeographyUnit MapUnit { get; }
Property Value¶
Width¶
This property gets the width of the view.
public float Width { get; protected set; }
Property Value¶
Exceptions¶
InvalidOperationException
In the event you attempt to call this method when the GeoCanvas' IsDrawing mode is false, it will throw an InvalidOperationException.
Remarks:
This property reflects the width of the view image that was passed in on BeginDrawing.
Height¶
This property gets the height of the view.
public float Height { get; protected set; }
Property Value¶
Exceptions¶
InvalidOperationException
In the event you attempt to call this method when the GeoCanvas' IsDrawing mode is false, it will throw an InvalidOperationException.
Remarks:
This property reflects the height of the view image that was passed in on BeginDrawing.
CurrentWorldExtent¶
This property gets the adjusted current extent based on what was set when BeginDrawing was called.
public RectangleShape CurrentWorldExtent { get; protected set; }
Property Value¶
Exceptions¶
InvalidOperationException
In the event you attempt to call this method when the GeoCanvas' IsDrawing mode is false, it will throw an InvalidOperationException.
Remarks:
The extent that gets passed in on BeginDrawing is adjusted for the height and width of the physical media being drawn on. For example if the current extent is wider than taller but the bitmap being drawn on is square then the current extent needs to be adjusted. The extent will be adjusted larger so that we ensure that the entire original extent will still be represented.
KeyColors¶
Gets a value represents a collection of key colors. If SupportKeyColor property is false, it will throw exception when you use KeyColors.
public Collection<GeoColor> KeyColors { get; }
Property Value¶
Remarks:
It will make these colors transparent when draw image.
NativeImage¶
The same reference to the parameter 'NativeImage' in BeginDrawing function.
public object NativeImage { get; }
Property Value¶
IsDrawing¶
This property gets the drawing status of the GeoCanvas.
public bool IsDrawing { get; protected set; }
Property Value¶
Remarks:
This property is set to true when the BeginDrawing method is called, and false after the EndDrawing method is called.
Dpi¶
The DPI value for the final drawing result, only valid when HasDpi set to true.
public float Dpi { get; set; }
Property Value¶
ScaleFactor¶
Gets or sets the scale factor, this is a value number of device pixels per logical coordinate point.
public float ScaleFactor { get; set; }
Property Value¶
The scale factory value.
Remarks:
The coordinate space used by application developers is measured in logical points. High-resolution (Retina) displays will have more than a single physical pixel per logical point and this property specifies the scale factor.
CancellationToken¶
Gets or sets the cancellation token source.
public CancellationToken CancellationToken { get; set; }
Property Value¶
The cancellation token source.
ClippingArea¶
It's a property only used in printing related Canvas such as PdfGeoCanvas and PrinterGeoCanvas
public RectangleShape ClippingArea { get; set; }
Property Value¶
Constructors¶
SkiaGeoCanvas()¶
Initializes a new instance of the SkiaGeoCanvas class.
public SkiaGeoCanvas()
Methods¶
BeginDrawingCore(object, RectangleShape, GeographyUnit)¶
Provides the overridable implementation that begins a drawing session for the specified native image and configures the canvas for the provided world extent and map unit.
protected void BeginDrawingCore(object nativeImage, RectangleShape worldExtent, GeographyUnit drawingMapUnit)
Parameters¶
nativeImage object
The native image that the canvas draws into.
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
drawingMapUnit GeographyUnit
The map unit used for the drawing session.
Returns¶
DrawArcCore(GeoPen, float, float, float, float, float, float, DrawingLevel)¶
Provides the overridable implementation that draws an arc defined by a bounding rectangle and angle range using the specified pen.
protected void DrawArcCore(GeoPen pen, float x, float y, float width, float height, float startAngle, float sweepAngle, DrawingLevel drawingLevel)
Parameters¶
pen GeoPen
The pen used to draw outlines and strokes.
x float
The x-coordinate, in pixels.
y float
The y-coordinate, in pixels.
width float
The width, in pixels.
height float
The height, in pixels.
startAngle float
The starting angle, in degrees.
sweepAngle float
The sweep angle, in degrees.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
Returns¶
DrawAreaCore(IEnumerable<ScreenPointF[]>, GeoPen, GeoBrush, DrawingLevel, float, float, PenBrushDrawingOrder)¶
Provides the overridable implementation that draws filled polygon areas defined by using the specified outline and fill styles.
protected void DrawAreaCore(IEnumerable<ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
Parameters¶
screenPoints IEnumerable<ScreenPointF[]>
The screen points, in pixels, that define the geometry to draw.
outlinePen GeoPen
The pen used to draw outlines and strokes.
fillBrush GeoBrush
The brush used to fill interiors.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
xOffset float
The horizontal offset, in pixels, applied when drawing.
yOffset float
The vertical offset, in pixels, applied when drawing.
penBrushDrawingOrder PenBrushDrawingOrder
The order in which the outline (pen) and fill (brush) are drawn.
Returns¶
DrawEllipseCore(ScreenPointF, float, float, GeoPen, GeoBrush, DrawingLevel, float, float, PenBrushDrawingOrder)¶
Provides the overridable implementation that draws an ellipse centered at using the specified outline and fill styles.
protected void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
Parameters¶
screenPoint ScreenPointF
The screen point, in pixels.
width float
The width, in pixels.
height float
The height, in pixels.
outlinePen GeoPen
The pen used to draw outlines and strokes.
fillBrush GeoBrush
The brush used to fill interiors.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
xOffset float
The horizontal offset, in pixels, applied when drawing.
yOffset float
The vertical offset, in pixels, applied when drawing.
penBrushDrawingOrder PenBrushDrawingOrder
The order in which the outline (pen) and fill (brush) are drawn.
Returns¶
DrawLineCore(IEnumerable<ScreenPointF>, GeoPen, DrawingLevel, float, float)¶
Provides the overridable implementation that draws a line or polyline through using the specified pen.
protected void DrawLineCore(IEnumerable<ScreenPointF> screenPoints, GeoPen linePen, DrawingLevel drawingLevel, float xOffset, float yOffset)
Parameters¶
screenPoints IEnumerable<ScreenPointF>
The screen points, in pixels, that define the geometry to draw.
linePen GeoPen
The pen used to draw outlines and strokes.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
xOffset float
The horizontal offset, in pixels, applied when drawing.
yOffset float
The vertical offset, in pixels, applied when drawing.
Returns¶
DrawScreenImageCore(GeoImage, float, float, float, float, DrawingLevel, float, float, float, RasterResamplingMode)¶
Provides the overridable implementation that draws at the specified screen location, applying size, offset, and rotation as needed.
protected void DrawScreenImageCore(GeoImage image, float centerXInScreen, float centerYInScreen, float widthInScreen, float heightInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle, RasterResamplingMode resamplingMode)
Parameters¶
image GeoImage
The image instance to operate on.
centerXInScreen float
The x-coordinate of the image center in screen pixels.
centerYInScreen float
The y-coordinate of the image center in screen pixels.
widthInScreen float
The width, in screen pixels.
heightInScreen float
The height, in screen pixels.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
xOffset float
The horizontal offset, in pixels, applied when drawing.
yOffset float
The vertical offset, in pixels, applied when drawing.
rotateAngle float
The rotation angle, in degrees.
resamplingMode RasterResamplingMode
Returns¶
DrawScreenImageWithoutScalingCore(GeoImage, float, float, DrawingLevel, float, float, float, RasterResamplingMode)¶
Provides the overridable implementation that draws at the specified screen location without scaling, applying offset and rotation as needed.
protected void DrawScreenImageWithoutScalingCore(GeoImage image, float centerXInScreen, float centerYInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle, RasterResamplingMode resamplingMode)
Parameters¶
image GeoImage
The image instance to operate on.
centerXInScreen float
The x-coordinate of the image center in screen pixels.
centerYInScreen float
The y-coordinate of the image center in screen pixels.
drawingLevel DrawingLevel
The drawing level used for compositing and buffering.
xOffset float
The horizontal offset, in pixels, applied when drawing.
yOffset float
The vertical offset, in pixels, applied when drawing.
rotateAngle float
The rotation angle, in degrees.
resamplingMode RasterResamplingMode
Returns¶
OnCreatingSKTypefacesForText(CreatingSKTypefacesForTextEventArgs)¶
Performs on creating SK typefaces for text.
protected void OnCreatingSKTypefacesForText(CreatingSKTypefacesForTextEventArgs e)
Parameters¶
e CreatingSKTypefacesForTextEventArgs
The e.
Returns¶
OnCreatingSKTypefaceForCharacter(CreatingSKTypefaceForCharacterEventArgs)¶
Raise the CreatingSKTypefaceForCharacter event.
protected void OnCreatingSKTypefaceForCharacter(CreatingSKTypefaceForCharacterEventArgs e)
Parameters¶
e CreatingSKTypefaceForCharacterEventArgs
Returns¶
DrawTextCore(string, GeoFont, GeoBrush, GeoPen, IEnumerable<ScreenPointF>, DrawingLevel, float, float, DrawingTextAlignment, float)¶
Renders text using SkiaSharp, honoring fallbacks and per-glyph typeface resolution.
protected void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable<ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, DrawingTextAlignment drawingTextAlignment, float rotateAngle)
Parameters¶
text string
The text to draw.
font GeoFont
The font that defines size, family, and style.
fillBrush GeoBrush
Brush used to fill the glyphs.
haloPen GeoPen
Optional pen used to outline the text.
textPathInScreen IEnumerable<ScreenPointF>
Screen coordinates that define where the text is placed.
drawingLevel DrawingLevel
Drawing level to render on.
xOffset float
Horizontal pixel offset applied to the text.
yOffset float
Vertical pixel offset applied to the text.
drawingTextAlignment DrawingTextAlignment
Alignment of the text relative to the path.
rotateAngle float
Rotation angle, in degrees, applied to the text.
Returns¶
EndDrawingCore()¶
Provides the overridable implementation that ends the current drawing session, flushing any buffered drawing operations and releasing drawing resources.
protected void EndDrawingCore()
Returns¶
FlushCore()¶
Provides the overridable implementation that flushes any buffered operations to the underlying destination.
protected void FlushCore()
Returns¶
GetCanvasHeightCore()¶
This returns the physical height (instead of virtual height) of the canvas, it equals virtual height multiply scale factor
protected float GetCanvasHeightCore()
Returns¶
GetCanvasWidthCore()¶
This returns the physical width (instead of virtual width) of the canvas, it equals virtual width multiply scale factor
protected float GetCanvasWidthCore()
Returns¶
MeasureTextCore(string, GeoFont)¶
Provides the overridable implementation that measures text.
protected DrawingRectangleF MeasureTextCore(string text, GeoFont font)
Parameters¶
text string
The text.
font GeoFont
The font.
Returns¶
DrawingRectangleF
The result of the operation.
RhU=(GeoFont, DrawingTextBaseline, string)¶
internal float RhU=(GeoFont font, DrawingTextBaseline textBaseline, string text)
Parameters¶
font GeoFont
textBaseline DrawingTextBaseline
text string
Returns¶
lhU=(GeoImage, int, int, int, int, 7RU=[], DrawingLevel)¶
internal void lhU=(GeoImage image, int srcX, int srcY, int srcWidth, int srcHeight, 7RU=[] colors, DrawingLevel drawingLevel)
Parameters¶
image GeoImage
srcX int
srcY int
srcWidth int
srcHeight int
colors 7RU=[]
drawingLevel DrawingLevel
Returns¶
lxU=(ScreenPointF, int, Single[], GeoColor[], DrawingLevel)¶
internal void lxU=(ScreenPointF centerPoint, int radius, Single[] positions, GeoColor[] colors, DrawingLevel drawingLevel)
Parameters¶
centerPoint ScreenPointF
radius int
positions Single[]
colors GeoColor[]
drawingLevel DrawingLevel
Returns¶
mBU=(char, GeoFont)¶
internal SKTypeface mBU=(char ch, GeoFont geoFont)
Parameters¶
ch char
geoFont GeoFont
Returns¶
SKTypeface
Events¶
CreatingSKTypefacesForText¶
Occurs when the CreatingSKTypefacesForText event is raised.
public event EventHandler<CreatingSKTypefacesForTextEventArgs> CreatingSKTypefacesForText;
CreatingSKTypefaceForCharacter¶
Occurs when the CreatingSKTypefaceForCharacter event is raised.
public event EventHandler<CreatingSKTypefaceForCharacterEventArgs> CreatingSKTypefaceForCharacter;
DrawingProgressChanged¶
Occurs when [drawing progress changed].
public event EventHandler<DrawingProgressChangedEventArgs> DrawingProgressChanged;