C# Class Sparrow.Display.Quad

An Quad represents a rectangle with a uniform color or a color gradient.

You can set one color per vertex. The colors will smoothly fade into each other over the area of the quad. To display a simple linear color gradient, assign one color to vertices 0 and 1 and another color to vertices 2 and 3.

The indices of the vertices are arranged like this:

0 - 1

| / |

2 - 3

**Colors**

Colors in Sparrow are defined as unsigned integers, that's exactly 8 bit per color. The easiest way to define a color is by writing it as a hexadecimal number. A color has the following structure:

0xRRGGBB

That means that you can create the base colors like this:

0xFF0000 -> red

0x00FF00 -> green

0x0000FF -> blue

Inheritance: DisplayObject
Datei anzeigen Open project: fmotagarcia/sparrow-sharp

Protected Properties

Property Type Description
_color uint
_vertexData Sparrow.Utils.VertexData

Public Methods

Method Description
BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
Quad ( float width = 32, float height = 32, uint color = 0xffffff, bool premultipliedAlpha = false ) : Sparrow.Core

Initializes a quad with a certain size and color. The 'premultipliedAlpha' parameter indicates how the colors of the object are stored.

Render ( RenderSupport support ) : void

Protected Methods

Method Description
Init ( float width = 32, float height = 32, uint color = 0xffffff, bool premultipliedAlpha = false ) : void
VertexDataDidChange ( ) : void

Private Methods

Method Description
CopyVertexDataTo ( VertexData targetData, int atIndex, bool copyColor ) : void

Method Details

BoundsInSpace() public method

public BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
targetSpace DisplayObject
return Sparrow.Geom.Rectangle

Init() protected method

protected Init ( float width = 32, float height = 32, uint color = 0xffffff, bool premultipliedAlpha = false ) : void
width float
height float
color uint
premultipliedAlpha bool
return void

Quad() public method

Initializes a quad with a certain size and color. The 'premultipliedAlpha' parameter indicates how the colors of the object are stored.
public Quad ( float width = 32, float height = 32, uint color = 0xffffff, bool premultipliedAlpha = false ) : Sparrow.Core
width float
height float
color uint
premultipliedAlpha bool
return Sparrow.Core

Render() public method

public Render ( RenderSupport support ) : void
support Sparrow.Core.RenderSupport
return void

VertexDataDidChange() protected method

protected VertexDataDidChange ( ) : void
return void

Property Details

_color protected_oe property

protected uint _color
return uint

_vertexData protected_oe property

protected VertexData,Sparrow.Utils _vertexData
return Sparrow.Utils.VertexData