C# Class Sphere.Core.Utility.FastBitmap

Used to efficiently and quickly manipulate bitmaps.
显示文件 Open project: Radnen/spherestudio

Public Methods

Method Description
Clone ( ) : Bitmap

Creates a clone of the wrapped image object.

Clone ( Rectangle rect, PixelFormat format ) : Bitmap

Grabs a sub-section clone of the wrapped image.

Clone ( RectangleF rect, PixelFormat format ) : Bitmap

Grabs a sub-section clone of the wrapped image.

ColorsEqual ( Color col1, Color col2 ) : bool

Determines if two colors equal.

DrawImage ( Bitmap img, int x, int y ) : void

Draws another bitmap into this image using straight-up pixel data. Not as fast as the Graphics.DrawImage();

FastBitmap ( Bitmap img ) : System

Creates a FastBitmap wrapper for an image object.

FlattenAlpha ( ) : void

Sets all transparency to max value.

FloodFill ( int x, int y, Color newColor ) : Rectangle

Replaces the colors of a particular area:

GetPixel ( int x, int y ) : Color

Gets a pixel at the x/y location.

Grayscale ( ) : void

Converts the image to a grayscale representation.

LockImage ( ) : void

Locks the image to get it ready for fast manipluations.

ReplaceColor ( Color oldC, Color newC ) : void

Replaces an old color with a new color.

SetPixel ( int x, int y, Color color ) : void

Sets a pixel at the x/y location to the new color.

UnlockImage ( ) : void

Unlocks the image.

Private Methods

Method Description
CheckFloodPoint ( Stack points, int x, int y, Color oldC, Color newC ) : void
SetAlpha ( int x, int y, byte alpha ) : void
ToGray ( int x, int y ) : void

Method Details

Clone() public method

Creates a clone of the wrapped image object.
public Clone ( ) : Bitmap
return System.Drawing.Bitmap

Clone() public method

Grabs a sub-section clone of the wrapped image.
public Clone ( Rectangle rect, PixelFormat format ) : Bitmap
rect System.Drawing.Rectangle The rectangle to cut from.
format PixelFormat The PixelFomat to use.
return System.Drawing.Bitmap

Clone() public method

Grabs a sub-section clone of the wrapped image.
public Clone ( RectangleF rect, PixelFormat format ) : Bitmap
rect System.Drawing.RectangleF The rectangle to cut from.
format PixelFormat The PixelFomat to use.
return System.Drawing.Bitmap

ColorsEqual() public static method

Determines if two colors equal.
public static ColorsEqual ( Color col1, Color col2 ) : bool
col1 Color The color to compare.
col2 Color The color to compare against.
return bool

DrawImage() public method

Draws another bitmap into this image using straight-up pixel data. Not as fast as the Graphics.DrawImage();
public DrawImage ( Bitmap img, int x, int y ) : void
img System.Drawing.Bitmap The source image.
x int x location in pixels.
y int y location in pixels.
return void

FastBitmap() public method

Creates a FastBitmap wrapper for an image object.
public FastBitmap ( Bitmap img ) : System
img System.Drawing.Bitmap The image object to wrap.
return System

FlattenAlpha() public method

Sets all transparency to max value.
public FlattenAlpha ( ) : void
return void

FloodFill() public method

Replaces the colors of a particular area:
public FloodFill ( int x, int y, Color newColor ) : Rectangle
x int start x
y int start y
newColor Color color to replace with
return System.Drawing.Rectangle

GetPixel() public method

Gets a pixel at the x/y location.
Invalid color format.
public GetPixel ( int x, int y ) : Color
x int The x pixel location.
y int The y pixel location.
return Color

Grayscale() public method

Converts the image to a grayscale representation.
public Grayscale ( ) : void
return void

LockImage() public method

Locks the image to get it ready for fast manipluations.
public LockImage ( ) : void
return void

ReplaceColor() public method

Replaces an old color with a new color.
public ReplaceColor ( Color oldC, Color newC ) : void
oldC Color The color in the image to edit.
newC Color The color to replace with.
return void

SetPixel() public method

Sets a pixel at the x/y location to the new color.
public SetPixel ( int x, int y, Color color ) : void
x int The x pixel location.
y int The y pixel location.
color Color The color to set the pixel to.
return void

UnlockImage() public method

Unlocks the image.
public UnlockImage ( ) : void
return void