| 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 "SkSize.h" | 11 #include "SkSize.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 | 13 |
| 14 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 14 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 15 | 15 |
| 16 #ifdef SK_BUILD_FOR_MAC | 16 #ifdef SK_BUILD_FOR_MAC |
| 17 #include <ApplicationServices/ApplicationServices.h> | 17 #include <ApplicationServices/ApplicationServices.h> |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 #ifdef SK_BUILD_FOR_IOS | 20 #ifdef SK_BUILD_FOR_IOS |
| 21 #include <CoreGraphics/CoreGraphics.h> | 21 #include <CoreGraphics/CoreGraphics.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class SkBitmap; | 24 class SkBitmap; |
| 25 class SkData; | 25 class SkData; |
| 26 class SkStream; | 26 class SkStreamRewindable; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Given a CGImage, allocate an SkBitmap and copy the image's pixels into it. I
f scaleToFit is not | 29 * Given a CGImage, allocate an SkBitmap and copy the image's pixels into it. I
f scaleToFit is not |
| 30 * null, use it to determine the size of the bitmap, and scale the image to fil
l the bitmap. | 30 * null, use it to determine the size of the bitmap, and scale the image to fil
l the bitmap. |
| 31 * Otherwise use the image's width/height. | 31 * Otherwise use the image's width/height. |
| 32 * | 32 * |
| 33 * On failure, return false, and leave bitmap unchanged. | 33 * On failure, return false, and leave bitmap unchanged. |
| 34 */ | 34 */ |
| 35 SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* sc
aleToFit = NULL); | 35 SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* sc
aleToFit = NULL); |
| 36 | 36 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Draw the bitmap into the specified CG context. The bitmap will be converted | 60 * Draw the bitmap into the specified CG context. The bitmap will be converted |
| 61 * to a CGImage using the generic RGB colorspace. (x,y) specifies the position | 61 * to a CGImage using the generic RGB colorspace. (x,y) specifies the position |
| 62 * of the top-left corner of the bitmap. The bitmap is converted using the | 62 * of the top-left corner of the bitmap. The bitmap is converted using the |
| 63 * colorspace returned by CGColorSpaceCreateDeviceRGB() | 63 * colorspace returned by CGColorSpaceCreateDeviceRGB() |
| 64 */ | 64 */ |
| 65 void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y); | 65 void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y); |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Create an SkBitmap drawing of the encoded PDF document, returning true on | 68 * Return a provider that wraps the specified stream. |
| 69 * success. Deletes the stream when finished. | |
| 70 */ | |
| 71 bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output); | |
| 72 | |
| 73 /** | |
| 74 * Return a provider that wraps the specified stream. It will become the only | |
| 75 * owner of the stream, so the caller must stop referring to the stream. | |
| 76 * | |
| 77 * When the provider is finally deleted, it will delete the stream. | 69 * When the provider is finally deleted, it will delete the stream. |
| 78 */ | 70 */ |
| 79 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); | 71 CGDataProviderRef SkCreateDataProviderFromStream(std::unique_ptr<SkStreamRewinda
ble>); |
| 80 | 72 |
| 81 CGDataProviderRef SkCreateDataProviderFromData(SkData*); | 73 CGDataProviderRef SkCreateDataProviderFromData(sk_sp<SkData>); |
| 82 | 74 |
| 83 #endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 75 #endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 84 #endif // SkCGUtils_DEFINED | 76 #endif // SkCGUtils_DEFINED |
| OLD | NEW |