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 #ifndef SkShader_DEFINED | 8 #ifndef SkShader_DEFINED |
9 #define SkShader_DEFINED | 9 #define SkShader_DEFINED |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 * Return a shader that will apply the specified localMatrix to this shader
. | 316 * Return a shader that will apply the specified localMatrix to this shader
. |
317 * The specified matrix will be applied before any matrix associated with t
his shader. | 317 * The specified matrix will be applied before any matrix associated with t
his shader. |
318 */ | 318 */ |
319 SkShader* newWithLocalMatrix(const SkMatrix&) const; | 319 SkShader* newWithLocalMatrix(const SkMatrix&) const; |
320 | 320 |
321 /** | 321 /** |
322 * Create a new shader that produces the same colors as invoking this shade
r and then applying | 322 * Create a new shader that produces the same colors as invoking this shade
r and then applying |
323 * the colorfilter. | 323 * the colorfilter. |
324 */ | 324 */ |
325 SkShader* newWithColorFilter(SkColorFilter*) const; | 325 SkShader* newWithColorFilter(SkColorFilter*) const; |
326 | 326 |
327 ////////////////////////////////////////////////////////////////////////// | 327 ////////////////////////////////////////////////////////////////////////// |
328 // Factory methods for stock shaders | 328 // Factory methods for stock shaders |
329 | 329 |
330 /** | 330 /** |
331 * Call this to create a new "empty" shader, that will not draw anything. | 331 * Call this to create a new "empty" shader, that will not draw anything. |
332 */ | 332 */ |
333 static SkShader* CreateEmptyShader(); | 333 static SkShader* CreateEmptyShader(); |
334 | 334 |
335 /** | 335 /** |
336 * Call this to create a new shader that just draws the specified color. Th
is should always | 336 * Call this to create a new shader that just draws the specified color. Th
is should always |
337 * draw the same as a paint with this color (and no shader). | 337 * draw the same as a paint with this color (and no shader). |
338 */ | 338 */ |
339 static SkShader* CreateColorShader(SkColor); | 339 static SkShader* CreateColorShader(SkColor); |
340 | 340 |
| 341 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e::Mode); |
| 342 |
| 343 /** |
| 344 * Create a new compose shader, given shaders dst, src, and a combining xfe
rmode mode. |
| 345 * The xfermode is called with the output of the two shaders, and its outpu
t is returned. |
| 346 * If xfer is null, SkXfermode::kSrcOver_Mode is assumed. |
| 347 * |
| 348 * Ownership of the shaders, and the xfermode if not null, is not transfere
d, so the caller |
| 349 * is still responsible for managing its reference-count for those objects. |
| 350 */ |
| 351 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e* xfer); |
| 352 |
341 /** Call this to create a new shader that will draw with the specified bitma
p. | 353 /** Call this to create a new shader that will draw with the specified bitma
p. |
342 * | 354 * |
343 * If the bitmap cannot be used (e.g. has no pixels, or its dimensions | 355 * If the bitmap cannot be used (e.g. has no pixels, or its dimensions |
344 * exceed implementation limits (currently at 64K - 1)) then SkEmptyShader | 356 * exceed implementation limits (currently at 64K - 1)) then SkEmptyShader |
345 * may be returned. | 357 * may be returned. |
346 * | 358 * |
347 * If the src is kA8_Config then that mask will be colorized using the colo
r on | 359 * If the src is kA8_Config then that mask will be colorized using the colo
r on |
348 * the paint. | 360 * the paint. |
349 * | 361 * |
350 * @param src The bitmap to use inside the shader | 362 * @param src The bitmap to use inside the shader |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 SkMatrix fLocalMatrix; | 426 SkMatrix fLocalMatrix; |
415 | 427 |
416 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 428 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
417 friend class SkLocalMatrixShader; | 429 friend class SkLocalMatrixShader; |
418 friend class SkBitmapProcShader; // for computeTotalInverse() | 430 friend class SkBitmapProcShader; // for computeTotalInverse() |
419 | 431 |
420 typedef SkFlattenable INHERITED; | 432 typedef SkFlattenable INHERITED; |
421 }; | 433 }; |
422 | 434 |
423 #endif | 435 #endif |
OLD | NEW |