368b419200
Required for the chromium/mac components build. BUG=chromium:90078 Review URL: https://codereview.appspot.com/5642073/ git-svn-id: http://skia.googlecode.com/svn/trunk@3160 2bbb7eff-a529-9590-31e7-b0007b416f81
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
|
|
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
#ifndef SkCGUtils_DEFINED
|
|
#define SkCGUtils_DEFINED
|
|
|
|
#include "SkTypes.h"
|
|
|
|
#ifdef SK_BUILD_FOR_MAC
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
#endif
|
|
|
|
#ifdef SK_BUILD_FOR_IOS
|
|
#include <CoreGraphics/CoreGraphics.h>
|
|
#endif
|
|
|
|
class SkBitmap;
|
|
class SkStream;
|
|
|
|
/**
|
|
* Create an imageref from the specified bitmap using the specified colorspace.
|
|
* If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
|
|
*/
|
|
SK_API 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);
|
|
|
|
bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output);
|
|
|
|
#endif
|