Flutter Engine
The Flutter Engine
Functions
bicubic.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkShader.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (bicubic, canvas, 300, 320)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( bicubic  ,
canvas  ,
300  ,
320   
)

Definition at line 15 of file bicubic.cpp.

15 {
16 canvas->clear(SK_ColorBLACK);
17
22 };
23
24 auto make_img = []() {
26 surf->getCanvas()->drawColor(SK_ColorBLACK);
27
29 paint.setColor(SK_ColorWHITE);
30 surf->getCanvas()->drawLine(3.5f, 0, 3.5f, 8, paint);
31 return surf->makeImageSnapshot();
32 };
33
34 auto img = make_img();
35
36 canvas->scale(40, 8);
37 for (const auto& s : gSamplings) {
38 canvas->drawImage(img, 0, 0, s, nullptr);
39 canvas->translate(0, img->height() + 1.0f);
40 }
41
42 const SkRect r = SkRect::MakeIWH(img->width(), img->height());
44
45 SkCubicResampler cubics[] = {
48 };
49 for (auto c : cubics) {
50 paint.setShader(img->makeShader(SkTileMode::kClamp, SkTileMode::kClamp,
52 canvas->drawRect(r, paint);
53 canvas->translate(0, img->height() + 1.0f);
54 }
55}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
const Paint & paint
Definition: color_source.cc:38
static sk_sp< SkImage > make_img(int w, int h)
struct MyStruct s
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkCubicResampler CatmullRom()
static constexpr SkCubicResampler Mitchell()
static SkImageInfo MakeN32Premul(int width, int height)
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623
const SkSamplingOptions gSamplings[]
Definition: image.cpp:57