Flutter Engine
The Flutter Engine
Functions
Anti_Alias.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Anti_Alias, 512, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Anti_Alias  ,
512  ,
256  ,
false  ,
 
)

Definition at line 4 of file Anti_Alias.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 bitmap.allocN32Pixels(50, 50);
8 SkCanvas offscreen(bitmap);
11 paint.setStrokeWidth(10);
12 for (bool antialias : { false, true }) {
13 paint.setColor(antialias ? SK_ColorRED : SK_ColorBLUE);
14 paint.setAntiAlias(antialias);
15 bitmap.eraseColor(0);
16 offscreen.drawLine(5, 5, 15, 30, paint);
17 canvas->drawLine(5, 5, 15, 30, paint);
18 canvas->save();
19 canvas->scale(10, 10);
20 canvas->drawImage(bitmap.asImage(), antialias ? 12 : 0, 0);
21 canvas->restore();
22 canvas->translate(15, 0);
23 }
24}
25} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
Definition: bitmap.py:1