Flutter Engine
The Flutter Engine
|
#include <SkAndroidCodec.h>
Classes | |
struct | AndroidOptions |
Public Types | |
enum class | ExifOrientationBehavior { kIgnore , kRespect } |
Static Public Member Functions | |
static std::unique_ptr< SkAndroidCodec > | MakeFromCodec (std::unique_ptr< SkCodec >) |
static std::unique_ptr< SkAndroidCodec > | MakeFromStream (std::unique_ptr< SkStream >, SkPngChunkReader *=nullptr) |
static std::unique_ptr< SkAndroidCodec > | MakeFromData (sk_sp< SkData >, SkPngChunkReader *=nullptr) |
Protected Member Functions | |
SkAndroidCodec (SkCodec *) | |
virtual SkISize | onGetSampledDimensions (int sampleSize) const =0 |
virtual bool | onGetSupportedSubset (SkIRect *desiredSubset) const =0 |
virtual SkCodec::Result | onGetAndroidPixels (const SkImageInfo &info, void *pixels, size_t rowBytes, const AndroidOptions &options)=0 |
Abstract interface defining image codec functionality that is necessary for Android.
Definition at line 39 of file SkAndroidCodec.h.
|
strong |
Deprecated.
Now that SkAndroidCodec supports multiframe images, there are multiple ways to handle compositing an oriented frame on top of an oriented frame with different tradeoffs. SkAndroidCodec now ignores the orientation and forces the client to handle it.
Enumerator | |
---|---|
kIgnore | |
kRespect |
Definition at line 49 of file SkAndroidCodec.h.
|
virtual |
Definition at line 204 of file SkAndroidCodec.cpp.
|
protected |
Definition at line 199 of file SkAndroidCodec.cpp.
|
inline |
Definition at line 264 of file SkAndroidCodec.h.
SkAlphaType SkAndroidCodec::computeOutputAlphaType | ( | bool | requestedUnpremul | ) |
requestedUnpremul | Indicates if the client requested unpremultiplied output |
Returns the appropriate alpha type to decode to. If the image has alpha, the value of requestedUnpremul will be honored.
Definition at line 297 of file SkAndroidCodec.cpp.
sk_sp< SkColorSpace > SkAndroidCodec::computeOutputColorSpace | ( | SkColorType | outputColorType, |
sk_sp< SkColorSpace > | prefColorSpace = nullptr |
||
) |
outputColorType | Color type that the client will decode to. |
prefColorSpace | Preferred color space to decode to. This may not return |prefColorSpace| for specific color types. |
Returns the appropriate color space to decode to.
Definition at line 304 of file SkAndroidCodec.cpp.
SkColorType SkAndroidCodec::computeOutputColorType | ( | SkColorType | requestedColorType | ) |
requestedColorType | Color type requested by the client |
|requestedColorType| may be overriden. We will default to kF16 for high precision images.
In the general case, if it is possible to decode to |requestedColorType|, this returns |requestedColorType|. Otherwise, this returns a color type that is an appropriate match for the the encoded data.
Definition at line 259 of file SkAndroidCodec.cpp.
Compute the appropriate sample size to get to |size|.
size | As an input parameter, the desired output size of the decode. As an output parameter, the smallest sampled size larger than the input. |
Definition at line 367 of file SkAndroidCodec.cpp.
bool SkAndroidCodec::getAndroidGainmap | ( | SkGainmapInfo * | outInfo, |
std::unique_ptr< SkStream > * | outGainmapImageStream | ||
) |
Retrieve the gainmap for an image.
outInfo | On success, this is populated with the parameters for rendering this gainmap. This parameter must be non-nullptr. |
outGainmapImageStream | On success, this is populated with a stream from which the gainmap image may be decoded. This parameter is optional, and may be set to nullptr. |
Definition at line 544 of file SkAndroidCodec.cpp.
SkCodec::Result SkAndroidCodec::getAndroidPixels | ( | const SkImageInfo & | info, |
void * | pixels, | ||
size_t | rowBytes | ||
) |
Simplified version of getAndroidPixels() where we supply the default AndroidOptions as specified above for AndroidOptions. It will not perform any scaling or subsetting.
Definition at line 539 of file SkAndroidCodec.cpp.
SkCodec::Result SkAndroidCodec::getAndroidPixels | ( | const SkImageInfo & | info, |
void * | pixels, | ||
size_t | rowBytes, | ||
const AndroidOptions * | options | ||
) |
Decode into the given pixels, a block of memory of size at least (info.fHeight - 1) * rowBytes + (info.fWidth * bytesPerPixel)
Repeated calls to this function should give the same results, allowing the PixelRef to be immutable.
info | A description of the format (config, size) expected by the caller. This can simply be identical to the info returned by getInfo(). |
This contract also allows the caller to specify different output-configs, which the implementation can decide to support or not.
A size that does not match getInfo() implies a request to scale or subset. If the codec cannot perform this scaling or subsetting, it will return an error code.
The AndroidOptions object is also used to specify any requested scaling or subsetting using options->fSampleSize and options->fSubset. If NULL, the defaults (as specified above for AndroidOptions) are used.
Definition at line 490 of file SkAndroidCodec.cpp.
|
inline |
Format of the encoded data.
Definition at line 97 of file SkAndroidCodec.h.
|
inline |
Return the ICC profile of the encoded data.
Definition at line 90 of file SkAndroidCodec.h.
|
inline |
Definition at line 85 of file SkAndroidCodec.h.
|
inline |
Definition at line 260 of file SkAndroidCodec.h.
Returns the dimensions of the scaled output image, for an input sampleSize.
When the sample size divides evenly into the original dimensions, the scaled output dimensions will simply be equal to the original dimensions divided by the sample size.
When the sample size does not divide even into the original dimensions, the codec may round up or down, depending on what is most efficient to decode.
Finally, the codec will always recommend a non-zero output, so the output dimension will always be one if the sampleSize is greater than the original dimension.
Definition at line 445 of file SkAndroidCodec.cpp.
Returns the dimensions of the scaled, partial output image, for an input sampleSize and subset.
sampleSize | Factor to scale down by. |
subset | Must be a valid subset of the original image dimensions and a subset supported by SkAndroidCodec. getSubset() can be used to obtain a subset supported by SkAndroidCodec. |
Definition at line 466 of file SkAndroidCodec.cpp.
bool SkAndroidCodec::getSupportedSubset | ( | SkIRect * | desiredSubset | ) | const |
Return (via desiredSubset) a subset which can decoded from this codec, or false if the input subset is invalid.
desiredSubset | in/out parameter As input, a desired subset of the original bounds (as specified by getInfo). As output, if true is returned, desiredSubset may have been modified to a subset which is supported. Although a particular change may have been made to desiredSubset to create something supported, it is possible other changes could result in a valid subset. If false is returned, desiredSubset's value is undefined. |
Definition at line 458 of file SkAndroidCodec.cpp.
|
static |
Pass ownership of an SkCodec to a newly-created SkAndroidCodec.
Definition at line 212 of file SkAndroidCodec.cpp.
|
static |
If this data represents an encoded image that we know how to decode, return an SkAndroidCodec that can decode it. Otherwise return NULL.
The SkPngChunkReader handles unknown chunks in PNGs. See SkCodec.h for more details.
Definition at line 250 of file SkAndroidCodec.cpp.
|
static |
If this stream represents an encoded image that we know how to decode, return an SkAndroidCodec that can decode it. Otherwise return NULL.
The SkPngChunkReader handles unknown chunks in PNGs. See SkCodec.h for more details.
If NULL is returned, the stream is deleted immediately. Otherwise, the SkCodec takes ownership of it, and will delete it when done with it.
Definition at line 206 of file SkAndroidCodec.cpp.
|
protectedpure virtual |
Implemented in SkAndroidCodecAdapter, and SkSampledCodec.
|
protectedpure virtual |
Implemented in SkAndroidCodecAdapter, and SkSampledCodec.
|
protectedpure virtual |
Implemented in SkAndroidCodecAdapter, and SkSampledCodec.