• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_
6 #define UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_
7 
8 #include <ApplicationServices/ApplicationServices.h>
9 
10 #include "ui/gfx/gfx_export.h"
11 
12 #ifdef __LP64__
13 typedef CGSize NSSize;
14 #else
15 typedef struct _NSSize NSSize;
16 #endif
17 
18 #ifdef __OBJC__
19 @class NSImage;
20 #else
21 class NSImage;
22 #endif
23 
24 namespace gfx {
25 class ImageSkia;
26 
27 // Converts to ImageSkia from NSImage.
28 GFX_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image);
29 
30 // Resizes NSImage to |size| DIP and then converts to ImageSkia.
31 GFX_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image,
32                                                       NSSize size);
33 
34 // Resizes |[NSImage imageNamed:@NSApplicationIcon]| to have edge width of
35 // |size| DIP and returns result as ImageSkia.
36 GFX_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size);
37 
38 // Converts to NSImage from ImageSkia.
39 GFX_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia);
40 
41 // Converts to NSImage from given ImageSkia and a color space.
42 GFX_EXPORT NSImage* NSImageFromImageSkiaWithColorSpace(
43     const gfx::ImageSkia& image_skia,
44     CGColorSpaceRef color_space);
45 
46 }  // namespace gfx
47 
48 #endif  // UI_GFX_IMAGE_IMAGE_SKIA_UTIL_MAC_H_
49