1 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 */ 8 #ifndef SkShape_DEFINED 9 #define SkShape_DEFINED 10 11 #include "SkFlattenable.h" 12 13 class SkCanvas; 14 class SkMatrix; 15 class SkWStream; 16 17 class SkShape : public SkFlattenable { 18 public: 19 SkShape(); 20 virtual ~SkShape(); 21 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); 28 29 /** 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 Factory getFactory(); 36 virtual void flatten(SkFlattenableWriteBuffer&); 37 38 // public for Registrar 39 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); 40 41 SK_DECLARE_FLATTENABLE_REGISTRAR() 42 43 protected: 44 virtual void onDraw(SkCanvas*); 45 46 SkShape(SkFlattenableReadBuffer&); 47 48 private: 49 50 typedef SkFlattenable INHERITED; 51 }; 52 53 #endif 54