SkPaint Class Reference

#include <SkPaint.h>

Collaboration diagram for SkPaint:
Collaboration graph
[legend]

List of all members.

Classes

struct  FontMetrics

Public Types

enum  Hinting { kNo_Hinting = 0, kSlight_Hinting = 1, kNormal_Hinting = 2, kFull_Hinting = 3 }
enum  Flags {
  kAntiAlias_Flag = 0x01, kFilterBitmap_Flag = 0x02, kDither_Flag = 0x04, kUnderlineText_Flag = 0x08,
  kStrikeThruText_Flag = 0x10, kFakeBoldText_Flag = 0x20, kLinearText_Flag = 0x40, kSubpixelText_Flag = 0x80,
  kDevKernText_Flag = 0x100, kLCDRenderText_Flag = 0x200, kAllFlags = 0x3FF
}
enum  Style { kFill_Style, kStroke_Style, kStrokeAndFill_Style, kStyleCount }
enum  Cap {
  kButt_Cap, kRound_Cap, kSquare_Cap, kCapCount,
  kDefault_Cap = kButt_Cap
}
enum  Join {
  kMiter_Join, kRound_Join, kBevel_Join, kJoinCount,
  kDefault_Join = kMiter_Join
}
enum  Align { kLeft_Align, kCenter_Align, kRight_Align, kAlignCount }
enum  TextEncoding { kUTF8_TextEncoding, kUTF16_TextEncoding, kGlyphID_TextEncoding }
enum  TextBufferDirection { kForward_TextBufferDirection, kBackward_TextBufferDirection }

Public Member Functions

 SkPaint ()
 SkPaint (const SkPaint &paint)
 ~SkPaint ()
SkPaintoperator= (const SkPaint &)
void flatten (SkFlattenableWriteBuffer &) const
void unflatten (SkFlattenableReadBuffer &)
void reset ()
Hinting getHinting () const
void setHinting (Hinting hintingLevel)
uint32_t getFlags () const
void setFlags (uint32_t flags)
bool isAntiAlias () const
void setAntiAlias (bool aa)
bool isDither () const
void setDither (bool dither)
bool isLinearText () const
void setLinearText (bool linearText)
bool isSubpixelText () const
void setSubpixelText (bool subpixelText)
bool isLCDRenderText () const
void setLCDRenderText (bool subpixelRender)
bool isUnderlineText () const
void setUnderlineText (bool underlineText)
bool isStrikeThruText () const
void setStrikeThruText (bool strikeThruText)
bool isFakeBoldText () const
void setFakeBoldText (bool fakeBoldText)
bool isDevKernText () const
void setDevKernText (bool devKernText)
bool isFilterBitmap () const
void setFilterBitmap (bool filterBitmap)
Style getStyle () const
void setStyle (Style style)
SkColor getColor () const
void setColor (SkColor color)
uint8_t getAlpha () const
void setAlpha (U8CPU a)
void setARGB (U8CPU a, U8CPU r, U8CPU g, U8CPU b)
SkScalar getStrokeWidth () const
void setStrokeWidth (SkScalar width)
SkScalar getStrokeMiter () const
void setStrokeMiter (SkScalar miter)
Cap getStrokeCap () const
void setStrokeCap (Cap cap)
Join getStrokeJoin () const
void setStrokeJoin (Join join)
bool getFillPath (const SkPath &src, SkPath *dst) const
bool canComputeFastBounds () const
const SkRectcomputeFastBounds (const SkRect &orig, SkRect *storage) const
SkShadergetShader () const
SkShadersetShader (SkShader *shader)
SkColorFiltergetColorFilter () const
SkColorFiltersetColorFilter (SkColorFilter *filter)
SkXfermodegetXfermode () const
SkXfermodesetXfermode (SkXfermode *xfermode)
SkXfermodesetXfermodeMode (SkXfermode::Mode)
SkPathEffectgetPathEffect () const
SkPathEffectsetPathEffect (SkPathEffect *effect)
SkMaskFiltergetMaskFilter () const
SkMaskFiltersetMaskFilter (SkMaskFilter *maskfilter)
SkTypefacegetTypeface () const
SkTypefacesetTypeface (SkTypeface *typeface)
SkRasterizergetRasterizer () const
SkRasterizersetRasterizer (SkRasterizer *rasterizer)
SkDrawLoopergetLooper () const
SkDrawLoopersetLooper (SkDrawLooper *)
Align getTextAlign () const
void setTextAlign (Align align)
SkScalar getTextSize () const
void setTextSize (SkScalar textSize)
SkScalar getTextScaleX () const
void setTextScaleX (SkScalar scaleX)
SkScalar getTextSkewX () const
void setTextSkewX (SkScalar skewX)
TextEncoding getTextEncoding () const
void setTextEncoding (TextEncoding encoding)
SkScalar getFontMetrics (FontMetrics *metrics, SkScalar scale=0) const
SkScalar getFontSpacing () const
int textToGlyphs (const void *text, size_t byteLength, uint16_t glyphs[]) const
int countText (const void *text, size_t byteLength) const
SkScalar measureText (const void *text, size_t length, SkRect *bounds, SkScalar scale=0) const
SkScalar measureText (const void *text, size_t length) const
size_t breakText (const void *text, size_t length, SkScalar maxWidth, SkScalar *measuredWidth=NULL, TextBufferDirection tbd=kForward_TextBufferDirection) const
int getTextWidths (const void *text, size_t byteLength, SkScalar widths[], SkRect bounds[]=NULL) const
void getTextPath (const void *text, size_t length, SkScalar x, SkScalar y, SkPath *path) const

