00001 #ifndef SkRectShape_DEFINED 00002 #define SkRectShape_DEFINED 00003 00004 #include "SkShape.h" 00005 #include "SkPaint.h" 00006 #include "SkSize.h" 00007 00008 class SkPaintShape : public SkShape { 00009 public: 00010 SkPaintShape(); 00011 00012 SkPaint& paint() { return fPaint; } 00013 const SkPaint& paint() const { return fPaint; } 00014 00015 // overrides 00016 virtual void flatten(SkFlattenableWriteBuffer&); 00017 00018 protected: 00019 SkPaintShape(SkFlattenableReadBuffer& buffer); 00020 00021 private: 00022 SkPaint fPaint; 00023 00024 typedef SkShape INHERITED; 00025 }; 00026 00027 class SkRectShape : public SkPaintShape { 00028 public: 00029 SkRectShape(); 00030 00031 void setRect(const SkRect&); 00032 void setOval(const SkRect&); 00033 void setCircle(SkScalar x, SkScalar y, SkScalar radius); 00034 void setRRect(const SkRect&, SkScalar rx, SkScalar ry); 00035 00036 // overrides 00037 virtual Factory getFactory(); 00038 virtual void flatten(SkFlattenableWriteBuffer&); 00039 00040 // public for Registrar 00041 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); 00042 00043 protected: 00044 SkRectShape(SkFlattenableReadBuffer&); 00045 00046 // overrides 00047 virtual void onDraw(SkCanvas*); 00048 00049 private: 00050 SkRect fBounds; 00051 SkSize fRadii; 00052 00053 typedef SkPaintShape INHERITED; 00054 }; 00055 00056 #endif