| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #ifndef SkShader_DEFINED | 9 #ifndef SkShader_DEFINED |
| 10 #define SkShader_DEFINED | 10 #define SkShader_DEFINED |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * shader, then the shader's color(s) are use instead, but they are | 27 * shader, then the shader's color(s) are use instead, but they are |
| 28 * modulated by the paint's alpha. This makes it easy to create a shader | 28 * modulated by the paint's alpha. This makes it easy to create a shader |
| 29 * once (e.g. bitmap tiling or gradient) and then change its transparency | 29 * once (e.g. bitmap tiling or gradient) and then change its transparency |
| 30 * w/o having to modify the original shader... only the paint's alpha needs | 30 * w/o having to modify the original shader... only the paint's alpha needs |
| 31 * to be modified. | 31 * to be modified. |
| 32 */ | 32 */ |
| 33 class SK_API SkShader : public SkFlattenable { | 33 class SK_API SkShader : public SkFlattenable { |
| 34 public: | 34 public: |
| 35 SK_DECLARE_INST_COUNT(SkShader) | 35 SK_DECLARE_INST_COUNT(SkShader) |
| 36 | 36 |
| 37 SkShader(); | 37 SkShader(const SkMatrix* localMatrix = NULL); |
| 38 virtual ~SkShader(); | 38 virtual ~SkShader(); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Returns true if the local matrix is not an identity matrix. | 41 * Returns true if the local matrix is not an identity matrix. |
| 42 */ | 42 */ |
| 43 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } | 43 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Returns the local matrix. | 46 * Returns the local matrix. |
| 47 */ | 47 */ |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 * | 364 * |
| 365 * If the src is kA8_Config then that mask will be colorized using the colo
r on | 365 * If the src is kA8_Config then that mask will be colorized using the colo
r on |
| 366 * the paint. | 366 * the paint. |
| 367 * | 367 * |
| 368 * @param src The bitmap to use inside the shader | 368 * @param src The bitmap to use inside the shader |
| 369 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. | 369 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. |
| 370 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. | 370 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. |
| 371 * @return Returns a new shader object. Note: this function never retur
ns null. | 371 * @return Returns a new shader object. Note: this function never retur
ns null. |
| 372 */ | 372 */ |
| 373 static SkShader* CreateBitmapShader(const SkBitmap& src, | 373 static SkShader* CreateBitmapShader(const SkBitmap& src, |
| 374 TileMode tmx, TileMode tmy); | 374 TileMode tmx, TileMode tmy, |
| 375 const SkMatrix* localMatrix = NULL); |
| 375 | 376 |
| 376 /** Call this to create a new shader that will draw with the specified pictu
re. | 377 /** Call this to create a new shader that will draw with the specified pictu
re. |
| 377 * | 378 * |
| 378 * @param src The picture to use inside the shader (if not NULL, its ref c
ount | 379 * @param src The picture to use inside the shader (if not NULL, its ref c
ount |
| 379 * is incremented). The SkPicture must not be changed after | 380 * is incremented). The SkPicture must not be changed after |
| 380 * successfully creating a picture shader. | 381 * successfully creating a picture shader. |
| 381 * FIXME: src cannot be const due to SkCanvas::drawPicture | 382 * FIXME: src cannot be const due to SkCanvas::drawPicture |
| 382 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. | 383 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. |
| 383 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. | 384 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. |
| 384 * @return Returns a new shader object. Note: this function never retur
ns null. | 385 * @return Returns a new shader object. Note: this function never retur
ns null. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 395 | 396 |
| 396 private: | 397 private: |
| 397 SkMatrix fLocalMatrix; | 398 SkMatrix fLocalMatrix; |
| 398 | 399 |
| 399 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con
st; | 400 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con
st; |
| 400 | 401 |
| 401 typedef SkFlattenable INHERITED; | 402 typedef SkFlattenable INHERITED; |
| 402 }; | 403 }; |
| 403 | 404 |
| 404 #endif | 405 #endif |
| OLD | NEW |