blob: 78a140e187edb1880b408048f2a24259b5827595 [file] [log] [blame]
reed@android.comf76bacf2009-05-13 14:00:33 +00001#ifndef SkShape_DEFINED
2#define SkShape_DEFINED
3
4#include "SkFlattenable.h"
5#include "SkMatrix.h"
6
7class SkCanvas;
8class SkWStream;
9
10class SkShape : public SkFlattenable {
11public:
12 SkShape() : fMatrix(NULL) {}
13 virtual ~SkShape();
14
15 void getMatrix(SkMatrix*) const;
16 void setMatrix(const SkMatrix&);
17 void resetMatrix();
18
19 void draw(SkCanvas*);
20
21 /** Draw the shape translated by (dx,dy), which is applied before the
22 shape's matrix (if any).
23 */
24 void drawXY(SkCanvas*, SkScalar dx, SkScalar dy);
25
26 /** Draw the shape with the specified matrix, applied before the shape's
27 matrix (if any).
28 */
29 void drawMatrix(SkCanvas*, const SkMatrix&);
30
31 // overrides
32 virtual void flatten(SkFlattenableWriteBuffer&);
33
34protected:
35 virtual void onDraw(SkCanvas*) = 0;
36
37 SkShape(SkFlattenableReadBuffer&);
38
39private:
40 SkMatrix* fMatrix;
41
42 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
43
44 typedef SkFlattenable INHERITED;
45};
46
47#endif