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
intThe width of the picture in pixels.
pHeight
intThe height of the picture in pixels.
pBackgroundColor
intThe background color for the picture as Windows color.
Properties
Bitmap
Returns the underlying Bitmap.
public Bitmap Bitmap { get; }
Property Value
ExifInfo
Returns the Exif information of a JPG image if this was read with parameter 'ReadExifInformation = True'
public ExifReader ExifInfo { get; }
Property Value
Height
Returns the height of the image in pixels.
public int Height { get; }
Property Value
Width
Returns the width of the image in pixels.
public int Width { get; }
Property Value
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
boolPass 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
intThe quality of the image. Use 1-99. Higher values produce better images
pNewHeight
intThe height to render the image to. Use 0 for original height.
pNewWidth
intThe 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
BitmapThe 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
BitmapThe 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
LoadPPMfile(string)
Simplified load routine to load PPM files as created with PDF2Images.
public string LoadPPMfile(string pFileData)
Parameters
pFileData
stringThe 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
ImageThe 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
intThe rotation to perform before rendering.
pOpacity
intThe 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
intThe new height to resample to. Negative values can be used to flip the image.
pNewWidth
intThe 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
doubleThe rotation in degrees (360 is a full turn).
pNewHeight
intThe new height of the rotated image. Use 0 to automatically determine.
pNewWidth
intThe 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
stringThe binary data from the image file (JPG, PNG, BMP, GIF).
pParseExifInfo
boolIf 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
BitmapThe 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)