C# Class LibwebpSharp.Utilities

Mostra file Open project: NKnusperer/libwebp-sharp

Public Methods

Method Description
CalculateBitmapSize ( int imgWidth, int imgHeight, PixelFormat format ) : int

Calculate the needed size for a bitmap

ConvertDataToBitmap ( byte data, int imgWidth, int imgHeight, PixelFormat format ) : Bitmap

Convert raw image data into a Bitmap object

CopyDataToUnmanagedMemory ( byte data ) : IntPtr

Copy data from managed to unmanaged memory

CopyFileToManagedArray ( string path ) : byte[]

Get a file from the disk and copy it into a managed byte array

GetDataFromUnmanagedMemory ( IntPtr source, int lenght ) : byte[]

Get data from unmanaged memory back to managed memory

Method Details

CalculateBitmapSize() public static method

Calculate the needed size for a bitmap
public static CalculateBitmapSize ( int imgWidth, int imgHeight, PixelFormat format ) : int
imgWidth int The image width
imgHeight int The image height
format PixelFormat The pixel format you want to use
return int

ConvertDataToBitmap() public static method

Convert raw image data into a Bitmap object
public static ConvertDataToBitmap ( byte data, int imgWidth, int imgHeight, PixelFormat format ) : Bitmap
data byte The byte array containing the image data
imgWidth int The width of your image
imgHeight int The height of your image
format PixelFormat The PixelFormat the Bitmap should use
return System.Drawing.Bitmap

CopyDataToUnmanagedMemory() public static method

Copy data from managed to unmanaged memory
public static CopyDataToUnmanagedMemory ( byte data ) : IntPtr
data byte The data you want to copy
return System.IntPtr

CopyFileToManagedArray() public static method

Get a file from the disk and copy it into a managed byte array
public static CopyFileToManagedArray ( string path ) : byte[]
path string The path to the file
return byte[]

GetDataFromUnmanagedMemory() public static method

Get data from unmanaged memory back to managed memory
public static GetDataFromUnmanagedMemory ( IntPtr source, int lenght ) : byte[]
source System.IntPtr A Pointer where the data lifes
lenght int How many bytes you want to copy
return byte[]