Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkLayerRasterizer.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 SkLayerRasterizer_DEFINED
9 #define SkLayerRasterizer_DEFINED
10 
11 #include "SkRasterizer.h"
12 #include "SkDeque.h"
13 #include "SkScalar.h"
14 
15 class SkPaint;
16 
17 class SK_API SkLayerRasterizer : public SkRasterizer {
18 public:
19  ~SkLayerRasterizer() override;
20 
21  class SK_API Builder {
22  public:
23  Builder();
24  ~Builder();
25 
26  void addLayer(const SkPaint& paint) {
27  this->addLayer(paint, 0, 0);
28  }
29 
36  void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
37 
45  sk_sp<SkLayerRasterizer> detach();
46 
59  sk_sp<SkLayerRasterizer> snapshot() const;
60 
61  private:
62  SkDeque* fLayers;
63  };
64 
65  SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
66 
67 protected:
69  SkLayerRasterizer(SkDeque* layers);
70  void flatten(SkWriteBuffer&) const override;
71 
72  // override from SkRasterizer
73  virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
74  const SkIRect* clipBounds,
75  SkMask* mask, SkMask::CreateMode mode) const override;
76 
77 private:
78  const SkDeque* const fLayers;
79 
80  static SkDeque* ReadLayers(SkReadBuffer& buffer);
81 
82  friend class LayerRasterizerTester;
83 
84  typedef SkRasterizer INHERITED;
85 };
86 
87 #endif
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line...
Definition: SkPath.h:25
Definition: SkLayerRasterizer.h:21
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:28
Definition: SkRefCnt.h:125
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:45
SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or the 3-channel 3D format.
Definition: SkMask.h:19
Definition: SkLayerRasterizer.h:17
Definition: SkRasterizer.h:21
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:246
Definition: SkDeque.h:26
Definition: SkWriteBuffer.h:27
SkIRect holds four 32 bit integer coordinates for a rectangle.
Definition: SkRect.h:20