Friends

class SkCanvas
class SkDraw
class SkAutoGlyphCache
class SkTextToPathIter
int operator== (const SkPaint &a, const SkPaint &b)
int operator!= (const SkPaint &a, const SkPaint &b)

Detailed Description

The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.

Definition at line 51 of file SkPaint.h.


Member Enumeration Documentation

Enumerator:
kLeft_Align 
kCenter_Align 
kRight_Align 
kAlignCount 

Definition at line 594 of file SkPaint.h.

Cap enum specifies the settings for the paint's strokecap. This is the treatment that is applied to the beginning and end of each non-closed contour (e.g. lines).

Enumerator:
kButt_Cap 

begin/end contours with no extension

kRound_Cap 

begin/end contours with a semi-circle extension

kSquare_Cap 

begin/end contours with a half square extension

kCapCount 
kDefault_Cap 

Definition at line 358 of file SkPaint.h.

Specifies the bit values that are stored in the paint's flags.

Enumerator:
kAntiAlias_Flag 

mask to enable antialiasing

kFilterBitmap_Flag 

mask to enable bitmap filtering

kDither_Flag 

mask to enable dithering

kUnderlineText_Flag 

mask to enable underline text

kStrikeThruText_Flag 

mask to enable strike-thru text

kFakeBoldText_Flag 

mask to enable fake-bold text

kLinearText_Flag 

mask to enable linear-text

kSubpixelText_Flag 

mask to enable subpixel text positioning

kDevKernText_Flag 

mask to enable device kerning text

kLCDRenderText_Flag 

mask to enable subpixel glyph renderering

kAllFlags 

Definition at line 101 of file SkPaint.h.

Specifies the level of hinting to be performed. These names are taken from the Gnome/Cairo names for the same. They are translated into Freetype concepts the same as in cairo-ft-font.c: kNo_Hinting -> FT_LOAD_NO_HINTING kSlight_Hinting -> FT_LOAD_TARGET_LIGHT kNormal_Hinting -> <default, no option> kFull_Hinting -> <same as kNormalHinting, unless we are rendering subpixel glyphs, in which case TARGET_LCD or TARGET_LCD_V is used>

