2011-07-28 14:26:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2009-05-13 14:00:33 +00:00
|
|
|
#ifndef SkShape_DEFINED
|
|
|
|
#define SkShape_DEFINED
|
|
|
|
|
|
|
|
#include "SkFlattenable.h"
|
|
|
|
|
|
|
|
class SkCanvas;
|
2009-05-18 04:20:55 +00:00
|
|
|
class SkMatrix;
|
2009-05-13 14:00:33 +00:00
|
|
|
class SkWStream;
|
|
|
|
|
|
|
|
class SkShape : public SkFlattenable {
|
|
|
|
public:
|
2009-06-29 16:02:20 +00:00
|
|
|
SkShape();
|
|
|
|
virtual ~SkShape();
|
2009-05-13 14:00:33 +00:00
|
|
|
|
|
|
|
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);
|
2009-05-29 21:30:42 +00:00
|
|
|
|
2009-05-13 14:00:33 +00:00
|
|
|
/** Draw the shape with the specified matrix, applied before the shape's
|
|
|
|
matrix (if any).
|
|
|
|
*/
|
|
|
|
void drawMatrix(SkCanvas*, const SkMatrix&);
|
|
|
|
|
|
|
|
// overrides
|
2009-06-29 16:02:20 +00:00
|
|
|
virtual Factory getFactory();
|
2009-05-13 14:00:33 +00:00
|
|
|
virtual void flatten(SkFlattenableWriteBuffer&);
|
|
|
|
|
2009-06-29 16:02:20 +00:00
|
|
|
// public for Registrar
|
|
|
|
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
|
|
|
|
|
2011-12-15 14:16:43 +00:00
|
|
|
SK_DECLARE_FLATTENABLE_REGISTRAR()
|
|
|
|
|
2009-05-13 14:00:33 +00:00
|
|
|
protected:
|
2009-06-29 16:02:20 +00:00
|
|
|
virtual void onDraw(SkCanvas*);
|
2009-05-13 14:00:33 +00:00
|
|
|
|
2009-06-29 16:02:20 +00:00
|
|
|
SkShape(SkFlattenableReadBuffer&);
|
2009-05-13 14:00:33 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
typedef SkFlattenable INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|