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
Afficher le fichier Open project: fmotagarcia/sparrow-sharp

Protected Properties

Свойство Type Description
_color uint
_vertexData Sparrow.Utils.VertexData

Méthodes publiques

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

Méthodes protégées

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

Private Methods

Méthode Description
CopyVertexDataTo ( VertexData targetData, int atIndex, bool copyColor ) : void

Method Details

BoundsInSpace() public méthode

public BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
targetSpace DisplayObject
Résultat Sparrow.Geom.Rectangle

Init() protected méthode

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

Quad() public méthode

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

Render() public méthode

public Render ( RenderSupport support ) : void
support Sparrow.Core.RenderSupport
Résultat void

VertexDataDidChange() protected méthode

protected VertexDataDidChange ( ) : void
Résultat void

Property Details

_color protected_oe property

protected uint _color
Résultat uint

_vertexData protected_oe property

protected VertexData,Sparrow.Utils _vertexData
Résultat Sparrow.Utils.VertexData