Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkVertices Class Reference

An immutable set of vertex data that can be used with SkCanvas::drawVertices. More...

#include <SkVertices.h>

Inheritance diagram for SkVertices:
SkNVRefCnt< SkVertices >

Classes

class  Builder
 

Public Types

enum  VertexMode { kTriangles_VertexMode, kTriangleStrip_VertexMode, kTriangleFan_VertexMode }
 
enum  BuilderFlags { kHasTexCoords_BuilderFlag = 1 << 0, kHasColors_BuilderFlag = 1 << 1 }
 

Public Member Functions

uint32_t uniqueID () const
 
VertexMode mode () const
 
const SkRectbounds () const
 
bool hasColors () const
 
bool hasTexCoords () const
 
bool hasIndices () const
 
int vertexCount () const
 
const SkPointpositions () const
 
const SkPointtexCoords () const
 
const SkColorcolors () const
 
int indexCount () const
 
const uint16_t * indices () const
 
size_t approximateSize () const
 
sk_sp< SkDataencode () const
 Pack the vertices object into a byte buffer. More...
 
- Public Member Functions inherited from SkNVRefCnt< SkVertices >
bool unique () const
 
void ref () const
 
void unref () const
 
void deref () const
 

Static Public Member Functions

static sk_sp< SkVerticesMakeCopy (VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
 Create a vertices by copying the specified arrays. More...
 
static sk_sp< SkVerticesMakeCopy (VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[])
 
static sk_sp< SkVerticesDecode (const void *buffer, size_t length)
 Recreate a vertices from a buffer previously created by calling encode(). More...
 

Private Member Functions

void operator delete (void *p)
 

Static Private Member Functions

static sk_sp< SkVerticesAlloc (int vCount, int iCount, uint32_t builderFlags, size_t *arraySize)
 

Private Attributes

uint32_t fUniqueID
 
SkPointfPositions
 
SkPointfTexs
 
SkColorfColors
 
uint16_t * fIndices
 
SkRect fBounds
 
int fVertexCnt
 
int fIndexCnt
 
VertexMode fMode
 

Friends

class SkNVRefCnt< SkVertices >
 

Detailed Description

An immutable set of vertex data that can be used with SkCanvas::drawVertices.

Member Function Documentation

static sk_sp<SkVertices> SkVertices::Decode ( const void *  buffer,
size_t  length 
)
static

Recreate a vertices from a buffer previously created by calling encode().

Returns null if the data is corrupt or the length is incorrect for the contents.

sk_sp<SkData> SkVertices::encode ( ) const

Pack the vertices object into a byte buffer.

This can be used to recreate the vertices by calling Decode() with the buffer.

static sk_sp<SkVertices> SkVertices::MakeCopy ( VertexMode  mode,
int  vertexCount,
const SkPoint  positions[],
const SkPoint  texs[],
const SkColor  colors[],
int  indexCount,
const uint16_t  indices[] 
)
static

Create a vertices by copying the specified arrays.

texs and colors may be nullptr, and indices is ignored if indexCount == 0.


The documentation for this class was generated from the following file: