C# Class Alexandria.Raster

An indexed raster image that can be useful for a variety of systems.
Afficher le fichier Open project: Burton-Radons/Alexandria

Private Properties

Свойство 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

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat int

BlendPalette() public static méthode

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.
Résultat Codex

Clamp() public méthode

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

ClampX() public méthode

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

ClampY() public méthode

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

Clear() public méthode

Clear the raster to a given index.
public Clear ( int value ) : void
value int
Résultat void

ColorAt() public méthode

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

ColorAt() public méthode

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
Résultat int

Contains() public méthode

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

Contains() public méthode

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

ContainsX() public méthode

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

ContainsY() public méthode

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

DrawFillSci() public méthode

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
Résultat void

DrawFillSci() public méthode

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
Résultat void

DrawHorizontalLine() public méthode

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

DrawImage() public méthode

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
Résultat void

DrawImageSilhouette() public méthode

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
Résultat void

DrawLineSci() public méthode

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

DrawLineSci() public méthode

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
Résultat void

DrawPixel() public méthode

Draw a pixel in the Raster.
public DrawPixel ( Vector2i position ) : void
position Vector2i
Résultat void

DrawPixel() public méthode

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

DrawVerticalLine() public méthode

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

GetPixel() public méthode

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.
Résultat int

Lock() public méthode

Start drawing to the bitmap.
public Lock ( ) : void
Résultat void

Raster() public méthode

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
Résultat System

Raster() public méthode

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.
Résultat System

SetColor() public méthode

Set the colour index to write.
public SetColor ( int color ) : void
color int
Résultat void

SetColor() public méthode

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

Unlock() public méthode

Stop drawing to the bitmap, flushing the changes.
public Unlock ( ) : void
Résultat void