8 #ifndef SkImage_DEFINED
9 #define SkImage_DEFINED
11 #include "SkFilterQuality.h"
12 #include "SkImageInfo.h"
13 #include "SkImageEncoder.h"
32 struct AHardwareBuffer;
51 typedef void* ReleaseContext;
56 typedef void (*RasterReleaseProc)(
const void* pixels, ReleaseContext);
79 static sk_sp<SkImage> MakeFromGenerator(std::unique_ptr<SkImageGenerator>,
80 const SkIRect* subset =
nullptr);
100 return MakeFromTexture(ctx, desc, kPremul_SkAlphaType,
nullptr,
nullptr,
nullptr);
105 return MakeFromTexture(ctx, de, at,
nullptr,
nullptr,
nullptr);
108 typedef void (*TextureReleaseProc)(ReleaseContext);
121 SkAlphaType at, TextureReleaseProc trp,
123 return MakeFromTexture(ctx, desc, at,
nullptr, trp, rc);
148 return MakeFromTexture(ctx, tex, origin, at, cs,
nullptr,
nullptr);
161 TextureReleaseProc, ReleaseContext);
189 SkAlphaType = kPremul_SkAlphaType,
200 SkAlphaType = kPremul_SkAlphaType,
209 const GrBackendObject yuvTextureHandles[3],
220 const GrBackendObject nv12TextureHandles[2],
221 const SkISize nv12Sizes[2], GrSurfaceOrigin,
224 enum class BitDepth {
237 #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
243 SkAlphaType = kPremul_SkAlphaType,
249 int width()
const {
return fWidth; }
250 int height()
const {
return fHeight; }
251 SkISize dimensions()
const {
return SkISize::Make(fWidth, fHeight); }
252 SkIRect bounds()
const {
return SkIRect::MakeWH(fWidth, fHeight); }
253 uint32_t uniqueID()
const {
return fUniqueID; }
254 SkAlphaType alphaType()
const;
269 bool isAlphaOnly()
const;
270 bool isOpaque()
const {
return SkAlphaTypeIsOpaque(this->alphaType()); }
273 const SkMatrix* localMatrix =
nullptr)
const;
288 bool peekPixels(
SkPixmap* pixmap)
const;
296 bool isTextureBacked()
const;
315 GrBackendObject getTextureHandle(
bool flushPendingGrContextIO,
316 GrSurfaceOrigin* origin =
nullptr)
const;
325 kDisallow_CachingHint,
346 bool readPixels(
const SkImageInfo& dstInfo,
void* dstPixels,
size_t dstRowBytes,
347 int srcX,
int srcY, CachingHint = kAllow_CachingHint)
const;
349 bool readPixels(
const SkPixmap& dst,
int srcX,
int srcY,
350 CachingHint = kAllow_CachingHint)
const;
359 bool scalePixels(
const SkPixmap& dst, SkFilterQuality, CachingHint = kAllow_CachingHint)
const;
371 SkData* encode(SkEncodedImageFormat,
int quality)
const;
398 SkData* refEncoded()
const;
400 const char* toString(
SkString*)
const;
448 int preScaleMipLevel)
449 : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipLevel) {}
451 SkFilterQuality fQuality;
452 int fPreScaleMipLevel;
489 SkColorType dstColorType = kN32_SkColorType)
const;
500 enum LegacyBitmapMode {
501 kRO_LegacyBitmapMode,
502 kRW_LegacyBitmapMode,
514 bool asLegacyBitmap(
SkBitmap*, LegacyBitmapMode)
const;
520 bool isLazyGenerated()
const;
536 SkTransferFunctionBehavior premulBehavior)
const;
539 SkImage(
int width,
int height, uint32_t uniqueID);
540 friend class SkImage_Base;
544 SkBudgeted, SkDestinationSurfaceColorMode);
548 const uint32_t fUniqueID;
CachingHint
Hints to image calls where the system might cache computed intermediates (e.g.
Definition: SkImage.h:323
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:59
Definition: GrTypes.h:679
Definition: SkColorSpace.h:59
Describe an image's dimensions and pixel type.
Definition: SkImageInfo.h:181
SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps...
Definition: SkColorTable.h:25
static sk_sp< SkImage > MakeFromTexture(GrContext *ctx, const GrBackendTexture &tex, GrSurfaceOrigin origin, SkAlphaType at, sk_sp< SkColorSpace > cs)
Create a new image from the specified descriptor.
Definition: SkImage.h:145
Definition: SkImageGenerator.h:27
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:99
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:28
SkSurface is responsible for managing the pixels that a canvas draws into.
Definition: SkSurface.h:32
Definition: SkRefCnt.h:125
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:45
Definition: GrBackendSurface.h:18
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:120
The SkBitmap class specifies a raster bitmap.
Definition: SkBitmap.h:37
Base class for image filters.
Definition: SkImageFilter.h:36
Definition: GrTypes.h:581
Definition: GrContext.h:47
Interface for serializing pixels, e.g.
Definition: SkPixelSerializer.h:19
TileMode
Definition: SkShader.h:43
replicate the edge color if the shader draws outside of its original bounds
Definition: SkShader.h:47
sk_sp< SkShader > makeShader(const SkMatrix *localMatrix=nullptr) const
Helper version of makeShader() that specifies Clamp tilemode.
Definition: SkImage.h:277
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:48
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:446
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:361