Enumerator:
kNo_Hinting 
kSlight_Hinting 
kNormal_Hinting 

this is the default

kFull_Hinting 

Definition at line 82 of file SkPaint.h.

Join enum specifies the settings for the paint's strokejoin. This is the treatment that is applied to corners in paths and rectangles.

Enumerator:
kMiter_Join 

connect path segments with a sharp join

kRound_Join 

connect path segments with a round join

kBevel_Join 

connect path segments with a flat bevel join

kJoinCount 
kDefault_Join 

Definition at line 370 of file SkPaint.h.

Styles apply to rect, oval, path, and text. Bitmaps are always drawn in "fill", and lines are always drawn in "stroke".

Note: strokeandfill implicitly draws the result with SkPath::kWinding_FillType, so if the original path is even-odd, the results may not appear the same as if it was drawn twice, filled and then stroked.

Enumerator:
kFill_Style 

fill the geometry

kStroke_Style 

stroke the geometry

kStrokeAndFill_Style 

fill and stroke the geometry

kStyleCount 

Definition at line 265 of file SkPaint.h.

Specify the direction the text buffer should be processed in breakText()

Enumerator:
kForward_TextBufferDirection 

When measuring text for breakText(), begin at the start of the text buffer and proceed forward through the data. This is the default.

kBackward_TextBufferDirection 

When measuring text for breakText(), begin at the end of the text buffer and proceed backwards through the data.

Definition at line 733 of file SkPaint.h.

Describes how to interpret the text parameters that are passed to paint methods like measureText() and getTextWidths().

Enumerator:
kUTF8_TextEncoding 

the text parameters are UTF8

kUTF16_TextEncoding 

the text parameters are UTF16

kGlyphID_TextEncoding 

the text parameters are glyph indices

Definition at line 649 of file SkPaint.h.


Constructor & Destructor Documentation

SkPaint::SkPaint (  ) 
SkPaint::SkPaint ( const SkPaint paint  ) 
SkPaint::~SkPaint (  ) 

Member Function Documentation

size_t SkPaint::breakText ( const void *  text,
size_t  length,
SkScalar  maxWidth,
SkScalar measuredWidth = NULL,
TextBufferDirection  tbd = kForward_TextBufferDirection 
) const

Return the width of the text.

Parameters:
text The text to be measured
length Number of bytes of text to measure
maxWidth Maximum width. Only the subset of text whose accumulated widths are <= maxWidth are measured.
measuredWidth Optional. If non-null, this returns the actual width of the measured text.
tbd Optional. The direction the text buffer should be traversed during measuring.
Returns:
The number of bytes of text that were measured. Will be <= length.
bool SkPaint::canComputeFastBounds (  )  const [inline]

