OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 SkScalar radius = SkIntToScalar(12)/5; | 385 SkScalar radius = SkIntToScalar(12)/5; |
386 SkEmbossMaskFilter* embossFilter = new SkEmbossMaskFilter(light, | 386 SkEmbossMaskFilter* embossFilter = new SkEmbossMaskFilter(light, |
387 radius); | 387 radius); |
388 | 388 |
389 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode); | 389 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode); |
390 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter( | 390 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter( |
391 0xff89bc45, 0xff112233); | 391 0xff89bc45, 0xff112233); |
392 | 392 |
393 canvas->save(); | 393 canvas->save(); |
394 canvas->translate(SkIntToScalar(0), SkIntToScalar(5)); | 394 canvas->translate(SkIntToScalar(0), SkIntToScalar(5)); |
395 paint.setFlags(SkPaint::kAntiAlias_Flag | SkPaint::kFilterBitmap_Flag); | 395 paint.setAntiAlias(true); |
| 396 paint.setFilterLevel(SkPaint::kLow_FilterLevel); |
396 // !!! draw through a clip | 397 // !!! draw through a clip |
397 paint.setColor(SK_ColorLTGRAY); | 398 paint.setColor(SK_ColorLTGRAY); |
398 paint.setStyle(SkPaint::kFill_Style); | 399 paint.setStyle(SkPaint::kFill_Style); |
399 SkRect clip = {0, 0, SkIntToScalar(320), SkIntToScalar(120)}; | 400 SkRect clip = {0, 0, SkIntToScalar(320), SkIntToScalar(120)}; |
400 canvas->clipRect(clip); | 401 canvas->clipRect(clip); |
401 paint.setShader(SkShader::CreateBitmapShader(fTx, | 402 paint.setShader(SkShader::CreateBitmapShader(fTx, |
402 SkShader::kMirror_TileMode, SkShader::kRepeat_TileMode))->unref(); | 403 SkShader::kMirror_TileMode, SkShader::kRepeat_TileMode))->unref(); |
403 canvas->drawPaint(paint); | 404 canvas->drawPaint(paint); |
404 canvas->save(); | 405 canvas->save(); |
405 | 406 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 private: | 638 private: |
638 SkPoint fClickPt; | 639 SkPoint fClickPt; |
639 SkBitmap fBug, fTb, fTx; | 640 SkBitmap fBug, fTb, fTx; |
640 typedef SampleView INHERITED; | 641 typedef SampleView INHERITED; |
641 }; | 642 }; |
642 | 643 |
643 ////////////////////////////////////////////////////////////////////////////// | 644 ////////////////////////////////////////////////////////////////////////////// |
644 | 645 |
645 static SkView* MyFactory() { return new DemoView; } | 646 static SkView* MyFactory() { return new DemoView; } |
646 static SkViewRegister reg(MyFactory); | 647 static SkViewRegister reg(MyFactory); |
OLD | NEW |