C# Class BrightIdeasSoftware.ImageRenderer

Render an image that comes from our data source.
The image can be sourced from: a byte-array (normally when the image to be shown is stored as a value in a database) an int, which is treated as an index into the image list a string, which is treated first as a file name, and failing that as an index into the image list an ICollection of ints or strings, which will be drawn as consecutive images

If an image is an animated GIF, it's state is stored in the SubItem object.

By default, the image renderer does not render animations (it begins life with animations paused). To enable animations, you must call Unpause().

In the current implementation (2009-09), each column showing animated gifs must have a different instance of ImageRenderer assigned to it. You cannot share the same instance of an image renderer between two animated gif columns. If you do, only the last column will be animated.

Inheritance: BaseRenderer
Datei anzeigen Open project: soywiz/cspspemu

Private Properties

Property Type Description

Public Methods

Method Description
ImageRenderer ( ) : System

Make an empty image renderer

ImageRenderer ( bool startAnimations ) : System

Make an empty image renderer that begins life ready for animations

OnTimer ( Object state ) : void

This is the method that is invoked by the timer. It basically switches control to the listview thread.

Pause ( ) : void

Pause any animations

Render ( Graphics g, Rectangle r ) : void

Draw our image

Unpause ( ) : void

Unpause any animations

Protected Methods

Method Description
GetImageFromAspect ( ) : Image

Translate our Aspect into an image.

The strategy is: If its a byte array, we treat it as an in-memory image If it's an int, we use that as an index into our image list If it's a string, we try to load a file by that name. If we can't, we use the string as an index into our image list.

OnTimerInThread ( ) : void

This is the OnTimer callback, but invoked in the same thread as the creator of the ListView. This method can use all of ListViews methods without creating a CrossThread exception.

Method Details

GetImageFromAspect() protected method

Translate our Aspect into an image.
The strategy is: If its a byte array, we treat it as an in-memory image If it's an int, we use that as an index into our image list If it's a string, we try to load a file by that name. If we can't, we use the string as an index into our image list.
protected GetImageFromAspect ( ) : Image
return Image

ImageRenderer() public method

Make an empty image renderer
public ImageRenderer ( ) : System
return System

ImageRenderer() public method

Make an empty image renderer that begins life ready for animations
public ImageRenderer ( bool startAnimations ) : System
startAnimations bool
return System

OnTimer() public method

This is the method that is invoked by the timer. It basically switches control to the listview thread.
public OnTimer ( Object state ) : void
state Object not used
return void

OnTimerInThread() protected method

This is the OnTimer callback, but invoked in the same thread as the creator of the ListView. This method can use all of ListViews methods without creating a CrossThread exception.
protected OnTimerInThread ( ) : void
return void

Pause() public method

Pause any animations
public Pause ( ) : void
return void

Render() public method

Draw our image
public Render ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
return void

Unpause() public method

Unpause any animations
public Unpause ( ) : void
return void