blob: 3968fce2ba873ee74abc0b848cfa086200ea3255 [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
35 virtual void flatten(SkFlattenableWriteBuffer&);
djsollen@google.comba28d032012-03-26 17:57:35 +000036 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkShape)
reed@android.comf76bacf2009-05-13 14:00:33 +000037
reed@android.com0ad336f2009-06-29 16:02:20 +000038protected:
39 virtual void onDraw(SkCanvas*);
40
41 SkShape(SkFlattenableReadBuffer&);
reed@android.comf76bacf2009-05-13 14:00:33 +000042
43private:
reed@android.comf76bacf2009-05-13 14:00:33 +000044
45 typedef SkFlattenable INHERITED;
46};
47
48#endif