| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ |
| 6 #define UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ | 6 #define UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ |
| 7 | 7 |
| 8 #include <ApplicationServices/ApplicationServices.h> |
| 9 |
| 8 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| 9 | 11 |
| 10 #ifdef __LP64__ | 12 #ifdef __LP64__ |
| 11 #include <ApplicationServices/ApplicationServices.h> | |
| 12 typedef CGSize NSSize; | 13 typedef CGSize NSSize; |
| 13 #else | 14 #else |
| 14 typedef struct _NSSize NSSize; | 15 typedef struct _NSSize NSSize; |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 #ifdef __OBJC__ | 18 #ifdef __OBJC__ |
| 18 @class NSImage; | 19 @class NSImage; |
| 19 #else | 20 #else |
| 20 class NSImage; | 21 class NSImage; |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| 24 class ImageSkia; | 25 class ImageSkia; |
| 25 | 26 |
| 26 // Converts to ImageSkia from NSImage. | 27 // Converts to ImageSkia from NSImage. |
| 27 UI_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image); | 28 UI_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image); |
| 28 | 29 |
| 29 // Resizes NSImage to |size| DIP and then converts to ImageSkia. | 30 // Resizes NSImage to |size| DIP and then converts to ImageSkia. |
| 30 UI_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, | 31 UI_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, |
| 31 NSSize size); | 32 NSSize size); |
| 32 | 33 |
| 33 // Resizes |[NSImage imageNamed:@NSApplicationIcon]| to have edge width of | 34 // Resizes |[NSImage imageNamed:@NSApplicationIcon]| to have edge width of |
| 34 // |size| DIP and returns result as ImageSkia. | 35 // |size| DIP and returns result as ImageSkia. |
| 35 UI_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size); | 36 UI_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size); |
| 36 | 37 |
| 37 // Converts to NSImage from ImageSkia. | 38 // Converts to NSImage from ImageSkia. |
| 38 UI_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia); | 39 UI_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia); |
| 39 | 40 |
| 41 // Converts to NSImage from given ImageSkia and a color space. |
| 42 UI_EXPORT NSImage* NSImageFromImageSkiaWithColorSpace( |
| 43 const gfx::ImageSkia& image_skia, |
| 44 CGColorSpaceRef color_space); |
| 45 |
| 40 } // namespace gfx | 46 } // namespace gfx |
| 41 | 47 |
| 42 #endif // UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ | 48 #endif // UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_ |
| OLD | NEW |