Flutter Engine
The Flutter Engine
Functions
crbug_905548.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkImageFilters.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (crbug_905548, canvas, 100, 200)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( crbug_905548  ,
canvas  ,
100  ,
200   
)

Definition at line 20 of file crbug_905548.cpp.

20 {
21 auto surface = canvas->makeSurface(SkImageInfo::MakeN32Premul(100, 100));
22 if (!surface) {
24 }
25 surface->getCanvas()->clear(0);
26 surface->getCanvas()->drawCircle(50, 50, 45, SkPaint());
27 auto imageSource = SkImageFilters::Image(surface->makeImageSnapshot(), SkFilterMode::kNearest);
28
29 auto blurred = SkImageFilters::Blur(15, 15, imageSource);
30 auto eroded = SkImageFilters::Erode(0, 0, blurred);
31 auto blended = SkImageFilters::Blend(SkBlendMode::kDstOut, eroded, imageSource, nullptr);
32
34 paint.setImageFilter(blended);
35 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
36
37 auto mult = SkImageFilters::Arithmetic(1, 0, 0, 0, false, eroded, imageSource, nullptr);
38 paint.setImageFilter(mult);
39 canvas->translate(0, 100);
40 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
41}
@ kDstOut
r = d * (1-sa)
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Arithmetic(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609