24 const char* source_path = argc > 1 ?
argv[1] :
nullptr;
26 SkDebugf(
"Please pass an image or profile to convert"
27 " as the first argument to this program.\n");
31 const char* dst_profile_path = argc > 2 ?
argv[2] :
nullptr;
34 if (dst_profile_path) {
37 SkDebugf(
"Can't parse %s as an ICC profile.\n", dst_profile_path);
45 if (
skcms_Parse(blob->data(), blob->size(), &src_profile)) {
68 for (
int i = 0;
i < 8;
i++) {
69 SkDebugf(
"(%g, %g, %g) --> (%+.4f, %+.4f, %+.4f)\n",
78 SkDebugf(
"Couldn't decode %s as an SkImage or an ICC profile.\n", source_path);
84 SkDebugf(
"Converting to raster image failed.\n");
90 SkDebugf(
"We really should be able to peek raster pixels.\n");
96 SkDebugf(
"We can't convert to this destination profile as-is. Coercing it.\n");
101 SkDebugf(
"We can't convert to this destination profile at all.\n");
116 SkDebugf(
"color type %d not yet supported, imgcvt.cpp needs an update.\n",
122 SkDebugf(
"not premul, that's weird.\n");
128 SkDebugf(
"not a tight pixmap, need a loop here\n");
135 SkDebugf(
"skcms_Transform() failed\n");
146 SkDebugf(
"couldn't create a surface\n");
150 surface->writePixels(pixmap, 0,0);
158 SkDebugf(
"couldn't create a surface\n");
SkColorSpace * sk_srgb_singleton()
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void toProfile(skcms_ICCProfile *) const
static sk_sp< SkColorSpace > Make(const skcms_ICCProfile &)
const void * data() const
static sk_sp< SkData > MakeFromFileName(const char path[])
bool write(const void *buffer, size_t size) override
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
SkColorSpace * colorSpace() const
bool peekPixels(SkPixmap *pixmap) const
SkColorType colorType() const
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
const SkImageInfo & info() const
void * writable_addr() const
const void * addr() const
SkAlphaType alphaType() const
int main(int argc, char **argv)
static void write_png(const char *path, sk_sp< SkImage > img)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API sk_sp< SkImage > RasterFromPixmapCopy(const SkPixmap &pixmap)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static SkString fmt(SkColor4f c)
bool skcms_Transform(const void *src, skcms_PixelFormat srcFmt, skcms_AlphaFormat srcAlpha, const skcms_ICCProfile *srcProfile, void *dst, skcms_PixelFormat dstFmt, skcms_AlphaFormat dstAlpha, const skcms_ICCProfile *dstProfile, size_t nz)
bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile *profile)
const skcms_ICCProfile * skcms_sRGB_profile()
@ skcms_PixelFormat_BGRA_8888
@ skcms_PixelFormat_RGB_fff
@ skcms_PixelFormat_RGBA_8888
static bool skcms_Parse(const void *buf, size_t len, skcms_ICCProfile *profile)
@ skcms_AlphaFormat_Unpremul
@ skcms_AlphaFormat_PremulAsEncoded
int bytesPerPixel() const
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const