Class ImageHelper
Provides common helper methods related with image manipulation. TODO: Should be moved to base assembly, making it accessible for all Telerik Assemblies.
Inheritance
Inherited Members
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public static class ImageHelper
Methods
ApplyAlpha(Bitmap, Single)
Declaration
public static void ApplyAlpha(Bitmap bitmap, float fAlpha)
Parameters
System.
|
System.
|
ApplyMask(Bitmap, Brush)
Declaration
public static void ApplyMask(Bitmap bitmap, Brush brush)
Parameters
System.
|
System.
|
AreColorsSame(Color, Color)
Declaration
public static bool AreColorsSame(Color color1, Color color2)
Parameters
System.
|
System.
|
Returns
System.
|
BitmapInvertColors(Bitmap)
Declaration
public static Bitmap BitmapInvertColors(Bitmap original)
Parameters
System.
|
Returns
System.
|
ChangeImagePixels(Image, Color)
Declaration
public static Image ChangeImagePixels(Image image, Color color)
Parameters
System.
|
System.
|
Returns
System.
|
ConvertToDib(Image)
Converts the image to Device Independent Bitmap format of type BITFIELDS. This is (wrongly) accepted by many applications as containing transparency
Declaration
public static byte[] ConvertToDib(Image image)
Parameters
System. Image to convert to DIB |
Returns
System. The image converted to DIB, in bytes. |
CopyImageToClipboard(Image)
Copies given image to the clipboard. Different applications understand different image formats, so this method applies the three most common image formats to the data object - Bitmap, PNG and DIB.
Declaration
public static void CopyImageToClipboard(Image image)
Parameters
System. The image to copy. |
Crop(Bitmap, Rectangle)
Crops recatnalge from image
Declaration
public static Bitmap Crop(Bitmap image, Rectangle cropRectangle)
Parameters
System. An instance of System. |
System. An instance of System. |
Returns
System. Cropped image with the size of cropped rectangle |
GetBitmapRegionPath(Bitmap, Color)
Declaration
public static GraphicsPath GetBitmapRegionPath(Bitmap bmp, Color transparent)
Parameters
System.
|
System.
|
Returns
System.
|
GetBytesFromImage(Image)
Declaration
public static byte[] GetBytesFromImage(Image image)
Parameters
System.
|
Returns
System.
|
GetClipboardImage()
Gets image from the clipboard and preserves pixel transparency. If there is no image data in the clipboard, returns null.
Declaration
public static Image GetClipboardImage()
Returns
System. The image from clipboard. |
GetClipboardImage(DataObject)
Retrieves an image from the given clipboard data object, in the order PNG, DIB, Bitmap, Image object.
Declaration
public static Bitmap GetClipboardImage(DataObject clipboardData)
Parameters
System. The clipboard data. |
Returns
System. The extracted image, or null if no supported image type was found. |
GetImageData(Bitmap, out Int32)
Gets the raw bytes from an image.
Declaration
public static byte[] GetImageData(Bitmap sourceImage, out int stride)
Parameters
System. The image to get the bytes from. |
System. Stride of the retrieved image data. |
Returns
System. The raw bytes of the image |
GetImageFromBytes(Byte[])
Declaration
public static Image GetImageFromBytes(byte[] bytes)
Parameters
System.
|
Returns
System.
|
HslToRgb(Double, Double, Double, Double)
Declaration
public static Color HslToRgb(double h, double s, double l, double a)
Parameters
System.
|
System.
|
System.
|
System.
|
Returns
System.
|
IsDarkColor(Color)
Declaration
public static bool IsDarkColor(Color color)
Parameters
System.
|
Returns
System.
|
PointInRegion(Region, Point)
Declaration
public static bool PointInRegion(Region region, Point client)
Parameters
System.
|
System.
|
Returns
System.
|
RegionFromBitmap(Bitmap, Color)
Declaration
public static Region RegionFromBitmap(Bitmap bmp, Color transparent)
Parameters
System.
|
System.
|
Returns
System.
|