C# Class Alexandria.Raster

An indexed raster image that can be useful for a variety of systems.
ファイルを表示 Open project: Burton-Radons/Alexandria

Private Properties

Property Type Description
BlendColorIndex int
DirtyAll void
DirtyArea void
DirtyPoint void
DrawFillAddToStackUnsafe void
DrawPixelUnsafe void
DrawPixelUnsafe void
Flush void
PointerTo int
PointerTo int
ProcessColor int
SetupDrawImage void

Public Methods

Method Description
BlendColorIndex ( int a, int b, int colorCount ) : int

Get the blend colour index in a blended palette.

BlendPalette ( IList original, double blend = 2.0/3.0 ) : Codex

Create a blended palette, which blends colors from the perspective of either A and B or B and A, but unevenly (unless if blend is 0.5). The first colour has blend influence on the result; the second colour has (1 - blend) influence. BlendColorIndex(int,int,int) can be used to create proper indices.

Clamp ( Vector2i value ) : Vector2i

Clamp the value so that it is within the bounds of the Raster.

ClampX ( int value ) : int

Clamp the X coordinate to be within the bounds of the Raster.

ClampY ( int value ) : int

Clamp the Y coordinate to be within the bounds of the Raster.

Clear ( int value ) : void

Clear the raster to a given index.

ColorAt ( Vector2i position ) : int

Get the colour index that will be used with dithering at the given position.

ColorAt ( int x, int y ) : int

Get the colour index that will be used with dithering at the given position.

Contains ( Vector2i position ) : bool

Get whehter the coordinates are within the Raster.

Contains ( int x, int y ) : bool

Get whether the coordinates are within the Raster.

ContainsX ( int value ) : bool

Get whether the Raster contains this X coordinate.

ContainsY ( int value ) : bool

Get whether the Raster contains this Y coordinate.

DrawFillSci ( Vector2i at ) : void

Floodfill drawing in such a way that specifically emulates SCI. Its logical cannot be changed without breaking things.

DrawFillSci ( Vector2i at, int matchColor ) : void

Perform a flood-fill in a way that Sierra's SCI engine does it.

DrawHorizontalLine ( int sx, int y, int ex ) : void

Draw a horizontal line.

DrawImage ( Vector2i position, Vector2i size, int data, int offset, int pitch, int maskIndex ) : void

Draw the image data.

DrawImageSilhouette ( Vector2i position, Vector2i size, int data, int offset, int pitch, int maskIndex ) : void

Draw the image data, using the currently assigned color indices for any non-transparent parts of the image.

DrawLineSci ( Vector2i a, Vector2i b ) : void

Draw a line using Sierra SCI's algorithm

DrawLineSci ( int sx, int sy, int ex, int ey ) : void

Draw a line using SCI-specific logic. Changing this logic in any way will break images.

DrawPixel ( Vector2i position ) : void

Draw a pixel in the Raster.

DrawPixel ( int x, int y ) : void

Draw a pixel, if it's within the clipping range.

DrawVerticalLine ( int x, int sy, int ey ) : void

Draw a vertical line.

GetPixel ( Vector2i position, int defaultValue ) : int

Get the index at a position, or return the default value if the position is out of range.

Lock ( ) : void

Start drawing to the bitmap.

Raster ( Vector2i size, IList palette, int colorBlend = null, byte sourceData = null ) : System

Initialize the Raster.

Raster ( int width, int height, IList palette, int colorBlendBaseCount = null, byte data = null ) : System

Initialize the Raster.

SetColor ( int color ) : void

Set the colour index to write.

SetColor ( int colorA, int colorB ) : void

Set a dithered colour index to write.

Unlock ( ) : void

Stop drawing to the bitmap, flushing the changes.

Private Methods

Method Description
BlendColorIndex ( int a, int b ) : int
DirtyAll ( ) : void
DirtyArea ( int minX, int minY, int maxX, int maxY ) : void
DirtyPoint ( int x, int y ) : void

Ensure the point is within the dirty rectangle.

DrawFillAddToStackUnsafe ( Stack queue, int x, int y, int matchColor ) : void
DrawPixelUnsafe ( Vector2i position ) : void
DrawPixelUnsafe ( int x, int y ) : void

Draw a pixel without first checking whether it's within bounds.

Flush ( ) : void

Add the dirtied rectangle to the bitmap, then clear the dirtied area.

PointerTo ( Vector2i position ) : int
PointerTo ( int x, int y ) : int
ProcessColor ( int value ) : int
SetupDrawImage ( Vector2i &position, Vector2i &size, int &data, int &offset, int &pitch ) : void

Method Details

BlendColorIndex() public static method

Get the blend colour index in a blended palette.
public static BlendColorIndex ( int a, int b, int colorCount ) : int
a int
b int
colorCount int
return int

BlendPalette() public static method

