| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef SkCGUtils_DEFINED | 8 #ifndef SkCGUtils_DEFINED |
| 9 #define SkCGUtils_DEFINED | 9 #define SkCGUtils_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkSize.h" |
| 12 #include "SkImageInfo.h" |
| 12 | 13 |
| 13 #ifdef SK_BUILD_FOR_MAC | 14 #ifdef SK_BUILD_FOR_MAC |
| 14 #include <ApplicationServices/ApplicationServices.h> | 15 #include <ApplicationServices/ApplicationServices.h> |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 #ifdef SK_BUILD_FOR_IOS | 18 #ifdef SK_BUILD_FOR_IOS |
| 18 #include <CoreGraphics/CoreGraphics.h> | 19 #include <CoreGraphics/CoreGraphics.h> |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 class SkBitmap; | 22 class SkBitmap; |
| 22 class SkData; | 23 class SkData; |
| 23 class SkStream; | 24 class SkStream; |
| 24 | 25 |
| 25 /** | 26 /** |
| 27 * Given a CGImage, allocate an SkBitmap and copy the image's pixels into it. I
f scaleToFit is not |
| 28 * null, use it to determine the size of the bitmap, and scale the image to fil
l the bitmap. |
| 29 * Otherwise use the image's width/height. |
| 30 * |
| 31 * On failure, return false, and leave bitmap unchanged. |
| 32 */ |
| 33 SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* sc
aleToFit = NULL); |
| 34 |
| 35 /** |
| 36 * Copy the pixels from src into the memory specified by info/rowBytes/dstPixel
s. On failure, |
| 37 * return false (e.g. ImageInfo incompatible with src). |
| 38 */ |
| 39 SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, vo
id* dstPixels, |
| 40 CGImageRef src); |
| 41 |
| 42 /** |
| 26 * Create an imageref from the specified bitmap using the specified colorspace. | 43 * Create an imageref from the specified bitmap using the specified colorspace. |
| 27 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. | 44 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. |
| 28 */ | 45 */ |
| 29 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, | 46 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, |
| 30 CGColorSpaceRef space); | 47 CGColorSpaceRef space); |
| 31 | 48 |
| 32 /** | 49 /** |
| 33 * Create an imageref from the specified bitmap using the colorspace returned | 50 * Create an imageref from the specified bitmap using the colorspace returned |
| 34 * by CGColorSpaceCreateDeviceRGB() | 51 * by CGColorSpaceCreateDeviceRGB() |
| 35 */ | 52 */ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 * CGDataProviderRef provider = SkStreamToDataProvider(stream); | 75 * CGDataProviderRef provider = SkStreamToDataProvider(stream); |
| 59 * stream->unref(); | 76 * stream->unref(); |
| 60 * | 77 * |
| 61 * Now when the provider is finally deleted, it will delete the stream. | 78 * Now when the provider is finally deleted, it will delete the stream. |
| 62 */ | 79 */ |
| 63 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); | 80 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); |
| 64 | 81 |
| 65 CGDataProviderRef SkCreateDataProviderFromData(SkData*); | 82 CGDataProviderRef SkCreateDataProviderFromData(SkData*); |
| 66 | 83 |
| 67 #endif | 84 #endif |
| OLD | NEW |