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
diff --git a/include/core/SkShape.h b/include/core/SkShape.h
new file mode 100644
index 0000000..78a140e
--- /dev/null
+++ b/include/core/SkShape.h
@@ -0,0 +1,47 @@
+#ifndef SkShape_DEFINED
+#define SkShape_DEFINED
+
+#include "SkFlattenable.h"
+#include "SkMatrix.h"
+
+class SkCanvas;
+class SkWStream;
+
+class SkShape : public SkFlattenable {
+public:
+ SkShape() : fMatrix(NULL) {}
+ virtual ~SkShape();
+
+ void getMatrix(SkMatrix*) const;
+ void setMatrix(const SkMatrix&);
+ void resetMatrix();
+
+ void draw(SkCanvas*);
+
+ /** Draw the shape translated by (dx,dy), which is applied before the
+ shape's matrix (if any).
+ */
+ void drawXY(SkCanvas*, SkScalar dx, SkScalar dy);
+
+ /** Draw the shape with the specified matrix, applied before the shape's
+ matrix (if any).
+ */
+ void drawMatrix(SkCanvas*, const SkMatrix&);
+
+ // overrides
+ virtual void flatten(SkFlattenableWriteBuffer&);
+
+protected:
+ virtual void onDraw(SkCanvas*) = 0;
+
+ SkShape(SkFlattenableReadBuffer&);
+
+private:
+ SkMatrix* fMatrix;
+
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
+ typedef SkFlattenable INHERITED;
+};
+
+#endif