Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkPaint.h
1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkPaint_DEFINED
9 #define SkPaint_DEFINED
10 
11 #include "SkBlendMode.h"
12 #include "SkColor.h"
13 #include "SkFilterQuality.h"
14 #include "SkMatrix.h"
15 #include "SkRefCnt.h"
16 
17 class SkAutoDescriptor;
18 class SkAutoGlyphCache;
19 class SkColorFilter;
20 class SkData;
21 class SkDescriptor;
22 class SkDrawLooper;
23 class SkReadBuffer;
24 class SkWriteBuffer;
25 class SkGlyph;
26 struct SkRect;
27 class SkGlyphCache;
28 class SkImageFilter;
29 class SkMaskFilter;
30 class SkPath;
31 class SkPathEffect;
32 struct SkPoint;
33 class SkRasterizer;
34 struct SkScalerContextEffects;
35 class SkShader;
36 class SkSurfaceProps;
37 class SkTextBlob;
38 class SkTypeface;
39 
45 class SK_API SkPaint {
46 public:
47  SkPaint();
48  SkPaint(const SkPaint& paint);
49  SkPaint(SkPaint&& paint);
50  ~SkPaint();
51 
52  SkPaint& operator=(const SkPaint& paint);
53  SkPaint& operator=(SkPaint&& paint);
54 
59  // cc_unittests requires SK_API to make operator== visible
60  SK_API friend bool operator==(const SkPaint& a, const SkPaint& b);
61  friend bool operator!=(const SkPaint& a, const SkPaint& b) {
62  return !(a == b);
63  }
64 
68  uint32_t getHash() const;
69 
70  void flatten(SkWriteBuffer& buffer) const;
71  void unflatten(SkReadBuffer& buffer);
72 
75  void reset();
76 
87  enum Hinting {
88  kNo_Hinting = 0,
89  kSlight_Hinting = 1,
90  kNormal_Hinting = 2,
91  kFull_Hinting = 3
92  };
93 
94  Hinting getHinting() const {
95  return static_cast<Hinting>(fBitfields.fHinting);
96  }
97 
98  void setHinting(Hinting hintingLevel);
99 
102  enum Flags {
103  kAntiAlias_Flag = 0x01,
104  kDither_Flag = 0x04,
105  kFakeBoldText_Flag = 0x20,
106  kLinearText_Flag = 0x40,
107  kSubpixelText_Flag = 0x80,
108  kDevKernText_Flag = 0x100,
109  kLCDRenderText_Flag = 0x200,
110  kEmbeddedBitmapText_Flag = 0x400,
111  kAutoHinting_Flag = 0x800,
112  kVerticalText_Flag = 0x1000,
113  kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
114  // when adding extra flags, note that the fFlags member is specified
115  // with a bit-width and you'll have to expand it.
116 
117  kAllFlags = 0xFFFF,
118  };
119 
120 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
121  enum ReserveFlags {
122  // These are not used by paint, but the bits are reserved for private use by the
123  // android framework.
124  kUnderlineText_ReserveFlag = 0x08,
125  kStrikeThruText_ReserveFlag = 0x10,
126  };
127 #endif
128 
132  uint32_t getFlags() const { return fBitfields.fFlags; }
133 
137  void setFlags(uint32_t flags);
138 
142  bool isAntiAlias() const {
143  return SkToBool(this->getFlags() & kAntiAlias_Flag);
144  }
145 
149  void setAntiAlias(bool aa);
150 
154  bool isDither() const {
155  return SkToBool(this->getFlags() & kDither_Flag);
156  }
157 
164  void setDither(bool dither);
165 
169  bool isLinearText() const {
170  return SkToBool(this->getFlags() & kLinearText_Flag);
171  }
172 
177  void setLinearText(bool linearText);
178 
182  bool isSubpixelText() const {
183  return SkToBool(this->getFlags() & kSubpixelText_Flag);
184  }
185 
191  void setSubpixelText(bool subpixelText);
192 
193  bool isLCDRenderText() const {
194  return SkToBool(this->getFlags() & kLCDRenderText_Flag);
195  }
196 
203  void setLCDRenderText(bool lcdText);
204 
205  bool isEmbeddedBitmapText() const {
206  return SkToBool(this->getFlags() & kEmbeddedBitmapText_Flag);
207  }
208 
213  void setEmbeddedBitmapText(bool useEmbeddedBitmapText);
214 
215  bool isAutohinted() const {
216  return SkToBool(this->getFlags() & kAutoHinting_Flag);
217  }
218 
224  void setAutohinted(bool useAutohinter);
225 
226  bool isVerticalText() const {
227  return SkToBool(this->getFlags() & kVerticalText_Flag);
228  }
229 
238  void setVerticalText(bool verticalText);
239 
243  bool isFakeBoldText() const {
244  return SkToBool(this->getFlags() & kFakeBoldText_Flag);
245  }
246 
251  void setFakeBoldText(bool fakeBoldText);
252 
256  bool isDevKernText() const {
257  return SkToBool(this->getFlags() & kDevKernText_Flag);
258  }
259 
264  void setDevKernText(bool devKernText);
265 
270  SkFilterQuality getFilterQuality() const {
271  return (SkFilterQuality)fBitfields.fFilterQuality;
272  }
273 
278  void setFilterQuality(SkFilterQuality quality);
279 
289  enum Style {
293  };
294  enum {
295  kStyleCount = kStrokeAndFill_Style + 1
296  };
297 
303  Style getStyle() const { return (Style)fBitfields.fStyle; }
304 
310  void setStyle(Style style);
311 
318  SkColor getColor() const { return fColor; }
319 
325  void setColor(SkColor color);
326 
330  uint8_t getAlpha() const { return SkToU8(SkColorGetA(fColor)); }
331 
336  void setAlpha(U8CPU a);
337 
345  void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
346 
354  SkScalar getStrokeWidth() const { return fWidth; }
355 
362  void setStrokeWidth(SkScalar width);
363 
369  SkScalar getStrokeMiter() const { return fMiterLimit; }
370 
377  void setStrokeMiter(SkScalar miter);
378 
392  enum Cap {
396 
397  kLast_Cap = kSquare_Cap,
398  kDefault_Cap = kButt_Cap
399  };
400  static constexpr int kCapCount = kLast_Cap + 1;
401 
405  enum Join {
409 
410  kLast_Join = kBevel_Join,
411  kDefault_Join = kMiter_Join
412  };
413  static constexpr int kJoinCount = kLast_Join + 1;
414 
420  Cap getStrokeCap() const { return (Cap)fBitfields.fCapType; }
421 
426  void setStrokeCap(Cap cap);
427 
432  Join getStrokeJoin() const { return (Join)fBitfields.fJoinType; }
433 
438  void setStrokeJoin(Join join);
439 
454  bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect,
455  SkScalar resScale = 1) const;
456 
457  bool getFillPath(const SkPath& src, SkPath* dst) const {
458  return this->getFillPath(src, dst, NULL, 1);
459  }
460 
466  SkShader* getShader() const { return fShader.get(); }
467  sk_sp<SkShader> refShader() const;
468 
489  void setShader(sk_sp<SkShader> shader);
490 
495  SkColorFilter* getColorFilter() const { return fColorFilter.get(); }
496  sk_sp<SkColorFilter> refColorFilter() const;
497 
504  void setColorFilter(sk_sp<SkColorFilter> colorFilter);
505 
506  SkBlendMode getBlendMode() const { return (SkBlendMode)fBlendMode; }
507  bool isSrcOver() const { return (SkBlendMode)fBlendMode == SkBlendMode::kSrcOver; }
508  void setBlendMode(SkBlendMode mode) { fBlendMode = (unsigned)mode; }
509 
515  SkPathEffect* getPathEffect() const { return fPathEffect.get(); }
516  sk_sp<SkPathEffect> refPathEffect() const;
517 
528  void setPathEffect(sk_sp<SkPathEffect> pathEffect);
529 
535  SkMaskFilter* getMaskFilter() const { return fMaskFilter.get(); }
536  sk_sp<SkMaskFilter> refMaskFilter() const;
537 
548  void setMaskFilter(sk_sp<SkMaskFilter> maskFilter);
549 
550  // These attributes are for text/fonts
551 
558  SkTypeface* getTypeface() const { return fTypeface.get(); }
559  sk_sp<SkTypeface> refTypeface() const;
560 
571  void setTypeface(sk_sp<SkTypeface> typeface);
572 
578  SkRasterizer* getRasterizer() const { return fRasterizer.get(); }
579  sk_sp<SkRasterizer> refRasterizer() const;
580 
592  void setRasterizer(sk_sp<SkRasterizer> rasterizer);
593 
594  SkImageFilter* getImageFilter() const { return fImageFilter.get(); }
595  sk_sp<SkImageFilter> refImageFilter() const;
596  void setImageFilter(sk_sp<SkImageFilter> imageFilter);
597 
602  SkDrawLooper* getDrawLooper() const { return fDrawLooper.get(); }
603  sk_sp<SkDrawLooper> refDrawLooper() const;
604 
605  SkDrawLooper* getLooper() const { return fDrawLooper.get(); }
615  void setDrawLooper(sk_sp<SkDrawLooper> drawLooper);
616 
617  void setLooper(sk_sp<SkDrawLooper> drawLooper);
618 
619  enum Align {
620  kLeft_Align,
621  kCenter_Align,
622  kRight_Align,
623  };
624  enum {
625  kAlignCount = 3
626  };
627 
631  Align getTextAlign() const { return (Align)fBitfields.fTextAlign; }
632 
636  void setTextAlign(Align align);
637 
641  SkScalar getTextSize() const { return fTextSize; }
642 
646  void setTextSize(SkScalar textSize);
647 
652  SkScalar getTextScaleX() const { return fTextScaleX; }
653 
660  void setTextScaleX(SkScalar scaleX);
661 
666  SkScalar getTextSkewX() const { return fTextSkewX; }
667 
672  void setTextSkewX(SkScalar skewX);
673 
681  kGlyphID_TextEncoding
682  };
683 
684  TextEncoding getTextEncoding() const {
685  return (TextEncoding)fBitfields.fTextEncoding;
686  }
687 
688  void setTextEncoding(TextEncoding encoding);
689 
690  struct FontMetrics {
695  kUnderlineThicknessIsValid_Flag = 1 << 0,
696  kUnderlinePositionIsValid_Flag = 1 << 1,
697  };
698 
699  uint32_t fFlags;
700  SkScalar fTop;
701  SkScalar fAscent;
702  SkScalar fDescent;
703  SkScalar fBottom;
704  SkScalar fLeading;
705  SkScalar fAvgCharWidth;
706  SkScalar fMaxCharWidth;
707  SkScalar fXMin;
708  SkScalar fXMax;
709  SkScalar fXHeight;
710  SkScalar fCapHeight;
712 
720 
725  bool hasUnderlineThickness(SkScalar* thickness) const {
726  if (SkToBool(fFlags & kUnderlineThicknessIsValid_Flag)) {
727  *thickness = fUnderlineThickness;
728  return true;
729  }
730  return false;
731  }
732 
737  bool hasUnderlinePosition(SkScalar* position) const {
738  if (SkToBool(fFlags & kUnderlinePositionIsValid_Flag)) {
739  *position = fUnderlinePosition;
740  return true;
741  }
742  return false;
743  }
744 
745  };
746 
758  SkScalar getFontMetrics(FontMetrics* metrics, SkScalar scale = 0) const;
759 
763  SkScalar getFontSpacing() const { return this->getFontMetrics(NULL, 0); }
764 
769  int textToGlyphs(const void* text, size_t byteLength,
770  SkGlyphID glyphs[]) const;
771 
779  bool containsText(const void* text, size_t byteLength) const;
780 
785  void glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar text[]) const;
786 
792  int countText(const void* text, size_t byteLength) const {
793  return this->textToGlyphs(text, byteLength, NULL);
794  }
795 
806  SkScalar measureText(const void* text, size_t length, SkRect* bounds) const;
807 
816  SkScalar measureText(const void* text, size_t length) const {
817  return this->measureText(text, length, NULL);
818  }
819 
833  size_t breakText(const void* text, size_t length, SkScalar maxWidth,
834  SkScalar* measuredWidth = NULL) const;
835 
848  int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
849  SkRect bounds[] = NULL) const;
850 
861  void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
862  SkPath* path) const;
863 
873  void getPosTextPath(const void* text, size_t length,
874  const SkPoint pos[], SkPath* path) const;
875 
892  int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
893  const SkScalar bounds[2], SkScalar* intervals) const;
894 
910  int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[],
911  const SkScalar bounds[2], SkScalar* intervals) const;
912 
929  int getPosTextHIntercepts(const void* text, size_t length, const SkScalar xpos[],
930  SkScalar constY, const SkScalar bounds[2], SkScalar* intervals) const;
931 
944  int getTextBlobIntercepts(const SkTextBlob* blob, const SkScalar bounds[2],
945  SkScalar* intervals) const;
946 
953  SkRect getFontBounds() const;
954 
955  // returns true if the paint's settings (e.g. xfermode + alpha) resolve to
956  // mean that we need not draw at all (e.g. SrcOver + 0-alpha)
957  bool nothingToDraw() const;
958 
960  // would prefer to make these private...
961 
966  bool canComputeFastBounds() const;
967 
989  const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const {
990  // Things like stroking, etc... will do math on the bounds rect, assuming that it's sorted.
991  SkASSERT(orig.isSorted());
992  SkPaint::Style style = this->getStyle();
993  // ultra fast-case: filling with no effects that affect geometry
994  if (kFill_Style == style) {
995  uintptr_t effects = reinterpret_cast<uintptr_t>(this->getLooper());
996  effects |= reinterpret_cast<uintptr_t>(this->getMaskFilter());
997  effects |= reinterpret_cast<uintptr_t>(this->getPathEffect());
998  effects |= reinterpret_cast<uintptr_t>(this->getImageFilter());
999  if (!effects) {
1000  return orig;
1001  }
1002  }
1003 
1004  return this->doComputeFastBounds(orig, storage, style);
1005  }
1006 
1007  const SkRect& computeFastStrokeBounds(const SkRect& orig,
1008  SkRect* storage) const {
1009  return this->doComputeFastBounds(orig, storage, kStroke_Style);
1010  }
1011 
1012  // Take the style explicitly, so the caller can force us to be stroked
1013  // without having to make a copy of the paint just to change that field.
1014  const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
1015  Style style) const;
1016 
1017 
1018 
1019  SK_TO_STRING_NONVIRT()
1020 
1021 private:
1022  typedef const SkGlyph& (*GlyphCacheProc)(SkGlyphCache*, const char**);
1023 
1024  sk_sp<SkTypeface> fTypeface;
1025  sk_sp<SkPathEffect> fPathEffect;
1026  sk_sp<SkShader> fShader;
1027  sk_sp<SkMaskFilter> fMaskFilter;
1028  sk_sp<SkColorFilter> fColorFilter;
1029  sk_sp<SkRasterizer> fRasterizer;
1030  sk_sp<SkDrawLooper> fDrawLooper;
1031  sk_sp<SkImageFilter> fImageFilter;
1032 
1033  SkScalar fTextSize;
1034  SkScalar fTextScaleX;
1035  SkScalar fTextSkewX;
1036  SkColor fColor;
1037  SkScalar fWidth;
1038  SkScalar fMiterLimit;
1039  uint32_t fBlendMode; // just need 5-6 bits
1040  union {
1041  struct {
1042  // all of these bitfields should add up to 32
1043  unsigned fFlags : 16;
1044  unsigned fTextAlign : 2;
1045  unsigned fCapType : 2;
1046  unsigned fJoinType : 2;
1047  unsigned fStyle : 2;
1048  unsigned fTextEncoding : 2; // 3 values
1049  unsigned fHinting : 2;
1050  unsigned fFilterQuality : 2;
1051  //unsigned fFreeBits : 2;
1052  } fBitfields;
1053  uint32_t fBitfieldsUInt;
1054  };
1055 
1056  static GlyphCacheProc GetGlyphCacheProc(TextEncoding encoding,
1057  bool isDevKern,
1058  bool needFullMetrics);
1059 
1060  SkScalar measure_text(SkGlyphCache*, const char* text, size_t length,
1061  int* count, SkRect* bounds) const;
1062 
1063  enum ScalerContextFlags : uint32_t {
1064  kNone_ScalerContextFlags = 0,
1065 
1066  kFakeGamma_ScalerContextFlag = 1 << 0,
1067  kBoostContrast_ScalerContextFlag = 1 << 1,
1068 
1069  kFakeGammaAndBoostContrast_ScalerContextFlags =
1070  kFakeGamma_ScalerContextFlag | kBoostContrast_ScalerContextFlag,
1071  };
1072 
1073  /*
1074  * Allocs an SkDescriptor on the heap and return it to the caller as a refcnted
1075  * SkData. Caller is responsible for managing the lifetime of this object.
1076  */
1077  void getScalerContextDescriptor(SkScalerContextEffects*, SkAutoDescriptor*,
1078  const SkSurfaceProps& surfaceProps,
1079  uint32_t scalerContextFlags, const SkMatrix*) const;
1080 
1081  SkGlyphCache* detachCache(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags,
1082  const SkMatrix*) const;
1083 
1084  void descriptorProc(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags,
1085  const SkMatrix* deviceMatrix,
1086  void (*proc)(SkTypeface*, const SkScalerContextEffects&,
1087  const SkDescriptor*, void*),
1088  void* context) const;
1089 
1090  /*
1091  * The luminance color is used to determine which Gamma Canonical color to map to. This is
1092  * really only used by backends which want to cache glyph masks, and need some way to know if
1093  * they need to generate new masks based off a given color.
1094  */
1095  SkColor computeLuminanceColor() const;
1096 
1097  enum {
1098  /* This is the size we use when we ask for a glyph's path. We then
1099  * post-transform it as we draw to match the request.
1100  * This is done to try to re-use cache entries for the path.
1101  *
1102  * This value is somewhat arbitrary. In theory, it could be 1, since
1103  * we store paths as floats. However, we get the path from the font
1104  * scaler, and it may represent its paths as fixed-point (or 26.6),
1105  * so we shouldn't ask for something too big (might overflow 16.16)
1106  * or too small (underflow 26.6).
1107  *
1108  * This value could track kMaxSizeForGlyphCache, assuming the above
1109  * constraints, but since we ask for unhinted paths, the two values
1110  * need not match per-se.
1111  */
1112  kCanonicalTextSizeForPaths = 64,
1113  };
1114 
1115  static bool TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM);
1116 
1117  // Set flags/hinting/textSize up to use for drawing text as paths.
1118  // Returns scale factor to restore the original textSize, since will will
1119  // have change it to kCanonicalTextSizeForPaths.
1120  SkScalar setupForAsPaths();
1121 
1122  static SkScalar MaxCacheSize2();
1123 
1124  friend class SkAutoGlyphCache;
1125  friend class SkAutoGlyphCacheNoGamma;
1126  friend class SkCanvas;
1127  friend class SkDraw;
1128  friend class SkPDFDevice;
1129  friend class GrAtlasTextBlob;
1130  friend class GrAtlasTextContext;
1131  friend class GrStencilAndCoverTextContext;
1132  friend class GrPathRendering;
1133  friend class GrTextUtils;
1134  friend class GrGLPathRendering;
1135  friend class SkScalerContext;
1136  friend class SkTextBaseIter;
1137  friend class SkCanonicalizePaint;
1138 };
1139 
1140 #endif
SkScalar fTop
The greatest distance above the baseline for any glyph (will be <= 0)
Definition: SkPaint.h:700
bool isDevKernText() const
Helper for getFlags(), returns true if kDevKernText_Flag bit is set.
Definition: SkPaint.h:256
bool hasUnderlineThickness(SkScalar *thickness) const
If the fontmetrics has a valid underline thickness, return true, and set the thickness param to that ...
Definition: SkPaint.h:725
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:59
begin/end contours with a semi-circle extension
Definition: SkPaint.h:394
connect path segments with a round join
Definition: SkPaint.h:407
SkPathEffect * getPathEffect() const
Get the paint's patheffect object.
Definition: SkPaint.h:515
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line...
Definition: SkPath.h:25
SkTextBlob combines multiple text runs into an immutable, ref-counted structure.
Definition: SkTextBlob.h:24
SkScalar fDescent
The recommended distance below the baseline (will be >= 0)
Definition: SkPaint.h:702
Shaders specify the source color(s) for what is being drawn.
Definition: SkShader.h:41
SkPathEffect is the base class for objects in the SkPaint that affect the geometry of a drawing primi...
Definition: SkPathEffect.h:27
Style getStyle() const
Return the paint's style, used for controlling how primitives' geometries are interpreted (except for...
Definition: SkPaint.h:303
SkScalar getStrokeMiter() const
Return the paint's stroke miter value.
Definition: SkPaint.h:369
ColorFilters are optional objects in the drawing pipeline.
Definition: SkColorFilter.h:32
uint16_t SkGlyphID
16 bit unsigned integer to hold a glyph index
Definition: SkTypes.h:299
bool hasUnderlinePosition(SkScalar *position) const
If the fontmetrics has a valid underline position, return true, and set the position param to that va...
Definition: SkPaint.h:737
bool isFakeBoldText() const
Helper for getFlags(), returns true if kFakeBoldText_Flag bit is set.
Definition: SkPaint.h:243
SkScalar getStrokeWidth() const
Return the width for stroking.
Definition: SkPaint.h:354
the text parameters are UTF8
Definition: SkPaint.h:678
SkScalar fMaxCharWidth
the max character width (>= 0)
Definition: SkPaint.h:706
Describes properties and constraints of a given SkSurface.
Definition: SkSurfaceProps.h:51
Definition: SkPoint.h:156
SkMaskFilter * getMaskFilter() const
Get the paint's maskfilter object.
Definition: SkPaint.h:535
Cap
Cap enum specifies the settings for the paint's strokecap.
Definition: SkPaint.h:392
the text parameters are UTF16
Definition: SkPaint.h:679
TextEncoding
Describes how to interpret the text parameters that are passed to paint methods like measureText() an...
Definition: SkPaint.h:677
connect path segments with a flat bevel join
Definition: SkPaint.h:408
Align getTextAlign() const
Return the paint's Align value for drawing text.
Definition: SkPaint.h:631
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:28
Hinting
Specifies the level of hinting to be performed.
Definition: SkPaint.h:87
SkScalar measureText(const void *text, size_t length) const
Return the width of the text.
Definition: SkPaint.h:816
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:45
SkScalar fXMin
The minimum bounding box x value for all glyphs.
Definition: SkPaint.h:707
stroke the geometry
Definition: SkPaint.h:291
uint8_t getAlpha() const
Helper to getColor() that just returns the color's alpha value.
Definition: SkPaint.h:330
bool isAntiAlias() const
Helper for getFlags(), returning true if kAntiAlias_Flag bit is set.
Definition: SkPaint.h:142
fill the geometry
Definition: SkPaint.h:290
Definition: SkRasterizer.h:21
Definition: SkPaint.h:690
SkData holds an immutable data buffer.
Definition: SkData.h:22
Join
Join enum specifies the settings for the paint's strokejoin.
Definition: SkPaint.h:405
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:227
Cap getStrokeCap() const
Return the paint's stroke cap type, controlling how the start and end of stroked lines and paths are ...
Definition: SkPaint.h:420
SkScalar getTextScaleX() const
Return the paint's horizontal scale factor for text.
Definition: SkPaint.h:652
The SkTypeface class specifies the typeface and intrinsic style of a font.
Definition: SkTypeface.h:43
Base class for image filters.
Definition: SkImageFilter.h:36
SkScalar fLeading
The recommended distance to add between lines of text (will be >= 0)
Definition: SkPaint.h:704
connect path segments with a sharp join
Definition: SkPaint.h:406
uint32_t getFlags() const
Return the paint's flags.
Definition: SkPaint.h:132
the text parameters are UTF32
Definition: SkPaint.h:680
SkScalar getFontSpacing() const
Return the recommend line spacing.
Definition: SkPaint.h:763
SkMaskFilter is the base class for object that perform transformations on an alpha-channel mask befor...
Definition: SkMaskFilter.h:47
SkDrawLooper * getDrawLooper() const
Return the paint's SkDrawLooper (if any).
Definition: SkPaint.h:602
bool isSubpixelText() const
Helper for getFlags(), returning true if kSubpixelText_Flag bit is set.
Definition: SkPaint.h:182
Style
Styles apply to rect, oval, path, and text.
Definition: SkPaint.h:289
bool isSorted() const
Return true if the rectangle's width and height are >= 0.
Definition: SkRect.h:477
int32_t SkUnichar
32 bit integer to hold a unicode value
Definition: SkTypes.h:295
SkRasterizer * getRasterizer() const
Get the paint's rasterizer (or NULL).
Definition: SkPaint.h:578
SkTypeface * getTypeface() const
Get the paint's typeface object.
Definition: SkPaint.h:558
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
SkScalar fAvgCharWidth
the average character width (>= 0)
Definition: SkPaint.h:705
SkScalar fXMax
The maximum bounding box x value for all glyphs.
Definition: SkPaint.h:708
SkScalar fUnderlinePosition
Underline Position - position of the top of the Underline stroke relative to the baseline, this can have following values.
Definition: SkPaint.h:719
Subclasses of SkDrawLooper can be attached to a SkPaint.
Definition: SkDrawLooper.h:33
Definition: SkWriteBuffer.h:27
const SkRect & computeFastBounds(const SkRect &orig, SkRect *storage) const
Only call this if canComputeFastBounds() returned true.
Definition: SkPaint.h:989
Definition: SkRect.h:404
SkScalar getTextSize() const
Return the paint's text size.
Definition: SkPaint.h:641
Flags
Specifies the bit values that are stored in the paint's flags.
Definition: SkPaint.h:102
#define SkColorGetA(color)
return the alpha byte from a SkColor value
Definition: SkColor.h:62
SkFilterQuality getFilterQuality() const
Return the filter level.
Definition: SkPaint.h:270
fill and stroke the geometry
Definition: SkPaint.h:292
SkScalar fAscent
The recommended distance above the baseline (will be <= 0)
Definition: SkPaint.h:701
begin/end contours with no extension
Definition: SkPaint.h:393
SkShader * getShader() const
Get the paint's shader object.
Definition: SkPaint.h:466
SkScalar getTextSkewX() const
Return the paint's horizontal skew factor for text.
Definition: SkPaint.h:666
SkScalar fCapHeight
The cap height (> 0), or 0 if cannot be determined.
Definition: SkPaint.h:710
uint32_t fFlags
Bit field to identify which values are unknown.
Definition: SkPaint.h:699
bool isLinearText() const
Helper for getFlags(), returning true if kLinearText_Flag bit is set.
Definition: SkPaint.h:169
int countText(const void *text, size_t byteLength) const
Return the number of drawable units in the specified text buffer.
Definition: SkPaint.h:792
unsigned U8CPU
Fast type for unsigned 8 bits.
Definition: SkTypes.h:191
begin/end contours with a half square extension
Definition: SkPaint.h:395
Join getStrokeJoin() const
Return the paint's stroke join type.
Definition: SkPaint.h:432
bool isDither() const
Helper for getFlags(), returning true if kDither_Flag bit is set.
Definition: SkPaint.h:154
SkColorFilter * getColorFilter() const
Get the paint's colorfilter.
Definition: SkPaint.h:495
SkScalar fBottom
The greatest distance below the baseline for any glyph (will be >= 0)
Definition: SkPaint.h:703
FontMetricsFlags
Flags which indicate the confidence level of various metrics.
Definition: SkPaint.h:694
SkScalar fXHeight
The height of an 'x' in px, or 0 if no 'x' in face.
Definition: SkPaint.h:709
SkColor getColor() const
Return the paint's color.
Definition: SkPaint.h:318
Types and macros for colors.
SkScalar fUnderlineThickness
underline thickness, or 0 if cannot be determined
Definition: SkPaint.h:711