2008-12-18 19:26:11 +00:00
|
|
|
#ifndef SkCGUtils_DEFINED
|
|
|
|
#define SkCGUtils_DEFINED
|
|
|
|
|
2010-12-20 18:26:13 +00:00
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
#ifdef SK_BUILD_FOR_MAC
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
#else
|
|
|
|
#include <CoreGraphics/CoreGraphics.h>
|
|
|
|
#endif
|
2008-12-18 19:26:11 +00:00
|
|
|
|
|
|
|
class SkBitmap;
|
|
|
|
|
2011-01-03 13:48:50 +00:00
|
|
|
/**
|
|
|
|
* Create an imageref from the specified bitmap using the specified colorspace.
|
2011-01-05 16:29:02 +00:00
|
|
|
* If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
|
2011-01-03 13:48:50 +00:00
|
|
|
*/
|
|
|
|
CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
|
|
|
|
CGColorSpaceRef space);
|
2008-12-18 19:26:11 +00:00
|
|
|
|
2011-01-03 13:48:50 +00:00
|
|
|
/**
|
2011-01-05 16:29:02 +00:00
|
|
|
* Create an imageref from the specified bitmap using the colorspace returned
|
|
|
|
* by CGColorSpaceCreateDeviceRGB()
|
2011-01-03 13:48:50 +00:00
|
|
|
*/
|
2011-01-04 01:29:52 +00:00
|
|
|
static inline CGImageRef SkCreateCGImageRef(const SkBitmap& bm) {
|
2011-01-03 13:48:50 +00:00
|
|
|
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
|
2011-01-05 16:29:02 +00:00
|
|
|
* of the top-left corner of the bitmap. The bitmap is converted using the
|
|
|
|
* colorspace returned by CGColorSpaceCreateDeviceRGB()
|
2011-01-03 13:48:50 +00:00
|
|
|
*/
|
2010-12-20 18:26:13 +00:00
|
|
|
void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
|
|
|
|
|
2008-12-18 19:26:11 +00:00
|
|
|
#endif
|