Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkDrawLooper.h
1 
2 /*
3  * Copyright 2011 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 #ifndef SkDrawLooper_DEFINED
11 #define SkDrawLooper_DEFINED
12 
13 #include "SkBlurTypes.h"
14 #include "SkFlattenable.h"
15 #include "SkPoint.h"
16 #include "SkColor.h"
17 
18 class SkArenaAlloc;
19 class SkCanvas;
20 class SkColorSpaceXformer;
21 class SkPaint;
22 struct SkRect;
23 class SkString;
24 
33 class SK_API SkDrawLooper : public SkFlattenable {
34 public:
41  class SK_API Context : ::SkNoncopyable {
42  public:
43  Context() {}
44  virtual ~Context() {}
45 
60  virtual bool next(SkCanvas* canvas, SkPaint* paint) = 0;
61  };
62 
67  virtual Context* makeContext(SkCanvas*, SkArenaAlloc*) const = 0;
68 
79  bool canComputeFastBounds(const SkPaint& paint) const;
80  void computeFastBounds(const SkPaint& paint, const SkRect& src, SkRect* dst) const;
81 
82  struct BlurShadowRec {
83  SkScalar fSigma;
84  SkVector fOffset;
85  SkColor fColor;
86  SkBlurStyle fStyle;
87  SkBlurQuality fQuality;
88  };
98  virtual bool asABlurShadow(BlurShadowRec*) const;
99 
100  SK_TO_STRING_PUREVIRT()
101  SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper)
102 
103 protected:
104  sk_sp<SkDrawLooper> makeColorSpace(SkColorSpaceXformer* xformer) const {
105  return this->onMakeColorSpace(xformer);
106  }
107  virtual sk_sp<SkDrawLooper> onMakeColorSpace(SkColorSpaceXformer*) const = 0;
108 
109  SkDrawLooper() {}
110 
111 private:
112  friend class SkColorSpaceXformer;
113 
114  typedef SkFlattenable INHERITED;
115 };
116 
117 #endif
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:59
Definition: SkPoint.h:156
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:45
SkFlattenable is the base class for objects that need to be flattened into a data stream for either t...
Definition: SkFlattenable.h:70
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:246
Holds state during a draw.
Definition: SkDrawLooper.h:41
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
Subclasses of SkDrawLooper can be attached to a SkPaint.
Definition: SkDrawLooper.h:33
Definition: SkRect.h:404
Definition: SkDrawLooper.h:82
Light weight class for managing strings.
Definition: SkString.h:121
Types and macros for colors.