Table of Contents

Class Image

Namespace
PolarChart
Assembly
PolarChart.dll

This class is used for image processing.

public class Image : IDisposable
Inheritance
Image
Implements
Inherited Members
Extension Methods

Constructors

Image()

Creates a new image.

public Image()

Image(int, int, int)

Creates a new image with the specified parameters.

public Image(int pWidth, int pHeight, int pBackgroundColor = 16777215)

Parameters

pWidth int

The width of the picture in pixels.

pHeight int

The height of the picture in pixels.

pBackgroundColor int

The background color for the picture as Windows color.

Properties

Bitmap

Returns the underlying Bitmap.

public Bitmap Bitmap { get; }

Property Value

Bitmap

ExifInfo

Returns the Exif information of a JPG image if this was read with parameter 'ReadExifInformation = True'

public ExifReader ExifInfo { get; }

Property Value

ExifReader

Height

Returns the height of the image in pixels.

public int Height { get; }

Property Value

int

Width

Returns the width of the image in pixels.

public int Width { get; }

Property Value

int

Methods

Dispose()

Dispose and free resources.

public void Dispose()

DrawingArea(bool)

Returns the DrawingArea helper object to draw on the image.

public DrawingArea DrawingArea(bool pRotated = false)

Parameters

pRotated bool

Pass as true to get a rotated DrawingArea.

Returns

DrawingArea

The drawing area.

GetJPGstream(int, int, int)

Returns the image as JPG image in a binary string.

public string GetJPGstream(int pQuality = 90, int pNewHeight = 0, int pNewWidth = 0)

Parameters

pQuality int

The quality of the image. Use 1-99. Higher values produce better images

pNewHeight int

The height to render the image to. Use 0 for original height.

pNewWidth int

The Width to render the image to. Use 0 for original width.

Returns

string

A binary string containing the data of the JPG image.

GetPNGstream()

Returns the image as PNG image in a binary string.

public string GetPNGstream()

Returns

string

A binary string containing the data of the image in PNG format.

GetPixels()

Gets all the pixels as array of int's.

public int[] GetPixels()

Returns

int[]

GetPixels(Bitmap)

Gets the pixels of the specified bitmap as array of int's

public static int[] GetPixels(Bitmap pBitmap)

Parameters

pBitmap Bitmap

The bitmap to get the pixels for.

Returns

int[]

An array of int's

GetPixels_ByteArray(Bitmap)

Gets the pixels of the specified bitmap bytearray in the format ARGB (4 bytes per pixel)

public static byte[] GetPixels_ByteArray(Bitmap pBitmap)

Parameters

pBitmap Bitmap

The bitmap to get the pixels for.

Returns

byte[]

A bytearray.

InitialiseBlankPicture(int, int)

Initialises the image with a blank (transparent) picture.

public void InitialiseBlankPicture(int pWidth, int pHeight)

Parameters

pWidth int

The width of the picture in pixels.

pHeight int

The height of the picture in pixels.

LoadPPMfile(string)

Simplified load routine to load PPM files as created with PDF2Images.

public string LoadPPMfile(string pFileData)

Parameters

pFileData string

The binary file data for the PPM file.

Returns

string

An error message if applicable.

RenderTo(Image, Rectangle?, Rectangle?, int, int)

Renders this image on a destination image.

public void RenderTo(Image pDestinationImage, Rectangle? pDestination = null, Rectangle? pSource = null, int pRotation = 0, int pOpacity = 100)

Parameters

pDestinationImage Image

The destination image to render this image to.

pDestination Rectangle?

The rectangle on the destination to render to.

pSource Rectangle?

The source rectangle to render.

pRotation int

The rotation to perform before rendering.

pOpacity int

The opacity (as int percentage: 100 full opacity, 0: full transparency)

Resample(int, int)

Resamples an image (changing the size while smoothing).

public void Resample(int pNewHeight, int pNewWidth)

Parameters

pNewHeight int

The new height to resample to. Negative values can be used to flip the image.

pNewWidth int

The new width to resample to. Negative values can be used to mirror the image.

Rotate(double, int, int)

Rotates the image.

public void Rotate(double pRotationDegrees360, int pNewHeight = 0, int pNewWidth = 0)

Parameters

pRotationDegrees360 double

The rotation in degrees (360 is a full turn).

pNewHeight int

The new height of the rotated image. Use 0 to automatically determine.

pNewWidth int

The new width of the rotated image. Use 0 to automatically determine.

SetJPGstream(string, bool)

Loads image data from a file into the image. The name suggests JPG, but other image formats (PNG, BMP, GIF) are also supported.

public bool SetJPGstream(string pJPGstream, bool pParseExifInfo = false)

Parameters

pJPGstream string

The binary data from the image file (JPG, PNG, BMP, GIF).

pParseExifInfo bool

If True, the EXIF information from an image file is also read.

Returns

bool

A boolean indicating success.

SetPixels(Bitmap, int[])

Sets the pixels for the specified bitmap to the specified array of int's

public static void SetPixels(Bitmap pBitmap, int[] pPixels)

Parameters

pBitmap Bitmap

The bitmap to set the pixels for.

pPixels int[]

Array of int's for the value of the pixels.

SetPixels(int[])

Sets the pixels to the specified array of int's

public void SetPixels(int[] pPixels)

Parameters

pPixels int[]

Array of int's for the value of the pixels.

SetPixels_ByteArray(Bitmap, byte[])

Sets the pixels for the specified bitmap to the specified bytearray in the format ARGB (4 bytes per pixel)

public static void SetPixels_ByteArray(Bitmap pBitmap, byte[] pPixels)

Parameters

pBitmap Bitmap

The bitmap to set the pixels for.

pPixels byte[]

The bytearray for the pixels.