Skia
2DGraphicsLibrary
|
The paint describes how color and coverage are computed at each pixel by GrContext draw functions and the how color is blended with the destination pixel. More...
#include <GrPaint.h>
Public Member Functions | |
GrPaint (const GrPaint &paint) | |
void | setColor4f (const GrColor4f &color) |
The initial color of the drawn primitive. More... | |
const GrColor4f & | getColor4f () const |
GrColor | getColor () const |
Legacy getter, until all code handles 4f directly. | |
void | setAntiAlias (bool aa) |
Should primitives be anti-aliased or not. More... | |
bool | isAntiAlias () const |
void | setDisableOutputConversionToSRGB (bool srgb) |
Should shader output conversion from linear to sRGB be disabled. More... | |
bool | getDisableOutputConversionToSRGB () const |
void | setAllowSRGBInputs (bool allowSRGBInputs) |
Should sRGB inputs be allowed to perform sRGB to linear conversion. More... | |
bool | getAllowSRGBInputs () const |
bool | usesDistanceVectorField () const |
Does one of the fragment processors need a field of distance vectors to the nearest edge? | |
void | setGammaCorrect (bool gammaCorrect) |
Should rendering be gamma-correct, end-to-end. More... | |
void | setXPFactory (sk_sp< GrXPFactory > xpFactory) |
void | setPorterDuffXPFactory (SkXfermode::Mode mode) |
void | setCoverageSetOpXPFactory (SkRegion::Op regionOp, bool invertCoverage=false) |
void | addColorFragmentProcessor (sk_sp< GrFragmentProcessor > fp) |
Appends an additional color processor to the color computation. | |
void | addCoverageFragmentProcessor (sk_sp< GrFragmentProcessor > fp) |
Appends an additional coverage processor to the coverage computation. | |
void | addColorTextureProcessor (GrTexture *, sk_sp< GrColorSpaceXform >, const SkMatrix &) |
Helpers for adding color or coverage effects that sample a texture. More... | |
void | addCoverageTextureProcessor (GrTexture *, const SkMatrix &) |
void | addColorTextureProcessor (GrTexture *, sk_sp< GrColorSpaceXform >, const SkMatrix &, const GrTextureParams &) |
void | addCoverageTextureProcessor (GrTexture *, const SkMatrix &, const GrTextureParams &) |
int | numColorFragmentProcessors () const |
int | numCoverageFragmentProcessors () const |
int | numTotalFragmentProcessors () const |
GrXPFactory * | getXPFactory () const |
GrFragmentProcessor * | getColorFragmentProcessor (int i) const |
GrFragmentProcessor * | getCoverageFragmentProcessor (int i) const |
GrPaint & | operator= (const GrPaint &paint) |
bool | isConstantBlendedColor (GrColor *constantColor) const |
Returns true if the paint's output color will be constant after blending. More... | |
Private Member Functions | |
bool | internalIsConstantBlendedColor (GrColor paintColor, GrColor *constantColor) const |
Private Attributes | |
sk_sp< GrXPFactory > | fXPFactory |
SkSTArray< 4, sk_sp < GrFragmentProcessor > > | fColorFragmentProcessors |
SkSTArray< 2, sk_sp < GrFragmentProcessor > > | fCoverageFragmentProcessors |
bool | fAntiAlias |
bool | fDisableOutputConversionToSRGB |
bool | fAllowSRGBInputs |
bool | fUsesDistanceVectorField |
GrColor4f | fColor |
The paint describes how color and coverage are computed at each pixel by GrContext draw functions and the how color is blended with the destination pixel.
The paint allows installation of custom color and coverage stages. New types of stages are created by subclassing GrProcessor.
The primitive color computation starts with the color specified by setColor(). This color is the input to the first color stage. Each color stage feeds its output to the next color stage.
Fractional pixel coverage follows a similar flow. The coverage is initially the value specified by setCoverage(). This is input to the first coverage stage. Coverage stages are chained together in the same manner as color stages. The output of the last stage is modulated by any fractional coverage produced by anti-aliasing. This last step produces the final coverage, C.
setXPFactory is used to control blending between the output color and dest. It also implements the application of fractional coverage from the coverage pipeline.
void GrPaint::addColorTextureProcessor | ( | GrTexture * | , |
sk_sp< GrColorSpaceXform > | , | ||
const SkMatrix & | |||
) |
Helpers for adding color or coverage effects that sample a texture.
The matrix is applied to the src space position to compute texture coordinates.
|
inline |
Returns true if the paint's output color will be constant after blending.
If the result is true, constantColor will be updated to contain the constant color. Note that we can conflate coverage and color, so the actual values written to pixels with partial coverage may still not seem constant, even if this function returns true.
|
inline |
Should sRGB inputs be allowed to perform sRGB to linear conversion.
With this flag set to false, sRGB textures will be treated as linear (including filtering).
|
inline |
Should primitives be anti-aliased or not.
Defaults to false.
|
inline |
The initial color of the drawn primitive.
Defaults to solid white.
|
inline |
Should shader output conversion from linear to sRGB be disabled.
Only relevant if the destination is sRGB. Defaults to false.
|
inline |
Should rendering be gamma-correct, end-to-end.
Causes sRGB render targets to behave as such (with linear blending), and sRGB inputs to be filtered and decoded correctly.