Create a blended palette, which blends colors from the perspective of either A and B or B and A, but unevenly (unless if blend is 0.5). The first colour has blend influence on the result; the second colour has (1 - blend) influence. BlendColorIndex(int,int,int) can be used to create proper indices.
public static BlendPalette ( IList original, double blend = 2.0/3.0 ) : Codex
original IList The original set of colours.
blend double The blending between colours used in a combination. Making this a value other than 0.5 puts more variety into the dithering.
return Codex

Clamp() public method

Clamp the value so that it is within the bounds of the Raster.
public Clamp ( Vector2i value ) : Vector2i
value Vector2i
return Vector2i

ClampX() public method

Clamp the X coordinate to be within the bounds of the Raster.
public ClampX ( int value ) : int
value int
return int

ClampY() public method

Clamp the Y coordinate to be within the bounds of the Raster.
public ClampY ( int value ) : int
value int
return int

Clear() public method

Clear the raster to a given index.
public Clear ( int value ) : void
value int
return void

ColorAt() public method

Get the colour index that will be used with dithering at the given position.
public ColorAt ( Vector2i position ) : int
position Vector2i
return int

ColorAt() public method

Get the colour index that will be used with dithering at the given position.
public ColorAt ( int x, int y ) : int
x int
y int
return int

Contains() public method

Get whehter the coordinates are within the Raster.
public Contains ( Vector2i position ) : bool
position Vector2i
return bool

Contains() public method

Get whether the coordinates are within the Raster.
public Contains ( int x, int y ) : bool
x int
y int
return bool

ContainsX() public method

Get whether the Raster contains this X coordinate.
public ContainsX ( int value ) : bool
value int
return bool

ContainsY() public method

Get whether the Raster contains this Y coordinate.
public ContainsY ( int value ) : bool
value int
return bool

DrawFillSci() public method

Floodfill drawing in such a way that specifically emulates SCI. Its logical cannot be changed without breaking things.
public DrawFillSci ( Vector2i at ) : void
at Vector2i
return void

DrawFillSci() public method

Perform a flood-fill in a way that Sierra's SCI engine does it.
public DrawFillSci ( Vector2i at, int matchColor ) : void
at Vector2i
matchColor int
return void

DrawHorizontalLine() public method

Draw a horizontal line.
public DrawHorizontalLine ( int sx, int y, int ex ) : void
sx int
y int
ex int
return void

DrawImage() public method

Draw the image data.
public DrawImage ( Vector2i position, Vector2i size, int data, int offset, int pitch, int maskIndex ) : void
position Vector2i
size Vector2i
data int
offset int
pitch int
maskIndex int
return void

DrawImageSilhouette() public method

Draw the image data, using the currently assigned color indices for any non-transparent parts of the image.
public DrawImageSilhouette ( Vector2i position, Vector2i size, int data, int offset, int pitch, int maskIndex ) : void
position Vector2i
size Vector2i
data int
offset int
pitch int
maskIndex int
return void

DrawLineSci() public method

Draw a line using Sierra SCI's algorithm
public DrawLineSci ( Vector2i a, Vector2i b ) : void
a Vector2i
b Vector2i
return void

DrawLineSci() public method

Draw a line using SCI-specific logic. Changing this logic in any way will break images.
public DrawLineSci ( int sx, int sy, int ex, int ey ) : void
sx int
sy int
ex int
ey int
return void

DrawPixel() public method

Draw a pixel in the Raster.
public DrawPixel ( Vector2i position ) : void
position Vector2i
return void

DrawPixel() public method

Draw a pixel, if it's within the clipping range.
public DrawPixel ( int x, int y ) : void
x int
y int
return void

DrawVerticalLine() public method

Draw a vertical line.
public DrawVerticalLine ( int x, int sy, int ey ) : void
x int
sy int
ey int
return void

GetPixel() public method

Get the index at a position, or return the default value if the position is out of range.
public GetPixel ( Vector2i position, int defaultValue ) : int
position Vector2i
defaultValue int The default value to return if th position is out of range.
return int

Lock() public method

Start drawing to the bitmap.
public Lock ( ) : void
return void

Raster() public method

Initialize the Raster.
public Raster ( Vector2i size, IList palette, int colorBlend = null, byte sourceData = null ) : System
size Vector2i The dimensions of the raster image.
palette IList The palette to use for colours. This may be a regular palette or a colour blend palette.
colorBlend int If non-negative this is the number of colours in the base palette for a colour-blended palette.
sourceData byte
return System

Raster() public method

Initialize the Raster.
public Raster ( int width, int height, IList palette, int colorBlendBaseCount = null, byte data = null ) : System
width int The width in pixels of the raster image.
height int The height in pixels of the raster image.
palette IList The palette to use for colours. This may be a regular palette or a colour blend palette.
colorBlendBaseCount int If non-negative this is the number of colours in the base palette for a colour-blended palette.
data byte The optional data for the raster.
return System

SetColor() public method

Set the colour index to write.
public SetColor ( int color ) : void
color int
return void

SetColor() public method

Set a dithered colour index to write.
public SetColor ( int colorA, int colorB ) : void
colorA int
colorB int
return void

Unlock() public method

Stop drawing to the bitmap, flushing the changes.
public Unlock ( ) : void
return void