Go to the source code of this file.
|
static void | draw_something (SkCanvas *canvas, const SkRect &bounds) |
|
static sk_sp< SkImage > | make_raster (GrRecordingContext *, SkPicture *pic, const SkImageInfo &info) |
|
static sk_sp< SkImage > | make_texture (GrRecordingContext *ctx, SkPicture *pic, const SkImageInfo &info) |
|
static sk_sp< SkImage > | make_pict_gen (GrRecordingContext *, SkPicture *pic, const SkImageInfo &info) |
|
static sk_sp< SkImage > | make_encode_gen (GrRecordingContext *ctx, SkPicture *pic, const SkImageInfo &info) |
|
static sk_sp< SkImage > | make_checker_img (int w, int h, SkColor c0, SkColor c1, int size) |
|
| DEF_SIMPLE_GM (drawimage_sampling, canvas, 500, 500) |
|
| DEF_SIMPLE_GM (textureimage_and_shader, canvas, 100, 50) |
|
◆ ImageMakerProc
◆ DEF_SIMPLE_GM() [1/2]
DEF_SIMPLE_GM |
( |
drawimage_sampling |
, |
|
|
canvas |
, |
|
|
500 |
, |
|
|
500 |
|
|
) |
| |
Definition at line 170 of file image_shader.cpp.
170 {
171 constexpr int N = 256;
172 constexpr float kScale = 1.0f/6;
174
177
179
181
185
186 canvas->save();
187
188 canvas->save();
189 canvas->concat(mx);
190 canvas->drawImage(img.get(), 0, 0,
sampling);
191 canvas->restore();
192
193 canvas->translate(
dst.width() + 4, 0);
194
197
198 canvas->translate(
dst.width() + 4, 0);
199
202 canvas->restore();
203
204 canvas->translate(0,
dst.height() + 8);
205 }
206 }
207
208}
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
@ kFast_SrcRectConstraint
sample outside bounds; faster
sk_sp< SkImage > withDefaultMipmaps() const
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static sk_sp< SkImage > make_checker_img(int w, int h, SkColor c0, SkColor c1, int size)
SkSamplingOptions sampling
static SkRect MakeIWH(int w, int h)
◆ DEF_SIMPLE_GM() [2/2]
DEF_SIMPLE_GM |
( |
textureimage_and_shader |
, |
|
|
canvas |
, |
|
|
100 |
, |
|
|
50 |
|
|
) |
| |
Definition at line 211 of file image_shader.cpp.
211 {
213
215 if (canvas->getSurface()) {
216 image = canvas->getSurface()->makeImageSnapshot();
218 } else {
221 image = greenSurface->makeImageSnapshot();
222 }
223
224
225
226
227
228
230
231
234 canvas->drawImage(
surface->makeImageSnapshot(), 0, 0);
235
236
241 canvas->drawImage(
surface->makeImageSnapshot(), 50, 0);
242}
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)
◆ draw_something()
static void draw_something |
( |
SkCanvas * |
canvas, |
|
|
const SkRect & |
bounds |
|
) |
| |
|
static |
Definition at line 35 of file image_shader.cpp.
35 {
37 paint.setAntiAlias(
true);
40 paint.setStrokeWidth(10);
45}
constexpr SkColor SK_ColorBLUE
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawOval(const SkRect &oval, const SkPaint &paint)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
Optional< SkRect > bounds
◆ make_checker_img()
Definition at line 164 of file image_shader.cpp.
164 {
168}
sk_sp< SkImage > asImage() const
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
◆ make_encode_gen()
Definition at line 84 of file image_shader.cpp.
86 {
89 return nullptr;
90 }
92 if (!encoded) {
93 return nullptr;
94 }
96}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static sk_sp< SkImage > make_raster(GrRecordingContext *, SkPicture *pic, const SkImageInfo &info)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
◆ make_pict_gen()
Definition at line 73 of file image_shader.cpp.
75 {
78 nullptr,
79 nullptr,
82}
sk_sp< T > sk_ref_sp(T *obj)
static sk_sp< SkColorSpace > MakeSRGB()
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
@ kU8
uses 8-bit unsigned int per color component
◆ make_raster()
◆ make_texture()
Definition at line 58 of file image_shader.cpp.
60 {
61 if (!ctx) {
62 return nullptr;
63 }
66 return nullptr;
67 }
69 surface->getCanvas()->drawPicture(pic);
70 return surface->makeImageSnapshot();
71}
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
◆ gProcs
Initial value:= {
}
static sk_sp< SkImage > make_texture(GrRecordingContext *ctx, SkPicture *pic, const SkImageInfo &info)
static sk_sp< SkImage > make_pict_gen(GrRecordingContext *, SkPicture *pic, const SkImageInfo &info)
static sk_sp< SkImage > make_encode_gen(GrRecordingContext *ctx, SkPicture *pic, const SkImageInfo &info)
Definition at line 98 of file image_shader.cpp.