C# Class BrightIdeasSoftware.MappedImageRenderer

This class maps a data value to an image that should be drawn for that value.

It is useful for drawing data that is represented as an enum or boolean.

Inheritance: BaseRenderer
Afficher le fichier Open project: soywiz/cspspemu

Méthodes publiques

Méthode Description
Add ( Object value, Object image ) : void

Register the image that should be drawn when our Aspect has the data value.

Boolean ( Object trueImage, Object falseImage ) : MappedImageRenderer

Return a renderer that draw boolean values using the given images

MappedImageRenderer ( ) : System

Make a new empty renderer

MappedImageRenderer ( Object keysAndImages ) : System

Build a renderer from the given array of keys and their matching images

MappedImageRenderer ( Object key, Object image ) : System

Make a new renderer that will show the given image when the given key is the aspect value

MappedImageRenderer ( Object key1, Object image1, Object key2, Object image2 ) : System

Make a new renderer that will show the given images when it receives the given keys

Render ( Graphics g, Rectangle r ) : void

Render our value

TriState ( Object trueImage, Object falseImage, Object nullImage ) : MappedImageRenderer

Return a renderer that draw tristate boolean values using the given images

Méthodes protégées

Méthode Description
RenderCollection ( Graphics g, Rectangle r, ICollection imageSelectors ) : void

Draw a collection of images

RenderOne ( Graphics g, Rectangle r, Object selector ) : void

Draw one image

Method Details

Add() public méthode

Register the image that should be drawn when our Aspect has the data value.
public Add ( Object value, Object image ) : void
value Object Value that the Aspect must match
image Object An ImageSelector -- an int, string or image
Résultat void

Boolean() public static méthode

Return a renderer that draw boolean values using the given images
public static Boolean ( Object trueImage, Object falseImage ) : MappedImageRenderer
trueImage Object Draw this when our data value is true
falseImage Object Draw this when our data value is false
Résultat MappedImageRenderer

MappedImageRenderer() public méthode

Make a new empty renderer
public MappedImageRenderer ( ) : System
Résultat System

MappedImageRenderer() public méthode

Build a renderer from the given array of keys and their matching images
public MappedImageRenderer ( Object keysAndImages ) : System
keysAndImages Object An array of key/image pairs
Résultat System

MappedImageRenderer() public méthode

Make a new renderer that will show the given image when the given key is the aspect value
public MappedImageRenderer ( Object key, Object image ) : System
key Object The data value to be matched
image Object The image to be shown when the key is matched
Résultat System

MappedImageRenderer() public méthode

Make a new renderer that will show the given images when it receives the given keys
public MappedImageRenderer ( Object key1, Object image1, Object key2, Object image2 ) : System
key1 Object
image1 Object
key2 Object
image2 Object
Résultat System

Render() public méthode

Render our value
public Render ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
Résultat void

RenderCollection() protected méthode

Draw a collection of images
protected RenderCollection ( Graphics g, Rectangle r, ICollection imageSelectors ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
imageSelectors ICollection
Résultat void

RenderOne() protected méthode

Draw one image
protected RenderOne ( Graphics g, Rectangle r, Object selector ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
selector Object
Résultat void

TriState() public static méthode

Return a renderer that draw tristate boolean values using the given images
public static TriState ( Object trueImage, Object falseImage, Object nullImage ) : MappedImageRenderer
trueImage Object Draw this when our data value is true
falseImage Object Draw this when our data value is false
nullImage Object Draw this when our data value is null
Résultat MappedImageRenderer