aboutsummaryrefslogtreecommitdiffstats
path: root/include/utils/mac/SkCGUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/utils/mac/SkCGUtils.h')
-rw-r--r--include/utils/mac/SkCGUtils.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h
index 3b74b55..db67edf 100644
--- a/include/utils/mac/SkCGUtils.h
+++ b/include/utils/mac/SkCGUtils.h
@@ -1,10 +1,37 @@
#ifndef SkCGUtils_DEFINED
#define SkCGUtils_DEFINED
-#include <Carbon/Carbon.h>
+#include "SkTypes.h"
+
+#ifdef SK_BUILD_FOR_MAC
+ #include <Carbon/Carbon.h>
+#else
+ #include <CoreGraphics/CoreGraphics.h>
+#endif
class SkBitmap;
-CGImageRef SkCreateCGImageRef(const SkBitmap&);
+/**
+ * Create an imageref from the specified bitmap using the specified colorspace.
+ * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
+ */
+CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
+ CGColorSpaceRef space);
+
+/**
+ * Create an imageref from the specified bitmap using the colorspace returned
+ * by CGColorSpaceCreateDeviceRGB()
+ */
+static inline CGImageRef SkCreateCGImageRef(const SkBitmap& bm) {
+ return SkCreateCGImageRefWithColorspace(bm, NULL);
+}
+
+/**
+ * Draw the bitmap into the specified CG context. The bitmap will be converted
+ * to a CGImage using the generic RGB colorspace. (x,y) specifies the position
+ * of the top-left corner of the bitmap. The bitmap is converted using the
+ * colorspace returned by CGColorSpaceCreateDeviceRGB()
+ */
+void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
#endif