Skia
2D Graphics Library
SkVertices::Attribute Struct Reference

EXPERIMENTAL - An SkVertices object can be constructed with a custom collection of vertex attributes. More...

#include <SkVertices.h>

Public Types

enum  Type : uint8_t {
  Type::kFloat, Type::kFloat2, Type::kFloat3, Type::kFloat4,
  Type::kByte4_unorm
}
 
enum  Usage : uint8_t {
  Usage::kRaw, Usage::kColor, Usage::kVector, Usage::kNormalVector,
  Usage::kPosition
}
 

Public Member Functions

 Attribute (Type t=Type::kFloat, Usage u=Usage::kRaw, const char *markerName=nullptr)
 markerName is not copied by the Attribute, so it must outlive this struct. More...
 
bool operator== (const Attribute &that) const
 
bool operator!= (const Attribute &that) const
 
int channelCount () const
 
size_t bytesPerVertex () const
 
bool isValid () const
 

Public Attributes

Type fType
 
Usage fUsage
 
uint32_t fMarkerID
 
const char * fMarkerName
 

Detailed Description

EXPERIMENTAL - An SkVertices object can be constructed with a custom collection of vertex attributes.

Each attribute is described by a single Attribute struct. Type defines the CPU type of the data. Usage determines what transformation (if any) is applied to that data in the vertex shader. For positions or vectors, markerName identifies what matrix is used in the vertex shader to transform the data. Those names should match a named transform on the CTM stack, created by calling SkCanvas::markCTM().

For attributes with a usage of kVector, kNormalVector, or kPosition, a null markerName will transform the attribute by the canvas CTM matrix.

Member Enumeration Documentation

◆ Type

enum SkVertices::Attribute::Type : uint8_t
strong
Enumerator
kFloat 
kFloat2 
kFloat3 
kFloat4 
kByte4_unorm 

◆ Usage

enum SkVertices::Attribute::Usage : uint8_t
strong
Enumerator
kRaw 
kColor 
kVector 
kNormalVector 
kPosition 

Constructor & Destructor Documentation

◆ Attribute()

SkVertices::Attribute::Attribute ( Type  t = Type::kFloat,
Usage  u = Usage::kRaw,
const char *  markerName = nullptr 
)

markerName is not copied by the Attribute, so it must outlive this struct.

It is copied when this Attribute is passed to the Builder constructor.

Member Function Documentation

◆ bytesPerVertex()

size_t SkVertices::Attribute::bytesPerVertex ( ) const

◆ channelCount()

int SkVertices::Attribute::channelCount ( ) const

◆ isValid()

bool SkVertices::Attribute::isValid ( ) const

◆ operator!=()

bool SkVertices::Attribute::operator!= ( const Attribute that) const
inline

◆ operator==()

bool SkVertices::Attribute::operator== ( const Attribute that) const
inline

Member Data Documentation

◆ fMarkerID

uint32_t SkVertices::Attribute::fMarkerID

◆ fMarkerName

const char* SkVertices::Attribute::fMarkerName

◆ fType

Type SkVertices::Attribute::fType

◆ fUsage

Usage SkVertices::Attribute::fUsage

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