Returns true if the current paint settings allow for fast computation of bounds (i.e. there is nothing complex like a patheffect that would make the bounds computation expensive.

Definition at line 419 of file SkPaint.h.

const SkRect& SkPaint::computeFastBounds ( const SkRect orig,
SkRect storage 
) const [inline]

Only call this if canComputeFastBounds() returned true. This takes a raw rectangle (the raw bounds of a shape), and adjusts it for stylistic effects in the paint (e.g. stroking). If needed, it uses the storage rect parameter. It returns the adjusted bounds that can then be used for quickReject tests.

The returned rect will either be orig or storage, thus the caller should not rely on storage being set to the result, but should always use the retured value. It is legal for orig and storage to be the same rect.

e.g. if (paint.canComputeFastBounds()) { SkRect r, storage; path.computeBounds(&r, SkPath::kFast_BoundsType); const SkRect& fastR = paint.computeFastBounds(r, &storage); if (canvas->quickReject(fastR, ...)) { don't draw the path } }

Definition at line 448 of file SkPaint.h.

int SkPaint::countText ( const void *  text,
size_t  byteLength 
) const [inline]

Return the number of drawable units in the specified text buffer. This looks at the current TextEncoding field of the paint. If you also want to have the text converted into glyph IDs, call textToGlyphs instead.

Definition at line 704 of file SkPaint.h.

void SkPaint::flatten ( SkFlattenableWriteBuffer  )  const
uint8_t SkPaint::getAlpha (  )  const [inline]

Helper to getColor() that just returns the color's alpha value.

Returns:
the alpha component of the paint's color.

Definition at line 305 of file SkPaint.h.

SkColor SkPaint::getColor (  )  const [inline]

Return the paint's color. Note that the color is a 32bit value containing alpha as well as r,g,b. This 32bit value is not premultiplied, meaning that its alpha can be any value, regardless of the values of r,g,b.

Returns:
the paint's color (and alpha).

Definition at line 293 of file SkPaint.h.

SkColorFilter* SkPaint::getColorFilter (  )  const [inline]

Get the paint's colorfilter. If there is a colorfilter, its reference count is not changed.

Returns:
the paint's colorfilter (or NULL)

Definition at line 475 of file SkPaint.h.

bool SkPaint::getFillPath ( const SkPath src,
SkPath dst 
) const

Applies any/all effects (patheffect, stroking) to src, returning the result in dst. The result is that drawing src with this paint will be the same as drawing dst with a default paint (at least from the geometric perspective).

Parameters:
src input path
dst output path (may be the same as src)
Returns:
true if the path should be filled, or false if it should be drawn with a hairline (width == 0)
uint32_t SkPaint::getFlags (  )  const [inline]

Return the paint's flags. Use the Flag enum to test flag values.

Returns:
the paint's flags (see enums ending in _Flag for bit masks)

Definition at line 121 of file SkPaint.h.

SkScalar SkPaint::getFontMetrics ( FontMetrics metrics,
SkScalar  scale = 0 
) const

Return the recommend spacing between lines (which will be fDescent - fAscent + fLeading). If metrics is not null, return in it the font metrics for the typeface/pointsize/etc. currently set in the paint.

Parameters:
metrics If not null, returns the font metrics for the current typeface/pointsize/etc setting in this paint.
scale If not 0, return width as if the canvas were scaled by this value
return the recommended spacing between lines
SkScalar SkPaint::getFontSpacing (  )  const [inline]

Return the recommend line spacing. This will be fDescent - fAscent + fLeading

Definition at line 690 of file SkPaint.h.

Hinting SkPaint::getHinting (  )  const [inline]

Definition at line 89 of file SkPaint.h.

SkDrawLooper* SkPaint::getLooper (  )  const [inline]

Definition at line 591 of file SkPaint.h.

SkMaskFilter* SkPaint::getMaskFilter (  )  const [inline]

Get the paint's maskfilter object.

The maskfilter reference count is not affected.

Returns:
the paint's maskfilter (or NULL)

Definition at line 535 of file SkPaint.h.

SkPathEffect* SkPaint::getPathEffect (  )  const [inline]

Get the paint's patheffect object.

The patheffect reference count is not affected.

Returns:
the paint's patheffect (or NULL)

Definition at line 516 of file SkPaint.h.

SkRasterizer* SkPaint::getRasterizer (  )  const [inline]

Get the paint's rasterizer (or NULL).

The raster controls how paths/text are turned into alpha masks.

Returns:
the paint's rasterizer (or NULL)

Definition at line 576 of file SkPaint.h.

SkShader* SkPaint::getShader (  )  const [inline]

Get the paint's shader object.

The shader's reference count is not affected.

Returns:
the paint's shader (or NULL)

Definition at line 458 of file SkPaint.h.

Cap SkPaint::getStrokeCap (  )  const [inline]

Return the paint's stroke cap type, controlling how the start and end of stroked lines and paths are treated.

Returns:
the line cap style for the paint, used whenever the paint's style is Stroke or StrokeAndFill.

Definition at line 384 of file SkPaint.h.

Join SkPaint::getStrokeJoin (  )  const [inline]

Return the paint's stroke join type.

Returns:
the paint's line join style, used whenever the paint's style is Stroke or StrokeAndFill.

Definition at line 396 of file SkPaint.h.

SkScalar SkPaint::getStrokeMiter (  )  const [inline]

Return the paint's stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp.

Returns:
the paint's miter limit, used whenever the paint's style is Stroke or StrokeAndFill.

Definition at line 344 of file SkPaint.h.

SkScalar SkPaint::getStrokeWidth (  )  const [inline]

Return the width for stroking.

A value of 0 strokes in hairline mode. Hairlines always draw 1-pixel wide, regardless of the matrix.

Returns:
the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill.

Definition at line 329 of file SkPaint.h.

Style SkPaint::getStyle (  )  const [inline]

Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes kFill_Style).

Returns:
the paint's Style

Definition at line 278 of file SkPaint.h.

Align SkPaint::getTextAlign (  )  const [inline]

Return the paint's Align value for drawing text.

Returns:
the paint's Align value for drawing text.

Definition at line 604 of file SkPaint.h.

TextEncoding SkPaint::getTextEncoding (  )  const [inline]

Definition at line 655 of file SkPaint.h.

void SkPaint::getTextPath ( const void *  text,
size_t  length,
SkScalar  x,
SkScalar  y,
SkPath path 
) const

Return the path (outline) for the specified text. Note: just like SkCanvas::drawText, this will respect the Align setting in the paint.

SkScalar SkPaint::getTextScaleX (  )  const [inline]

Return the paint's horizontal scale factor for text. The default value is 1.0.

Returns:
the paint's scale factor in X for drawing/measuring text

Definition at line 624 of file SkPaint.h.

SkScalar SkPaint::getTextSize (  )  const [inline]

Return the paint's text size.

Returns:
the paint's text size.

Definition at line 613 of file SkPaint.h.

SkScalar SkPaint::getTextSkewX (  )  const [inline]

Return the paint's horizontal skew factor for text. The default value is 0.

Returns:
the paint's skew factor in X for drawing text.

Definition at line 638 of file SkPaint.h.

int SkPaint::getTextWidths ( const void *  text,
size_t  byteLength,
SkScalar  widths[],
SkRect  bounds[] = NULL 
) const

Return the advance widths for the characters in the string.

Parameters:
text the text
byteLength number of bytes to of text
widths If not null, returns the array of advance widths of the glyphs. If not NULL, must be at least a large as the number of unichars in the specified text.
bounds If not null, returns the bounds for each of character, relative to (0, 0)
Returns:
the number of unichars in the specified text.
SkTypeface* SkPaint::getTypeface (  )  const [inline]

Get the paint's typeface object.

The typeface object identifies which font to use when drawing or measuring text. The typeface reference count is not affected.

Returns:
the paint's typeface (or NULL)

Definition at line 557 of file SkPaint.h.

SkXfermode* SkPaint::getXfermode (  )  const [inline]

Get the paint's xfermode object.

The xfermode's reference count is not affected.

Returns:
the paint's xfermode (or NULL)

Definition at line 491 of file SkPaint.h.

bool SkPaint::isAntiAlias (  )  const [inline]

Helper for getFlags(), returning true if kAntiAlias_Flag bit is set

Returns:
true if the antialias bit is set in the paint's flags.

Definition at line 131 of file SkPaint.h.

bool SkPaint::isDevKernText (  )  const [inline]

Helper for getFlags(), returns true if kDevKernText_Flag bit is set

Returns:
true if the kernText bit is set in the paint's flags.

Definition at line 238 of file SkPaint.h.

bool SkPaint::isDither (  )  const [inline]

Helper for getFlags(), returning true if kDither_Flag bit is set

Returns:
true if the dithering bit is set in the paint's flags.

Definition at line 144 of file SkPaint.h.

bool SkPaint::isFakeBoldText (  )  const [inline]

Helper for getFlags(), returns true if kFakeBoldText_Flag bit is set

Returns:
true if the kFakeBoldText_Flag bit is set in the paint's flags.

Definition at line 224 of file SkPaint.h.

bool SkPaint::isFilterBitmap (  )  const [inline]

Definition at line 249 of file SkPaint.h.

bool SkPaint::isLCDRenderText (  )  const [inline]

Definition at line 182 of file SkPaint.h.

bool SkPaint::isLinearText (  )  const [inline]

Helper for getFlags(), returning true if kLinearText_Flag bit is set

Returns:
true if the lineartext bit is set in the paint's flags

Definition at line 157 of file SkPaint.h.

bool SkPaint::isStrikeThruText (  )  const [inline]

Helper for getFlags(), returns true if kStrikeThruText_Flag bit is set

Returns:
true if the strikeThruText bit is set in the paint's flags.

Definition at line 210 of file SkPaint.h.

bool SkPaint::isSubpixelText (  )  const [inline]

Helper for getFlags(), returning true if kSubpixelText_Flag bit is set

Returns:
true if the lineartext bit is set in the paint's flags

Definition at line 171 of file SkPaint.h.

bool SkPaint::isUnderlineText (  )  const [inline]

Helper for getFlags(), returning true if kUnderlineText_Flag bit is set

Returns:
true if the underlineText bit is set in the paint's flags.

Definition at line 196 of file SkPaint.h.

SkScalar SkPaint::measureText ( const void *  text,
size_t  length 
) const [inline]

Return the width of the text.

Parameters:
text Address of the text
length Number of bytes of text to measure
Returns:
The width of the text

Definition at line 726 of file SkPaint.h.

SkScalar SkPaint::measureText ( const void *  text,
size_t  length,
SkRect bounds,
SkScalar  scale = 0 
) const

Return the width of the text.

Parameters:
text The text to be measured
length Number of bytes of text to measure
bounds If not NULL, returns the bounds of the text, relative to (0, 0).
scale If not 0, return width as if the canvas were scaled by this value
Returns:
The advance width of the text
SkPaint& SkPaint::operator= ( const SkPaint  ) 
void SkPaint::reset (  ) 

Restores the paint to its initial settings.

void SkPaint::setAlpha ( U8CPU  a  ) 

Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged.

Parameters:
a set the alpha component (0..255) of the paint's color.
void SkPaint::setAntiAlias ( bool  aa  ) 

Helper for setFlags(), setting or clearing the kAntiAlias_Flag bit

Parameters:
aa true to enable antialiasing, false to disable it
void SkPaint::setARGB ( U8CPU  a,
U8CPU  r,
U8CPU  g,
U8CPU  b 
)

Helper to setColor(), that takes a,r,g,b and constructs the color value using SkColorSetARGB()

Parameters:
a The new alpha component (0..255) of the paint's color.
r The new red component (0..255) of the paint's color.
g The new green component (0..255) of the paint's color.
b The new blue component (0..255) of the paint's color.
void SkPaint::setColor ( SkColor  color  ) 

Set the paint's color. Note that the color is a 32bit value containing alpha as well as r,g,b. This 32bit value is not premultiplied, meaning that its alpha can be any value, regardless of the values of r,g,b.

Parameters:
color The new color (including alpha) to set in the paint.
SkColorFilter* SkPaint::setColorFilter ( SkColorFilter filter  ) 

Set or clear the paint's colorfilter, returning the parameter.

If the paint already has a filter, its reference count is decremented. If filter is not NULL, its reference count is incremented.

Parameters:
filter May be NULL. The filter to be installed in the paint
Returns:
filter
void SkPaint::setDevKernText ( bool  devKernText  ) 

Helper for setFlags(), setting or clearing the kKernText_Flag bit

Parameters:
kernText true to set the kKernText_Flag bit in the paint's flags, false to clear it.
void SkPaint::setDither ( bool  dither  ) 

Helper for setFlags(), setting or clearing the kDither_Flag bit

Parameters:
dither true to enable dithering, false to disable it
void SkPaint::setFakeBoldText ( bool  fakeBoldText  ) 

Helper for setFlags(), setting or clearing the kFakeBoldText_Flag bit

Parameters:
fakeBoldText true to set the kFakeBoldText_Flag bit in the paint's flags, false to clear it.
void SkPaint::setFilterBitmap ( bool  filterBitmap  ) 
void SkPaint::setFlags ( uint32_t  flags  ) 

Set the paint's flags. Use the Flag enum to specific flag values.

Parameters:
flags The new flag bits for the paint (see Flags enum)
void SkPaint::setHinting ( Hinting  hintingLevel  )  [inline]

Definition at line 94 of file SkPaint.h.

void SkPaint::setLCDRenderText ( bool  subpixelRender  ) 

Helper for setFlags(), setting or clearing the kLCDRenderText_Flag bit

Parameters:
subpixelRender true to set the subpixelRenderText bit in the paint's flags, false to clear it.
void SkPaint::setLinearText ( bool  linearText  ) 

Helper for setFlags(), setting or clearing the kLinearText_Flag bit

Parameters:
linearText true to set the linearText bit in the paint's flags, false to clear it.
SkDrawLooper* SkPaint::setLooper ( SkDrawLooper  ) 
SkMaskFilter* SkPaint::setMaskFilter ( SkMaskFilter maskfilter  ) 

Set or clear the maskfilter object.

Pass NULL to clear any previous maskfilter. As a convenience, the parameter passed is also returned. If a previous maskfilter exists, its reference count is decremented. If maskfilter is not NULL, its reference count is incremented.

Parameters:
maskfilter May be NULL. The new maskfilter to be installed in the paint
Returns:
maskfilter
SkPathEffect* SkPaint::setPathEffect ( SkPathEffect effect  ) 

Set or clear the patheffect object.

Pass NULL to clear any previous patheffect. As a convenience, the parameter passed is also returned. If a previous patheffect exists, its reference count is decremented. If patheffect is not NULL, its reference count is incremented.

Parameters:
effect May be NULL. The new patheffect to be installed in the paint
Returns:
effect
SkRasterizer* SkPaint::setRasterizer ( SkRasterizer rasterizer  ) 

Set or clear the rasterizer object.

Pass NULL to clear any previous rasterizer. As a convenience, the parameter passed is also returned. If a previous rasterizer exists in the paint, its reference count is decremented. If rasterizer is not NULL, its reference count is incremented.

Parameters:
rasterizer May be NULL. The new rasterizer to be installed in the paint.
Returns:
rasterizer
SkShader* SkPaint::setShader ( SkShader shader  ) 

Set or clear the shader object.

Pass NULL to clear any previous shader. As a convenience, the parameter passed is also returned. If a previous shader exists, its reference count is decremented. If shader is not NULL, its reference count is incremented.

Parameters:
shader May be NULL. The shader to be installed in the paint
Returns:
shader
void SkPaint::setStrikeThruText ( bool  strikeThruText  ) 

Helper for setFlags(), setting or clearing the kStrikeThruText_Flag bit

Parameters:
strikeThruText true to set the strikeThruText bit in the paint's flags, false to clear it.
void SkPaint::setStrokeCap ( Cap  cap  ) 

Set the paint's stroke cap type.

Parameters:
cap set the paint's line cap style, used whenever the paint's style is Stroke or StrokeAndFill.
void SkPaint::setStrokeJoin ( Join  join  ) 

Set the paint's stroke join type.

Parameters:
join set the paint's line join style, used whenever the paint's style is Stroke or StrokeAndFill.
void SkPaint::setStrokeMiter ( SkScalar  miter  ) 

Set the paint's stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp. This value must be >= 0.

Parameters:
miter set the miter limit on the paint, used whenever the paint's style is Stroke or StrokeAndFill.
void SkPaint::setStrokeWidth ( SkScalar  width  ) 

Set the width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draw 1-pixel wide, regardless of the matrix.

Parameters:
width set the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill.
void SkPaint::setStyle ( Style  style  ) 

Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill).

Parameters:
style The new style to set in the paint
void SkPaint::setSubpixelText ( bool  subpixelText  ) 

Helper for setFlags(), setting or clearing the kSubpixelText_Flag bit

Parameters:
subpixelText true to set the subpixelText bit in the paint's flags, false to clear it.
void SkPaint::setTextAlign ( Align  align  ) 

Set the paint's text alignment.

Parameters:
align set the paint's Align value for drawing text.
void SkPaint::setTextEncoding ( TextEncoding  encoding  ) 
void SkPaint::setTextScaleX ( SkScalar  scaleX  ) 

Set the paint's horizontal scale factor for text. The default value is 1.0. Values > 1.0 will stretch the text wider. Values < 1.0 will stretch the text narrower.

Parameters:
scaleX set the paint's scale factor in X for drawing/measuring text.
void SkPaint::setTextSize ( SkScalar  textSize  ) 

Set the paint's text size. This value must be > 0

Parameters:
textSize set the paint's text size.
void SkPaint::setTextSkewX ( SkScalar  skewX  ) 

Set the paint's horizontal skew factor for text. The default value is 0. For approximating oblique text, use values around -0.25.

Parameters:
skewX set the paint's skew factor in X for drawing text.
SkTypeface* SkPaint::setTypeface ( SkTypeface typeface  ) 

Set or clear the typeface object.

Pass NULL to clear any previous typeface. As a convenience, the parameter passed is also returned. If a previous typeface exists, its reference count is decremented. If typeface is not NULL, its reference count is incremented.

Parameters:
typeface May be NULL. The new typeface to be installed in the paint
Returns:
typeface
void SkPaint::setUnderlineText ( bool  underlineText  ) 

Helper for setFlags(), setting or clearing the kUnderlineText_Flag bit

Parameters:
underlineText true to set the underlineText bit in the paint's flags, false to clear it.
SkXfermode* SkPaint::setXfermode ( SkXfermode xfermode  ) 

Set or clear the xfermode object.

Pass NULL to clear any previous xfermode. As a convenience, the parameter passed is also returned. If a previous xfermode exists, its reference count is decremented. If xfermode is not NULL, its reference count is incremented.

Parameters:
xfermode May be NULL. The new xfermode to be installed in the paint
Returns:
xfermode
SkXfermode* SkPaint::setXfermodeMode ( SkXfermode::Mode   ) 

Create an xfermode based on the specified Mode, and assign it into the paint, returning the mode that was set. If the Mode is SrcOver, then the paint's xfermode is set to null.

int SkPaint::textToGlyphs ( const void *  text,
size_t  byteLength,
uint16_t  glyphs[] 
) const

Convert the specified text into glyph IDs, returning the number of glyphs ID written. If glyphs is NULL, it is ignore and only the count is returned.

void SkPaint::unflatten ( SkFlattenableReadBuffer  ) 

Friends And Related Function Documentation

int operator!= ( const SkPaint a,
const SkPaint b 
) [friend]

Definition at line 60 of file SkPaint.h.

int operator== ( const SkPaint a,
const SkPaint b 
) [friend]
friend class SkAutoGlyphCache [friend]

Definition at line 827 of file SkPaint.h.

friend class SkCanvas [friend]

Definition at line 825 of file SkPaint.h.

friend class SkDraw [friend]

Definition at line 826 of file SkPaint.h.

friend class SkTextToPathIter [friend]

Definition at line 828 of file SkPaint.h.


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

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1