OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2013 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "SkShader.h" | |
9 #include "SkBitmap.h" | |
10 #include "SkRegion.h" | |
11 #include "SkString.h" | |
12 | |
13 /** | |
14 * This shader samples a bitmap and a region. If the sample is inside the region | |
15 * the alpha of the bitmap color is boosted up to a threshold value. If it is | |
16 * outside the region then the bitmap alpha is decreased to the threshold value. | |
17 * The 0,0 point of the region corresponds to the upper left corner of the bitma p | |
18 * Currently, this only has a GPU implementation, doesn't respect the paint's bi tmap | |
19 * filter setting, and always uses clamp mode. | |
20 */ | |
21 class SK_API SkBitmapAlphaThresholdShader : public SkShader { | |
22 public: | |
23 SK_DECLARE_INST_COUNT(SkThresholdShader); | |
24 | |
25 static SkShader* Create(SkBitmap bitmap, const SkRegion& region, U8CPU thres hold); | |
reed1
2013/09/05 15:14:54
nit: const SkBitmap&
bsalomon
2013/09/05 19:54:50
Done.
| |
26 | |
27 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE {}; | |
reed1
2013/09/05 15:14:54
Suggestion:
move all of this method stuff into th
bsalomon
2013/09/05 19:54:50
Done.
| |
28 | |
29 #if SK_SUPPORT_GPU | |
30 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint& paint) c onst SK_OVERRIDE; | |
31 #endif | |
32 | |
33 SK_DEVELOPER_TO_STRING(); | |
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapAlphaThresholdSh ader) | |
35 | |
36 private: | |
37 SkBitmapAlphaThresholdShader(SkBitmap bitmap, SkRegion region, U8CPU); | |
38 SkBitmapAlphaThresholdShader(SkFlattenableReadBuffer& buffer) : INHERITED(bu ffer) {} | |
39 | |
40 | |
41 SkBitmap fBitmap; | |
42 SkRegion fRegion; | |
43 U8CPU fThreshold; | |
44 | |
45 typedef SkShader INHERITED; | |
46 }; | |
OLD | NEW |