skia2/include/utils/mac/SkCGUtils.h
reed@android.com 4aaee0aecd static inline eliminates multiple definitions (and makes it zero-cost, since
it will be inlined)



git-svn-id: http://skia.googlecode.com/svn/trunk@668 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-04 01:29:52 +00:00

36 lines
944 B
C++

#ifndef SkCGUtils_DEFINED
#define SkCGUtils_DEFINED
#include "SkTypes.h"
#ifdef SK_BUILD_FOR_MAC
#include <Carbon/Carbon.h>
#else
#include <CoreGraphics/CoreGraphics.h>
#endif
class SkBitmap;
/**
* Create an imageref from the specified bitmap using the specified colorspace.
*/
CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
CGColorSpaceRef space);
/**
* Create an imageref from the specified bitmap using the colorspace
* kCGColorSpaceGenericRGB
*/
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.
*/
void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
#endif