aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shapes/SkRectShape.h
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-13 14:00:33 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-13 14:00:33 +0000
commitf76bacff7f66724072c67edb185abf9e3add11a0 (patch)
tree122df275ab6ffea666b3bb8ebbefaeba1cbe64ef /src/shapes/SkRectShape.h
parent25e9834c03a050afbf339f457b8c401aecb26c0b (diff)
add SkSize for dimensions
add SkShape baseclass, in the hopes of having SkPicture inherit from that, and also using shapes as the extension mechanism for things like animated-gif git-svn-id: http://skia.googlecode.com/svn/trunk@174 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/shapes/SkRectShape.h')
-rw-r--r--src/shapes/SkRectShape.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/shapes/SkRectShape.h b/src/shapes/SkRectShape.h
new file mode 100644
index 0000000000..dfc07e95c7
--- /dev/null
+++ b/src/shapes/SkRectShape.h
@@ -0,0 +1,55 @@
+#ifndef SkRectShape_DEFINED
+#define SkRectShape_DEFINED
+
+#include "SkShape.h"
+#include "SkPaint.h"
+#include "SkSize.h"
+
+class SkPaintShape : public SkShape {
+public:
+ SkPaintShape();
+
+ SkPaint& paint() { return fPaint; }
+ const SkPaint& paint() const { return fPaint; }
+
+ // overrides
+ virtual void flatten(SkFlattenableWriteBuffer&);
+
+protected:
+ SkPaintShape(SkFlattenableReadBuffer& buffer);
+
+private:
+ SkPaint fPaint;
+
+ typedef SkShape INHERITED;
+};
+
+class SkRectShape : public SkPaintShape {
+public:
+ SkRectShape();
+
+ void setRect(const SkRect&);
+ void setOval(const SkRect&);
+ void setCircle(SkScalar x, SkScalar y, SkScalar radius);
+ void setRRect(const SkRect&, SkScalar rx, SkScalar ry);
+
+ // overrides
+ virtual Factory getFactory();
+ virtual void flatten(SkFlattenableWriteBuffer&);
+
+protected:
+ SkRectShape(SkFlattenableReadBuffer&);
+
+ // overrides
+ virtual void onDraw(SkCanvas*);
+
+private:
+ SkRect fBounds;
+ SkSize fRadii;
+
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
+ typedef SkPaintShape INHERITED;
+};
+
+#endif