blob: b40d886083650fb49ab906e1ca5d97e6248891c3 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
reed@android.comf76bacf2009-05-13 14:00:33 +00008#ifndef SkShape_DEFINED
9#define SkShape_DEFINED
10
11#include "SkFlattenable.h"
reed@android.comf76bacf2009-05-13 14:00:33 +000012
13class SkCanvas;
reed@android.comf48f2812009-05-18 04:20:55 +000014class SkMatrix;
reed@android.comf76bacf2009-05-13 14:00:33 +000015class SkWStream;
16
17class SkShape : public SkFlattenable {
18public:
reed@android.com0ad336f2009-06-29 16:02:20 +000019 SkShape();
20 virtual ~SkShape();
reed@android.comf76bacf2009-05-13 14:00:33 +000021
22 void draw(SkCanvas*);
23
24 /** Draw the shape translated by (dx,dy), which is applied before the
25 shape's matrix (if any).
26 */
27 void drawXY(SkCanvas*, SkScalar dx, SkScalar dy);
reed@android.com89bb83a2009-05-29 21:30:42 +000028
reed@android.comf76bacf2009-05-13 14:00:33 +000029 /** Draw the shape with the specified matrix, applied before the shape's
30 matrix (if any).
31 */
32 void drawMatrix(SkCanvas*, const SkMatrix&);
33
34 // overrides
reed@android.com0ad336f2009-06-29 16:02:20 +000035 virtual Factory getFactory();
reed@android.comf76bacf2009-05-13 14:00:33 +000036 virtual void flatten(SkFlattenableWriteBuffer&);
37
reed@android.com0ad336f2009-06-29 16:02:20 +000038 // public for Registrar
39 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
reed@android.comf76bacf2009-05-13 14:00:33 +000040
reed@android.com0ad336f2009-06-29 16:02:20 +000041protected:
42 virtual void onDraw(SkCanvas*);
43
44 SkShape(SkFlattenableReadBuffer&);
reed@android.comf76bacf2009-05-13 14:00:33 +000045
46private:
reed@android.comf76bacf2009-05-13 14:00:33 +000047
48 typedef SkFlattenable INHERITED;
49};
50
51#endif