| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SKIA_EXT_SKIA_UTILS_IOS_H_ | 5 #ifndef SKIA_EXT_SKIA_UTILS_IOS_H_ |
| 6 #define SKIA_EXT_SKIA_UTILS_IOS_H_ | 6 #define SKIA_EXT_SKIA_UTILS_IOS_H_ |
| 7 | 7 |
| 8 #include <CoreGraphics/CoreGraphics.h> | 8 #include <CoreGraphics/CoreGraphics.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 13 | 13 |
| 14 #ifdef __OBJC__ | 14 #ifdef __OBJC__ |
| 15 @class UIColor; | 15 @class UIColor; |
| 16 @class UIImage; | 16 @class UIImage; |
| 17 @class NSData; | 17 @class NSData; |
| 18 #else | 18 #else |
| 19 class UIColor; | 19 class UIColor; |
| 20 class UIImage; | 20 class UIImage; |
| 21 class NSData; | 21 class NSData; |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace gfx { | 24 namespace skia { |
| 25 | 25 |
| 26 // Draws a CGImage into an SkBitmap of the given size. | 26 // Draws a CGImage into an SkBitmap of the given size. |
| 27 SK_API SkBitmap CGImageToSkBitmap(CGImageRef image, | 27 SK_API SkBitmap CGImageToSkBitmap(CGImageRef image, |
| 28 CGSize size, | 28 CGSize size, |
| 29 bool is_opaque); | 29 bool is_opaque); |
| 30 | 30 |
| 31 // Given an SkBitmap and a color space, return an autoreleased UIImage. | 31 // Given an SkBitmap and a color space, return an autoreleased UIImage. |
| 32 SK_API UIImage* SkBitmapToUIImageWithColorSpace(const SkBitmap& skia_bitmap, | 32 SK_API UIImage* SkBitmapToUIImageWithColorSpace(const SkBitmap& skia_bitmap, |
| 33 CGFloat scale, | 33 CGFloat scale, |
| 34 CGColorSpaceRef color_space); | 34 CGColorSpaceRef color_space); |
| 35 | 35 |
| 36 // Decodes all image representations inside the data into a vector of SkBitmaps. | 36 // Decodes all image representations inside the data into a vector of SkBitmaps. |
| 37 // Returns a vector of all the successfully decoded representations or an empty | 37 // Returns a vector of all the successfully decoded representations or an empty |
| 38 // vector if none can be decoded. | 38 // vector if none can be decoded. |
| 39 SK_API std::vector<SkBitmap> ImageDataToSkBitmaps(NSData* image_data); | 39 SK_API std::vector<SkBitmap> ImageDataToSkBitmaps(NSData* image_data); |
| 40 | 40 |
| 41 // Returns a UIColor for an SKColor. Used by iOS downstream. | 41 // Returns a UIColor for an SKColor. Used by iOS downstream. |
| 42 SK_API UIColor* UIColorFromSkColor(SkColor color); | 42 SK_API UIColor* UIColorFromSkColor(SkColor color); |
| 43 | 43 |
| 44 } // namespace gfx | 44 } // namespace skia |
| 45 | 45 |
| 46 #endif // SKIA_EXT_SKIA_UTILS_IOS_H_ | 46 #endif // SKIA_EXT_SKIA_UTILS_IOS_H_ |
| OLD | NEW |