OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 { bounds.fRight, y } | 73 { bounds.fRight, y } |
74 }; | 74 }; |
75 const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, 0 }; | 75 const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, 0 }; |
76 | 76 |
77 // pos[1] value is where we start to fade, relative to the width | 77 // pos[1] value is where we start to fade, relative to the width |
78 // of our pts[] array. | 78 // of our pts[] array. |
79 const SkScalar pos[] = { 0, 0.9f, SK_Scalar1 }; | 79 const SkScalar pos[] = { 0, 0.9f, SK_Scalar1 }; |
80 | 80 |
81 SkPaint p; | 81 SkPaint p; |
82 p.setShader(SkGradientShader::MakeLinear(pts, colors, pos, 3, SkShader::kCla
mp_TileMode)); | 82 p.setShader(SkGradientShader::MakeLinear(pts, colors, pos, 3, SkShader::kCla
mp_TileMode)); |
83 p.setXfermodeMode(SkXfermode::kDstIn_Mode); | 83 p.setBlendMode(SkBlendMode::kDstIn); |
84 canvas->drawRect(bounds, p); | 84 canvas->drawRect(bounds, p); |
85 | 85 |
86 canvas->restore(); | 86 canvas->restore(); |
87 } | 87 } |
88 | 88 |
89 static void test_text(SkCanvas* canvas) { | 89 static void test_text(SkCanvas* canvas) { |
90 SkPaint paint; | 90 SkPaint paint; |
91 paint.setAntiAlias(true); | 91 paint.setAntiAlias(true); |
92 paint.setTextSize(20); | 92 paint.setTextSize(20); |
93 | 93 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 private: | 402 private: |
403 SkIRect fBase, fRect; | 403 SkIRect fBase, fRect; |
404 | 404 |
405 typedef SampleView INHERITED; | 405 typedef SampleView INHERITED; |
406 }; | 406 }; |
407 | 407 |
408 ////////////////////////////////////////////////////////////////////////////// | 408 ////////////////////////////////////////////////////////////////////////////// |
409 | 409 |
410 static SkView* MyFactory() { return new RegionView; } | 410 static SkView* MyFactory() { return new RegionView; } |
411 static SkViewRegister reg(MyFactory); | 411 static SkViewRegister reg(MyFactory); |
OLD | NEW |