VectSharp 2.5.0
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Raster.Raster Class Reference

Contains methods to render a page to a PNG image. More...

Static Public Member Functions

static void SaveAsPNG (this Page page, string fileName, double scale=1)
 Render the page to a PNG file. More...
 
static void SaveAsPNG (this Page page, Stream stream, double scale=1)
 Render the page to a PNG stream. More...
 
static RasterImage Rasterise (this Graphics graphics, Rectangle region, double scale, bool interpolate)
 Rasterise a region of a Graphics object. More...
 
static DisposableIntPtr SaveAsRawBytes (this Page pag, out int width, out int height, out int totalSize, double scale=1)
 Render the page to raw pixel data, in 32bpp RGBA format. More...
 
static void SaveAsAnimatedPNG (this Animation animation, Stream imageStream, double scale=1, double frameRate=60, double durationScaling=1, AnimatedPNG.InterframeCompression interframeCompression=AnimatedPNG.InterframeCompression.First)
 Saves the animation to a stream in animated PNG format. More...
 
static void SaveAsAnimatedPNG (this Animation animation, string fileName, double scale=1, double frameRate=60, double durationScaling=1, AnimatedPNG.InterframeCompression interframeCompression=AnimatedPNG.InterframeCompression.First)
 Saves the animation to an animated PNG file. More...
 

Detailed Description

Contains methods to render a page to a PNG image.

Definition at line 30 of file Raster.cs.

Member Function Documentation

◆ Rasterise()

static RasterImage VectSharp.Raster.Raster.Rasterise ( this Graphics  graphics,
Rectangle  region,
double  scale,
bool  interpolate 
)
static

Rasterise a region of a Graphics object.

Parameters
graphicsThe Graphics object that will be rasterised.
regionThe region of the graphics that will be rasterised.
scaleThe scale at which the image will be rendered.
interpolateWhether the resulting image should be interpolated or not when it is drawn on another Graphics surface.
Returns
A RasterImage containing the rasterised graphics.

Definition at line 91 of file Raster.cs.

◆ SaveAsAnimatedPNG() [1/2]

static void VectSharp.Raster.Raster.SaveAsAnimatedPNG ( this Animation  animation,
Stream  imageStream,
double  scale = 1,
double  frameRate = 60,
double  durationScaling = 1,
AnimatedPNG.InterframeCompression  interframeCompression = AnimatedPNG.InterframeCompression.First 
)
static

Saves the animation to a stream in animated PNG format.

Parameters
animationThe animation to export.
imageStreamThe stream on which the animated PNG will be written.
scaleThe scale at which the animation will be rendered.
frameRateThe target frame rate of the animation, in frames-per-second (fps). This is capped by the animated PNG specification at 90 fps.
durationScalingA scaling factor that will be applied to all durations in the animation. Values greater than 1 slow down the animation, values smaller than 1 accelerate it. Note that this does not affect the frame rate of the animation.
interframeCompressionThe kind of compression that will be used to reduce file size. Note that if the animation has a transparent background, no compression can be performed, and the value of this parameter is ignored.

Definition at line 184 of file Raster.cs.

◆ SaveAsAnimatedPNG() [2/2]

static void VectSharp.Raster.Raster.SaveAsAnimatedPNG ( this Animation  animation,
string  fileName,
double  scale = 1,
double  frameRate = 60,
double  durationScaling = 1,
AnimatedPNG.InterframeCompression  interframeCompression = AnimatedPNG.InterframeCompression.First 
)
static

Saves the animation to an animated PNG file.

Parameters
animationThe animation to export.
fileNameThe output file to create.
scaleThe scale at which the animation will be rendered.
frameRateThe target frame rate of the animation, in frames-per-second (fps). This is capped by the animated PNG specification at 90 fps.
durationScalingA scaling factor that will be applied to all durations in the animation. Values greater than 1 slow down the animation, values smaller than 1 accelerate it. Note that this does not affect the frame rate of the animation.
interframeCompressionThe kind of compression that will be used to reduce file size. Note that if the animation has a transparent background, no compression can be performed, and the value of this parameter is ignored.

Definition at line 267 of file Raster.cs.

◆ SaveAsPNG() [1/2]

static void VectSharp.Raster.Raster.SaveAsPNG ( this Page  page,
Stream  stream,
double  scale = 1 
)
static

Render the page to a PNG stream.

Parameters
pageThe Page to render.
streamThe stream to which the PNG data will be written.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the image file.

Definition at line 64 of file Raster.cs.

◆ SaveAsPNG() [2/2]

static void VectSharp.Raster.Raster.SaveAsPNG ( this Page  page,
string  fileName,
double  scale = 1 
)
static

Render the page to a PNG file.

Parameters
pageThe Page to render.
fileNameThe full path to the file to save. If it exists, it will be overwritten.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the image file.

Definition at line 39 of file Raster.cs.

◆ SaveAsRawBytes()

static DisposableIntPtr VectSharp.Raster.Raster.SaveAsRawBytes ( this Page  pag,
out int  width,
out int  height,
out int  totalSize,
double  scale = 1 
)
static

Render the page to raw pixel data, in 32bpp RGBA format.

Parameters
pagThe Page to render.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the image.
widthThe width of the rendered image.
heightThe height of the rendered image.
totalSizeThe size in bytes of the raw pixel data.
Returns
A DisposableIntPtr containing a pointer to the raw pixel data, stored in unmanaged memory. Dispose this object to release the unmanaged memory.

Definition at line 143 of file Raster.cs.


The documentation for this class was generated from the following file: