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

Contains methods to render a Page to an Image. More...

Classes

class  UnknownFormatException
 The exception that is raised when the output file format is not specified and the file name does not have an extension corresponding to a known file format. More...
 

Static Public Member Functions

static Image< SixLabors.ImageSharp.PixelFormats.Rgba32 > SaveAsImage (this Page page, double scale=1)
 Render the page to an Image object. More...
 
static void SaveAsImage (this Page page, Stream imageStream, OutputFormats outputFormat, double scale=1)
 Render the page to an image stream. More...
 
static void SaveAsImage (this Page page, string fileName, OutputFormats? outputFormat=null, double scale=1)
 Render the page to an image file. 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 byte[] SaveAsRawBytes (this Page pag, out int width, out int height, double scale=1)
 Return the page to raw pixel data, in 32bpp RGBA format. More...
 
static RasterImage Rasterise (this Graphics graphics, Rectangle region, double scale, bool interpolate)
 Rasterise a region of a Graphics object. More...
 
static Image SaveAsAnimatedGIF (this Animation animation, double scale=1, double frameRate=50, double durationScaling=1, GifColorTableMode colorTableMode=GifColorTableMode.Local)
 Saves the animation to an animated GIF. More...
 
static void SaveAsAnimatedGIF (this Animation animation, Stream imageStream, double scale=1, double frameRate=50, double durationScaling=1, GifColorTableMode colorTableMode=GifColorTableMode.Local)
 Saves the animation to an animated GIF stream. More...
 
static void SaveAsAnimatedGIF (this Animation animation, string fileName, double scale=1, double frameRate=50, double durationScaling=1, GifColorTableMode colorTableMode=GifColorTableMode.Local)
 Saves the animation to an animated GIF file. 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 an Image.

Definition at line 1048 of file ImageSharpContext.cs.

Member Function Documentation

◆ Rasterise()

static RasterImage VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.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 1280 of file ImageSharpContext.cs.

◆ SaveAsAnimatedGIF() [1/3]

static Image VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsAnimatedGIF ( this Animation  animation,
double  scale = 1,
double  frameRate = 50,
double  durationScaling = 1,
GifColorTableMode  colorTableMode = GifColorTableMode.Local 
)
static

Saves the animation to an animated GIF.

Parameters
animationThe animation to export.
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 GIF specification at 50 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.
colorTableModeDetermines whether a single colour table should be used for the whole image, or if a different colour table should be used for each frame.
Returns
An Image containing the animated GIF.

Definition at line 1328 of file ImageSharpContext.cs.

◆ SaveAsAnimatedGIF() [2/3]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsAnimatedGIF ( this Animation  animation,
Stream  imageStream,
double  scale = 1,
double  frameRate = 50,
double  durationScaling = 1,
GifColorTableMode  colorTableMode = GifColorTableMode.Local 
)
static

Saves the animation to an animated GIF stream.

Parameters
animationThe animation to export.
imageStreamThe stream on which the animated GIF 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 GIF specification at 50 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.
colorTableModeDetermines whether a single colour table should be used for the whole image, or if a different colour table should be used for each frame.

Definition at line 1387 of file ImageSharpContext.cs.

◆ SaveAsAnimatedGIF() [3/3]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsAnimatedGIF ( this Animation  animation,
string  fileName,
double  scale = 1,
double  frameRate = 50,
double  durationScaling = 1,
GifColorTableMode  colorTableMode = GifColorTableMode.Local 
)
static

Saves the animation to an animated GIF 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 GIF specification at 50 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.
colorTableModeDetermines whether a single colour table should be used for the whole image, or if a different colour table should be used for each frame.

Definition at line 1403 of file ImageSharpContext.cs.

◆ SaveAsAnimatedPNG() [1/2]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.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 1420 of file ImageSharpContext.cs.

◆ SaveAsAnimatedPNG() [2/2]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.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 1508 of file ImageSharpContext.cs.

◆ SaveAsImage() [1/3]

static Image< SixLabors.ImageSharp.PixelFormats.Rgba32 > VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsImage ( this Page  page,
double  scale = 1 
)
static

Render the page to an Image object.

Parameters
pageThe Page to render.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the Image.
Returns
An Image containing the rasterised page.

Definition at line 1056 of file ImageSharpContext.cs.

◆ SaveAsImage() [2/3]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsImage ( this Page  page,
Stream  imageStream,
OutputFormats  outputFormat,
double  scale = 1 
)
static

Render the page to an image stream.

Parameters
pageThe Page to render.
imageStreamThe Stream on which the image data will be written.
outputFormatThe format of the image that will be created.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the image.

Definition at line 1072 of file ImageSharpContext.cs.

◆ SaveAsImage() [3/3]

static void VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsImage ( this Page  page,
string  fileName,
OutputFormats outputFormat = null,
double  scale = 1 
)
static

Render the page to an image file.

Parameters
pageThe Page to render.
fileNameThe path of the file where the image will be saved.
outputFormatThe format of the image that will be created. If this is null (the default), the format is desumed from the extension of the file.
scaleThe scale to be used when rasterising the page. This will determine the width and height of the image.

Definition at line 1130 of file ImageSharpContext.cs.

◆ SaveAsRawBytes() [1/2]

static byte[] VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.SaveAsRawBytes ( this Page  pag,
out int  width,
out int  height,
double  scale = 1 
)
static

Return 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.
Returns
A byte array containing the raw pixel data.

Definition at line 1243 of file ImageSharpContext.cs.

◆ SaveAsRawBytes() [2/2]

static DisposableIntPtr VectSharp.Raster.ImageSharp.ImageSharpContextInterpreter.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 1200 of file ImageSharpContext.cs.


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