Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Attributes | Protected Member Functions | Private Member Functions | List of all members
TestExtractAlphaGM Class Reference
Inheritance diagram for TestExtractAlphaGM:
skiagm::GM

Public Attributes

SkBitmap fBitmap
 
SkBitmap fAlpha
 

Protected Member Functions

SkString getName () const override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Private Member Functions

void onOnceBeforeDraw () override
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 119 of file bitmapfilters.cpp.

Member Function Documentation

◆ getISize()

SkISize TestExtractAlphaGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 143 of file bitmapfilters.cpp.

143{ return SkISize::Make(540, 330); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ getName()

SkString TestExtractAlphaGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 141 of file bitmapfilters.cpp.

141{ return SkString("extractalpha"); }

◆ onDraw()

void TestExtractAlphaGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 145 of file bitmapfilters.cpp.

145 {
147 paint.setAntiAlias(true);
148 paint.setColor(SK_ColorRED);
149
151
152 // should stay blue (ignore paint's color)
153 canvas->drawImage(fBitmap.asImage(), 10, 10, sampling, &paint);
154 // should draw red
155 canvas->drawImage(fAlpha.asImage(), 120, 10, sampling, &paint);
156 }
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
sk_sp< SkImage > asImage() const
Definition SkBitmap.cpp:645
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
const Paint & paint
SkSamplingOptions sampling
Definition SkRecords.h:337

◆ onOnceBeforeDraw()

void TestExtractAlphaGM::onOnceBeforeDraw ( )
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 120 of file bitmapfilters.cpp.

120 {
121 // Make a bitmap with per-pixels alpha (stroked circle)
122 fBitmap.allocN32Pixels(100, 100);
123 SkCanvas canvas(fBitmap);
124 canvas.clear(0);
125
127 paint.setAntiAlias(true);
128 paint.setColor(SK_ColorBLUE);
130 paint.setStrokeWidth(20);
131
132 canvas.drawCircle(50, 50, 39, paint);
133
135 }
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
bool extractAlpha(SkBitmap *dst) const
Definition SkBitmap.h:1134
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition SkBitmap.cpp:232
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194

Member Data Documentation

◆ fAlpha

SkBitmap TestExtractAlphaGM::fAlpha

Definition at line 138 of file bitmapfilters.cpp.

◆ fBitmap

SkBitmap TestExtractAlphaGM::fBitmap

Definition at line 138 of file bitmapfilters.cpp.


The documentation for this class was generated from the following file: