VectSharp
2.2.1
A light library for C# vector graphics
|
Represents a multi-threaded, triple-buffered canvas on which the image is drawn using SkiaSharp. More...
Public Member Functions | |
SKMultiLayerRenderCanvas (Document document, Colour backgroundColour, double width, double height, List< SKRenderAction > layerTransforms=null) | |
Create a new SKMultiLayerRenderCanvas from a Document, where each page represents a layer. More... | |
SKMultiLayerRenderCanvas (IEnumerable< Page > layers, Colour backgroundColour, double width, double height, List< SKRenderAction > layerTransforms=null) | |
Create a new SKMultiLayerRenderCanvas from a collection of Pages, each representing a layer. More... | |
SKMultiLayerRenderCanvas (List< SKRenderContext > contents, List< SKRenderAction > contentTransforms, Colour backgroundColour, double width, double height) | |
Create a new SKMultiLayerRenderCanvas from a list of SKRenderContexts, each representing a layer. More... | |
void | UpdateWith (List< SKRenderContext > contents, List< SKRenderAction > contentTransforms, Colour backgroundColour, double width, double height) |
Replace the contents of the SKMultiLayerRenderCanvas with the specified layers. More... | |
void | UpdateLayer (int layer, SKRenderContext newContent, SKRenderAction newTransform) |
Replace a single layer with the specified content. More... | |
void | AddLayer (SKRenderContext newContent, SKRenderAction newTransform) |
Add a new layer to the image. More... | |
void | InsertLayer (int index, SKRenderContext newContent, SKRenderAction newTransform) |
Insert a new layer at the specified index. More... | |
void | RemoveLayer (int layer) |
Remove the specified layer from the image. More... | |
void | SwitchLayers (int layer1, int layer2) |
Switch the position of the two specified layers. More... | |
void | MoveLayer (int oldIndex, int newIndex) |
Move the specified layer to the specified position, shifting all other layers as necessary. More... | |
RenderTargetBitmap | RenderAtResolution (int width, int height, SKColor? background=null) |
Render the image at to a bitmap at the specified resolution. More... | |
void | InvalidateDirty () |
Invalidate the contents of the canvas, forcing it to redraw itself. More... | |
void | InvalidateZIndex () |
Invalidate the contents of the canvas, specifying that the order of the layers has changed. More... | |
override void | Render (DrawingContext context) |
void | Dispose () |
Public Attributes | |
List< List< SKRenderAction > > | RenderActions |
The list of render actions, each element in this list is itself a list, containing the actions that correspond to a layer in the image. More... | |
List< SKRenderAction > | LayerTransforms |
The list of transforms associated with each layer. More... | |
object | RenderLock = new object() |
An lock for the rendering loop. The public methods of this class already lock on this, but you may need it if you want to directly manipulate the contents of the canvas. More... | |
Properties | |
double | PageWidth [get, set] |
The width of the page that is rendered on this canvas. More... | |
double | PageHeight [get, set] |
The height of the page that is rendered on this canvas. More... | |
Func< long, Bitmap > | Spinner = null [get, set] |
If the image to draw is not already cached, this method is called with an argument containing the number of milliseconds since the image was last rendered. The method can return a Bitmap that will be drawn on the canvas in order to let users know that the image is being rendered in background. More... | |
Represents a multi-threaded, triple-buffered canvas on which the image is drawn using SkiaSharp.
Definition at line 43 of file SKMultiLayerRenderCanvas.cs.
VectSharp.Canvas.SKMultiLayerRenderCanvas.SKMultiLayerRenderCanvas | ( | Document | document, |
Colour | backgroundColour, | ||
double | width, | ||
double | height, | ||
List< SKRenderAction > | layerTransforms = null |
||
) |
Create a new SKMultiLayerRenderCanvas from a Document, where each page represents a layer.
document | The document containing the layers as Pages. |
layerTransforms | A list of transforms associated with each layer. This list should contain the same number of elements as the number of pages in document . This is useful to manipulate the position of each layer individually. If this is null, an identity transform is applied to each layer. |
backgroundColour | The background colour of the canvas. |
width | The width of the canvas and the pages it contains. |
height | The height of the canvas and the pages it contains. |
Definition at line 98 of file SKMultiLayerRenderCanvas.cs.
VectSharp.Canvas.SKMultiLayerRenderCanvas.SKMultiLayerRenderCanvas | ( | IEnumerable< Page > | layers, |
Colour | backgroundColour, | ||
double | width, | ||
double | height, | ||
List< SKRenderAction > | layerTransforms = null |
||
) |
Create a new SKMultiLayerRenderCanvas from a collection of Pages, each representing a layer.
layers | The contents of the canvas. Each element in this list represents a layer. |
layerTransforms | A list of transforms associated with each layer. This list should contain the same number of elements as layers . This is useful to manipulate the position of each layer individually. If this is null, an identity transform is applied to each layer. |
backgroundColour | The background colour of the canvas. |
width | The width of the canvas and the pages it contains. |
height | The height of the canvas and the pages it contains. |
Definition at line 108 of file SKMultiLayerRenderCanvas.cs.
VectSharp.Canvas.SKMultiLayerRenderCanvas.SKMultiLayerRenderCanvas | ( | List< SKRenderContext > | contents, |
List< SKRenderAction > | contentTransforms, | ||
Colour | backgroundColour, | ||
double | width, | ||
double | height | ||
) |
Create a new SKMultiLayerRenderCanvas from a list of SKRenderContexts, each representing a layer.
contents | The contents of the canvas. Each element in this list represents a layer. A Page can be converded to a SKRenderContext through the CopyToSKRenderContext method. |
contentTransforms | A list of transforms associated with each layer. This list should contain the same number of elements as contents . This is useful to manipulate the position of each layer individually. |
backgroundColour | The background colour of the canvas. |
width | The width of the canvas and the page it contains. |
height | The height of the canvas and the page it contains. |
Definition at line 143 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.AddLayer | ( | SKRenderContext | newContent, |
SKRenderAction | newTransform | ||
) |
Add a new layer to the image.
newContent | The contents of the new layer. A Page can be converded to a SKRenderContext through the CopyToSKRenderContext method. |
newTransform | The transform for the new layer. |
Definition at line 276 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.InsertLayer | ( | int | index, |
SKRenderContext | newContent, | ||
SKRenderAction | newTransform | ||
) |
Insert a new layer at the specified index.
index | The position at which the new layer will be inserted. |
newContent | The contents of the new layer. |
newTransform | The transform for the new layer. |
Definition at line 309 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.InvalidateDirty | ( | ) |
Invalidate the contents of the canvas, forcing it to redraw itself.
Definition at line 988 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.InvalidateZIndex | ( | ) |
Invalidate the contents of the canvas, specifying that the order of the layers has changed.
Definition at line 997 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.MoveLayer | ( | int | oldIndex, |
int | newIndex | ||
) |
Move the specified layer to the specified position, shifting all other layers as necessary.
oldIndex | The current index of the layer to move. |
newIndex | The final index of the layer. Layers after this will be shifted by 1 in order to accommodate the moved layer. |
Definition at line 389 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.RemoveLayer | ( | int | layer | ) |
Remove the specified layer from the image.
layer | The index of the layer to remove. |
Definition at line 340 of file SKMultiLayerRenderCanvas.cs.
RenderTargetBitmap VectSharp.Canvas.SKMultiLayerRenderCanvas.RenderAtResolution | ( | int | width, |
int | height, | ||
SKColor? | background = null |
||
) |
Render the image at to a bitmap at the specified resolution.
width | The width of the rendered image. Note that the actual width of the returned image might be lower than this, depending on the aspect ratio of the image. |
height | The height of the rendered image. Note that the actual height of the returned image might be lower than this, depending on the aspect ratio of the image. |
background | The background colour for the image. If this is null , the current background colour is used. |
Definition at line 735 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.SwitchLayers | ( | int | layer1, |
int | layer2 | ||
) |
Switch the position of the two specified layers.
layer1 | The index of the first layer to switch. |
layer2 | The index of the second layer to switch. |
Definition at line 364 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.UpdateLayer | ( | int | layer, |
SKRenderContext | newContent, | ||
SKRenderAction | newTransform | ||
) |
Replace a single layer with the specified content.
layer | The index of the layer to replace. |
newContent | The new contents of the layer. A Page can be converded to a SKRenderContext through the CopyToSKRenderContext method. |
newTransform | The new transform for the layer. |
Definition at line 244 of file SKMultiLayerRenderCanvas.cs.
void VectSharp.Canvas.SKMultiLayerRenderCanvas.UpdateWith | ( | List< SKRenderContext > | contents, |
List< SKRenderAction > | contentTransforms, | ||
Colour | backgroundColour, | ||
double | width, | ||
double | height | ||
) |
Replace the contents of the SKMultiLayerRenderCanvas with the specified layers.
contents | The contents of the canvas. Each element in this list represents a layer. A Page can be converded to a SKRenderContext through the CopyToSKRenderContext method. |
contentTransforms | A list of transforms associated with each layer. This list should contain the same number of elements as contents . This is useful to manipulate the position of each layer individually. |
backgroundColour | The background colour of the canvas. |
width | The width of the canvas and the page it contains. |
height | The height of the canvas and the page it contains. |
Definition at line 166 of file SKMultiLayerRenderCanvas.cs.
List<SKRenderAction> VectSharp.Canvas.SKMultiLayerRenderCanvas.LayerTransforms |
The list of transforms associated with each layer.
Definition at line 64 of file SKMultiLayerRenderCanvas.cs.
List<List<SKRenderAction> > VectSharp.Canvas.SKMultiLayerRenderCanvas.RenderActions |
The list of render actions, each element in this list is itself a list, containing the actions that correspond to a layer in the image.
Definition at line 59 of file SKMultiLayerRenderCanvas.cs.
object VectSharp.Canvas.SKMultiLayerRenderCanvas.RenderLock = new object() |
An lock for the rendering loop. The public methods of this class already lock on this, but you may need it if you want to directly manipulate the contents of the canvas.
Definition at line 726 of file SKMultiLayerRenderCanvas.cs.
|
getset |
The height of the page that is rendered on this canvas.
Definition at line 53 of file SKMultiLayerRenderCanvas.cs.
|
getset |
The width of the page that is rendered on this canvas.
Definition at line 48 of file SKMultiLayerRenderCanvas.cs.
|
getset |
If the image to draw is not already cached, this method is called with an argument containing the number of milliseconds since the image was last rendered. The method can return a Bitmap that will be drawn on the canvas in order to let users know that the image is being rendered in background.
Definition at line 70 of file SKMultiLayerRenderCanvas.cs.