8 #ifndef SkImage_DEFINED
9 #define SkImage_DEFINED
11 #include "SkFilterQuality.h"
12 #include "SkImageInfo.h"
13 #include "SkImageEncoder.h"
48 typedef void* ReleaseContext;
53 typedef void (*RasterReleaseProc)(
const void* pixels, ReleaseContext);
93 return MakeFromTexture(ctx, desc, kPremul_SkAlphaType,
nullptr,
nullptr,
nullptr);
98 return MakeFromTexture(ctx, de, at,
nullptr,
nullptr,
nullptr);
101 typedef void (*TextureReleaseProc)(ReleaseContext);
111 SkAlphaType at, TextureReleaseProc trp,
113 return MakeFromTexture(ctx, desc, at,
nullptr, trp, rc);
133 SkAlphaType = kPremul_SkAlphaType,
142 const GrBackendObject yuvTextureHandles[3],
153 const GrBackendObject nv12TextureHandles[2],
154 const SkISize nv12Sizes[2], GrSurfaceOrigin,
164 int width()
const {
return fWidth; }
165 int height()
const {
return fHeight; }
166 SkISize dimensions()
const {
return SkISize::Make(fWidth, fHeight); }
167 SkIRect bounds()
const {
return SkIRect::MakeWH(fWidth, fHeight); }
168 uint32_t uniqueID()
const {
return fUniqueID; }
169 SkAlphaType alphaType()
const;
170 bool isOpaque()
const {
return SkAlphaTypeIsOpaque(this->alphaType()); }
176 bool readYUV8Planes(
const SkISize[3],
void*
const planes[3],
const size_t rowBytes[3],
177 SkYUVColorSpace)
const;
179 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR
181 const SkMatrix* localMatrix =
nullptr)
const;
185 const SkMatrix* localMatrix =
nullptr)
const;
194 bool peekPixels(
SkPixmap* pixmap)
const;
196 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
208 const void* peekPixels(
SkImageInfo* info,
size_t* rowBytes)
const;
223 void preroll(
GrContext* =
nullptr)
const;
231 bool isTextureBacked()
const;
238 GrBackendObject getTextureHandle(
bool flushPendingGrContextIO)
const;
247 kDisallow_CachingHint,
268 bool readPixels(
const SkImageInfo& dstInfo,
void* dstPixels,
size_t dstRowBytes,
269 int srcX,
int srcY, CachingHint = kAllow_CachingHint)
const;
271 bool readPixels(
const SkPixmap& dst,
int srcX,
int srcY,
272 CachingHint = kAllow_CachingHint)
const;
281 bool scalePixels(
const SkPixmap& dst, SkFilterQuality, CachingHint = kAllow_CachingHint)
const;
293 SkData* encode(SkImageEncoder::Type,
int quality)
const;
320 SkData* refEncoded()
const;
322 const char* toString(
SkString*)
const;
370 int preScaleMipLevel)
371 : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipLevel) {}
373 SkFilterQuality fQuality;
374 int fPreScaleMipLevel;
411 enum LegacyBitmapMode {
412 kRO_LegacyBitmapMode,
413 kRW_LegacyBitmapMode,
425 bool asLegacyBitmap(
SkBitmap*, LegacyBitmapMode)
const;
431 bool isLazyGenerated()
const;
434 #ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY
435 static SkImage* NewRasterCopy(
const Info&,
const void* pixels,
size_t rowBytes,
437 static SkImage* NewRasterData(
const Info&,
SkData* pixels,
size_t rowBytes);
438 static SkImage* NewFromRaster(
const Info&,
const void* pixels,
size_t rowBytes,
439 RasterReleaseProc, ReleaseContext);
444 return NewFromTexture(ctx, desc, kPremul_SkAlphaType,
nullptr,
nullptr);
448 return NewFromTexture(ctx, de, at,
nullptr,
nullptr);
451 TextureReleaseProc, ReleaseContext);
453 SkAlphaType = kPremul_SkAlphaType);
455 const GrBackendObject yuvTextureHandles[3],
461 static SkImage* NewFromDeferredTextureImageData(
GrContext*,
const void*, SkBudgeted);
463 SkImage* newSubset(
const SkIRect& subset)
const {
return this->makeSubset(subset).release(); }
464 SkImage* newTextureImage(
GrContext* ctx)
const {
return this->makeTextureImage(ctx).release(); }
468 SkImage(
int width,
int height, uint32_t uniqueID);
477 const uint32_t fUniqueID;
CachingHint
Hints to image calls where the system might cache computed intermediates (e.g.
Definition: SkImage.h:245
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:58
Definition: GrTypes.h:557
Describe an image's dimensions and pixel type.
Definition: SkImageInfo.h:181
Shaders specify the source color(s) for what is being drawn.
Definition: SkShader.h:38
SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps...
Definition: SkColorTable.h:25
An interface that allows a purgeable PixelRef (such as a SkDiscardablePixelRef) to decode and re-deco...
Definition: SkImageGenerator.h:62
Pairs SkImageInfo with actual pixels and rowbytes.
Definition: SkPixmap.h:23
static sk_sp< SkImage > MakeFromTexture(GrContext *ctx, const GrBackendTextureDesc &desc)
Create a new image from the specified descriptor.
Definition: SkImage.h:92
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
SkSurface represents the backend/results of drawing to a canvas.
Definition: SkSurface.h:31
Definition: SkRefCnt.h:135
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:46
An SkPicture records drawing commands made to a canvas to be played back at a later time...
Definition: SkPicture.h:38
SkData holds an immutable data buffer.
Definition: SkData.h:22
static sk_sp< SkImage > MakeFromTexture(GrContext *ctx, const GrBackendTextureDesc &desc, SkAlphaType at, TextureReleaseProc trp, ReleaseContext rc)
Create a new image from the specified descriptor.
Definition: SkImage.h:110
The SkBitmap class specifies a raster bitmap.
Definition: SkBitmap.h:41
Base class for image filters.
Definition: SkImageFilter.h:35
Definition: GrTypes.h:459
Definition: GrContext.h:48
Interface for serializing pixels, e.g.
Definition: SkPixelSerializer.h:19
TileMode
Definition: SkShader.h:51
SkIRect holds four 32 bit integer coordinates for a rectangle.
Definition: SkRect.h:20
Definition: GrTexture.h:19
SkImage is an abstraction for drawing a rectagle of pixels, though the particular type of image could...
Definition: SkImage.h:45
SkIPoint holds two 32 bit integer coordinates.
Definition: SkPoint.h:40
Drawing params for which a deferred texture image data should be optimized.
Definition: SkImage.h:367
Light weight class for managing strings.
Definition: SkString.h:121
Can be used to perform actions related to the generating GrContext in a thread safe manner...
Definition: GrContext.h:481