| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkColorShader_DEFINED | 10 #ifndef SkColorShader_DEFINED |
| 11 #define SkColorShader_DEFINED | 11 #define SkColorShader_DEFINED |
| 12 | 12 |
| 13 #include "SkShader.h" | 13 #include "SkShader.h" |
| 14 | 14 |
| 15 /** \class SkColorShader | 15 /** \class SkColorShader |
| 16 A Shader that represents a single color. In general, this effect can be | 16 A Shader that represents a single color. In general, this effect can be |
| 17 accomplished by just using the color field on the paint, but if an | 17 accomplished by just using the color field on the paint, but if an |
| 18 actual shader object is needed, this provides that feature. | 18 actual shader object is needed, this provides that feature. |
| 19 */ | 19 */ |
| 20 class SK_API SkColorShader : public SkShader { | 20 class SK_API SkColorShader : public SkShader { |
| 21 public: | 21 public: |
| 22 /** Create a ColorShader that will inherit its color from the Paint | 22 /** Create a ColorShader that will inherit its color from the Paint |
| 23 at draw time. | 23 at draw time. |
| 24 */ | 24 */ |
| 25 SkColorShader(); | 25 SkColorShader(const SkMatrix* localMatrix = NULL); |
| 26 | 26 |
| 27 /** Create a ColorShader that ignores the color in the paint, and uses the | 27 /** Create a ColorShader that ignores the color in the paint, and uses the |
| 28 specified color. Note: like all shaders, at draw time the paint's alpha | 28 specified color. Note: like all shaders, at draw time the paint's alpha |
| 29 will be respected, and is applied to the specified color. | 29 will be respected, and is applied to the specified color. |
| 30 */ | 30 */ |
| 31 SkColorShader(SkColor c); | 31 SkColorShader(SkColor c, const SkMatrix* localMatrix = NULL); |
| 32 | 32 |
| 33 virtual bool isOpaque() const SK_OVERRIDE; | 33 virtual bool isOpaque() const SK_OVERRIDE; |
| 34 | 34 |
| 35 virtual SkShader::Context* createContext(const SkBitmap& device, | 35 virtual SkShader::Context* createContext(const SkBitmap& device, |
| 36 const SkPaint& paint, | 36 const SkPaint& paint, |
| 37 const SkMatrix& matrix, | 37 const SkMatrix& matrix, |
| 38 void* storage) const SK_OVERRIDE; | 38 void* storage) const SK_OVERRIDE; |
| 39 | 39 |
| 40 virtual size_t contextSize() const SK_OVERRIDE { | 40 virtual size_t contextSize() const SK_OVERRIDE { |
| 41 return sizeof(ColorShaderContext); | 41 return sizeof(ColorShaderContext); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 75 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 SkColor fColor; // ignored if fInheritColor is true | 78 SkColor fColor; // ignored if fInheritColor is true |
| 79 SkBool8 fInheritColor; | 79 SkBool8 fInheritColor; |
| 80 | 80 |
| 81 typedef SkShader INHERITED; | 81 typedef SkShader INHERITED; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #endif | 84 #endif |
| OLD | NEW |