52 paint.setAntiAlias(
true);
56 paint.setColor(0xFFFFFFFF);
113 for (
int i = 0;
i < N; ++
i) {
115 fDrs[
i]->
fLoc.
set(100.f +
i * 100, 100.f +
i * 100);
126 fModeButtons[
i].
draw(canvas);
140 for (
int i = 0;
i < N; ++
i) {
141 fDrs[
i]->
draw(canvas);
150 if (fModeButtons[
i].hitTest(
x,
y)) {
157 for (
int i = N - 1;
i >= 0; --
i) {
158 if (fDrs[
i]->hitTest(
x,
y)) {
159 fSelected = fDrs[
i].
get();
163 return fSelected ?
new Click() :
nullptr;
204#include
"tools/Resources.h"
209 fName =
"CubicResampler";
214 SkRect r = {10, 10, 200, 200};
215 for (
const char*
name : {
"images/mandrill_128.png",
217 "images/example_4.png"}) {
221 fDomain.setXYWH(r.
fLeft + 3 * r.
width() + 40, 50, 200, 200);
226 for (
const auto& rec : fRecs) {
227 rec.draw(canvas, fCubic);
231 paint.setAntiAlias(
true);
232 paint.setStroke(
true);
236 paint.setStroke(
false);
241 str.
printf(
"B=%4.2f C=%4.2f", fCubic.B, fCubic.C);
247 fDomain.fLeft + 10, fDomain.fBottom + 40,
font,
paint);
262 if (fDomain.contains(
x,
y)) {
264 auto [
B,
C] = pin_unitize(fDomain, click->
fCurr);
303 std::vector<Rec> fRecs;
SK_API const char * SkBlendMode_Name(SkBlendMode blendMode)
@ kSrcOver
r = s + (1-sa)*d
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
@ kUTF8
uses bytes to represent UTF-8 or ASCII
const SkBlendMode gModes[]
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void onDraw(SkCanvas *canvas) override
CircDrawable(SkScalar size, SkColor c)
SkRect onGetBounds() override
bool onClick(ClickHandlerSlide::Click *) override
static SkPoint pin_unitize(const SkRect &r, SkPoint p)
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) override
void draw(SkCanvas *canvas) override
static float pin_unitize(float min, float max, float value)
void load(SkScalar, SkScalar) override
bool hitTest(SkScalar x, SkScalar y)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawOval(const SkRect &oval, const SkPaint &paint)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
void draw(SkCanvas *, const SkMatrix *=nullptr)
@ kAntiAlias
may have transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
void printf(const char format[],...) SK_PRINTF_LIKE(2
const char * c_str() const
static void DrawString(SkCanvas *canvas, const char text[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint, Align align=kLeft_Align)
bool onClick(Click *click) override
void draw(SkCanvas *canvas) override
Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) override
void reset(T *ptr=nullptr)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< SkBlender > blender SkRect rect
PODArray< SkColor > colors
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
static constexpr SkPoint Make(float x, float y)
void set(float x, float y)
constexpr float y() const
constexpr float x() const
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
constexpr float x() const
constexpr float y() const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
bool intersects(const SkRect &r) const
SkScalar fRight
larger x-axis bounds
constexpr float centerX() const
void offset(float dx, float dy)
constexpr float height() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
SkScalar fTop
smaller y-axis bounds