aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-22 20:24:33 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-22 20:24:33 +0000
commit60b5dce19984a5165f6b2f1d6d477f5e8a940761 (patch)
treeb54e4d9df7b9b1e03307be9f5043b0be92df6a2f /include/utils
parent945ec3a2bec668ca845071a65df8ec55e8f43819 (diff)
expose CGImage -> SkBitmap
BUG=skia: R=scroggo@google.com, halcanary@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/243463005 git-svn-id: http://skia.googlecode.com/svn/trunk@14315 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/mac/SkCGUtils.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h
index 54c858c1ae..a0fe666d2c 100644
--- a/include/utils/mac/SkCGUtils.h
+++ b/include/utils/mac/SkCGUtils.h
@@ -8,7 +8,8 @@
#ifndef SkCGUtils_DEFINED
#define SkCGUtils_DEFINED
-#include "SkTypes.h"
+#include "SkSize.h"
+#include "SkImageInfo.h"
#ifdef SK_BUILD_FOR_MAC
#include <ApplicationServices/ApplicationServices.h>
@@ -23,6 +24,22 @@ class SkData;
class SkStream;
/**
+ * Given a CGImage, allocate an SkBitmap and copy the image's pixels into it. If scaleToFit is not
+ * null, use it to determine the size of the bitmap, and scale the image to fill the bitmap.
+ * Otherwise use the image's width/height.
+ *
+ * On failure, return false, and leave bitmap unchanged.
+ */
+SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* scaleToFit = NULL);
+
+/**
+ * Copy the pixels from src into the memory specified by info/rowBytes/dstPixels. On failure,
+ * return false (e.g. ImageInfo incompatible with src).
+ */
+SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, void* dstPixels,
+ CGImageRef src);
+
+/**
* Create an imageref from the specified bitmap using the specified colorspace.
* If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
*/