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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 radialRadius, radialColors, radialPos, radialCount, | 375 radialRadius, radialColors, radialPos, radialCount, |
376 radialMode); | 376 radialMode); |
377 | 377 |
378 SkEmbossMaskFilter::Light light; | 378 SkEmbossMaskFilter::Light light; |
379 light.fDirection[0] = SK_Scalar1/2; | 379 light.fDirection[0] = SK_Scalar1/2; |
380 light.fDirection[1] = SK_Scalar1/2; | 380 light.fDirection[1] = SK_Scalar1/2; |
381 light.fDirection[2] = SK_Scalar1/3; | 381 light.fDirection[2] = SK_Scalar1/3; |
382 light.fAmbient = 0x48; | 382 light.fAmbient = 0x48; |
383 light.fSpecular = 0x80; | 383 light.fSpecular = 0x80; |
384 SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5); | 384 SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5); |
385 SkEmbossMaskFilter* embossFilter = SkEmbossMaskFilter::Create(sigma, lig
ht); | 385 SkMaskFilter* embossFilter = SkEmbossMaskFilter::Create(sigma, light); |
386 | 386 |
387 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode); | 387 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode); |
388 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter( | 388 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter( |
389 0xff89bc45, 0xff112233); | 389 0xff89bc45, 0xff112233); |
390 | 390 |
391 canvas->save(); | 391 canvas->save(); |
392 canvas->translate(SkIntToScalar(0), SkIntToScalar(5)); | 392 canvas->translate(SkIntToScalar(0), SkIntToScalar(5)); |
393 paint.setAntiAlias(true); | 393 paint.setAntiAlias(true); |
394 paint.setFilterQuality(kLow_SkFilterQuality); | 394 paint.setFilterQuality(kLow_SkFilterQuality); |
395 // !!! draw through a clip | 395 // !!! draw through a clip |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 private: | 571 private: |
572 SkPoint fClickPt; | 572 SkPoint fClickPt; |
573 SkBitmap fBug, fTb, fTx; | 573 SkBitmap fBug, fTb, fTx; |
574 typedef SampleView INHERITED; | 574 typedef SampleView INHERITED; |
575 }; | 575 }; |
576 | 576 |
577 ////////////////////////////////////////////////////////////////////////////// | 577 ////////////////////////////////////////////////////////////////////////////// |
578 | 578 |
579 static SkView* MyFactory() { return new DemoView; } | 579 static SkView* MyFactory() { return new DemoView; } |
580 static SkViewRegister reg(MyFactory); | 580 static SkViewRegister reg(MyFactory); |
OLD | NEW |