| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 #include "SkMask.h" | 14 #include "SkMask.h" |
| 15 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
| 16 #include "SkPaint.h" | 16 #include "SkPaint.h" |
| 17 #include "../gpu/GrColor.h" | 17 #include "../gpu/GrColor.h" |
| 18 | 18 |
| 19 class SkColorFilter; | 19 class SkColorFilter; |
| 20 class SkColorSpace; |
| 20 class SkPath; | 21 class SkPath; |
| 21 class SkPicture; | 22 class SkPicture; |
| 22 class SkXfermode; | 23 class SkXfermode; |
| 23 class GrContext; | 24 class GrContext; |
| 24 class GrFragmentProcessor; | 25 class GrFragmentProcessor; |
| 25 | 26 |
| 26 /** \class SkShader | 27 /** \class SkShader |
| 27 * | 28 * |
| 28 * Shaders specify the source color(s) for what is being drawn. If a paint | 29 * Shaders specify the source color(s) for what is being drawn. If a paint |
| 29 * has no shader, then the paint's color is used. If the paint has a | 30 * has no shader, then the paint's color is used. If the paint has a |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 * Call this to create a new "empty" shader, that will not draw anything. | 369 * Call this to create a new "empty" shader, that will not draw anything. |
| 369 */ | 370 */ |
| 370 static sk_sp<SkShader> MakeEmptyShader(); | 371 static sk_sp<SkShader> MakeEmptyShader(); |
| 371 | 372 |
| 372 /** | 373 /** |
| 373 * Call this to create a new shader that just draws the specified color. Th
is should always | 374 * Call this to create a new shader that just draws the specified color. Th
is should always |
| 374 * draw the same as a paint with this color (and no shader). | 375 * draw the same as a paint with this color (and no shader). |
| 375 */ | 376 */ |
| 376 static sk_sp<SkShader> MakeColorShader(SkColor); | 377 static sk_sp<SkShader> MakeColorShader(SkColor); |
| 377 | 378 |
| 379 /** |
| 380 * Create a shader that draws the specified color (in the specified colorsp
ace). |
| 381 * |
| 382 * This works around the limitation that SkPaint::setColor() only takes byt
e values, and does |
| 383 * not support specific colorspaces. |
| 384 */ |
| 385 static sk_sp<SkShader> MakeColorShader(const SkColor4f&, sk_sp<SkColorSpace>
); |
| 386 |
| 378 static sk_sp<SkShader> MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader
> src, | 387 static sk_sp<SkShader> MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader
> src, |
| 379 SkXfermode::Mode); | 388 SkXfermode::Mode); |
| 380 | 389 |
| 381 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR | 390 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR |
| 382 static SkShader* CreateEmptyShader() { return MakeEmptyShader().release(); } | 391 static SkShader* CreateEmptyShader() { return MakeEmptyShader().release(); } |
| 383 static SkShader* CreateColorShader(SkColor c) { return MakeColorShader(c).re
lease(); } | 392 static SkShader* CreateColorShader(SkColor c) { return MakeColorShader(c).re
lease(); } |
| 384 static SkShader* CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileM
ode tmy, | 393 static SkShader* CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileM
ode tmy, |
| 385 const SkMatrix* localMatrix = nullptr) { | 394 const SkMatrix* localMatrix = nullptr) { |
| 386 return MakeBitmapShader(src, tmx, tmy, localMatrix).release(); | 395 return MakeBitmapShader(src, tmx, tmy, localMatrix).release(); |
| 387 } | 396 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 SkMatrix fLocalMatrix; | 498 SkMatrix fLocalMatrix; |
| 490 | 499 |
| 491 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 500 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
| 492 friend class SkLocalMatrixShader; | 501 friend class SkLocalMatrixShader; |
| 493 friend class SkBitmapProcShader; // for computeTotalInverse() | 502 friend class SkBitmapProcShader; // for computeTotalInverse() |
| 494 | 503 |
| 495 typedef SkFlattenable INHERITED; | 504 typedef SkFlattenable INHERITED; |
| 496 }; | 505 }; |
| 497 | 506 |
| 498 #endif | 507 #endif |
| OLD | NEW |