00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef SkColorShader_DEFINED
00018 #define SkColorShader_DEFINED
00019
00020 #include "SkShader.h"
00021
00027 class SkColorShader : public SkShader {
00028 public:
00032 SkColorShader() : fFlags(0), fInheritColor(true) {}
00033
00038 SkColorShader(SkColor c) : fColor(c), fFlags(0), fInheritColor(false) {}
00039
00040 virtual uint32_t getFlags() { return fFlags; }
00041 virtual uint8_t getSpan16Alpha() const;
00042 virtual bool setContext(const SkBitmap& device, const SkPaint& paint,
00043 const SkMatrix& matrix);
00044 virtual void shadeSpan(int x, int y, SkPMColor span[], int count);
00045 virtual void shadeSpan16(int x, int y, uint16_t span[], int count);
00046 virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count);
00047
00048 protected:
00049 SkColorShader(SkFlattenableReadBuffer& );
00050 virtual void flatten(SkFlattenableWriteBuffer& );
00051 virtual Factory getFactory() { return CreateProc; }
00052 private:
00053 static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
00054 return SkNEW_ARGS(SkColorShader, (buffer));
00055 }
00056 SkColor fColor;
00057 SkPMColor fPMColor;
00058 uint32_t fFlags;
00059 uint16_t fColor16;
00060 SkBool8 fInheritColor;
00061
00062 typedef SkShader INHERITED;
00063 };
00064
00065 #endif