Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Side by Side Diff: ios/chrome/browser/ui/uikit_ui_util.h

Issue 2602903002: Factor iOS native image loading into a utility function. (Closed)
Patch Set: Fixed BUILD files. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_
6 #define IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ 6 #define IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_
7 7
8 #include <CoreGraphics/CoreGraphics.h> 8 #include <CoreGraphics/CoreGraphics.h>
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 #import <UIKit/UIKit.h> 10 #import <UIKit/UIKit.h>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 green:((CGFloat)((rgb & 0x00FF00) >> 8)) / 255.0 97 green:((CGFloat)((rgb & 0x00FF00) >> 8)) / 255.0
98 blue:((CGFloat)(rgb & 0x0000FF)) / 255.0 98 blue:((CGFloat)(rgb & 0x0000FF)) / 255.0
99 alpha:alpha]; 99 alpha:alpha];
100 } 100 }
101 101
102 // Returns whether an image contains an alpha channel. If yes, displaying the 102 // Returns whether an image contains an alpha channel. If yes, displaying the
103 // image will require blending. 103 // image will require blending.
104 // Intended for use in debug. 104 // Intended for use in debug.
105 BOOL ImageHasAlphaChannel(UIImage* image); 105 BOOL ImageHasAlphaChannel(UIImage* image);
106 106
107 // Returns the image from the shared resource bundle with the image id
108 // |imageID|. If |reversable| is YES and RTL layout is in use, the image
109 // will be flipped for RTL.
110 UIImage* NativeReversableImage(int imageID, BOOL reversable);
111
112 // Convenience version of NativeReversableImage for images that are never
113 // reversable; equivalent to NativeReversableImage(imageID, NO).
114 UIImage* NativeImage(int imageID);
115
107 // Returns an image resized to |targetSize|. It first calculate the projection 116 // Returns an image resized to |targetSize|. It first calculate the projection
108 // by calling CalculateProjection() and then create a new image of the desired 117 // by calling CalculateProjection() and then create a new image of the desired
109 // size and project the correct subset of the original image onto it. 118 // size and project the correct subset of the original image onto it.
110 // The resulting image will have an alpha channel. 119 // The resulting image will have an alpha channel.
111 // 120 //
112 // Image interpolation level for resizing is set to kCGInterpolationDefault. 121 // Image interpolation level for resizing is set to kCGInterpolationDefault.
113 // 122 //
114 // The resize always preserves the scale of the original image. 123 // The resize always preserves the scale of the original image.
115 UIImage* ResizeImage(UIImage* image, 124 UIImage* ResizeImage(UIImage* image,
116 CGSize targetSize, 125 CGSize targetSize,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 bool IsCompactTablet(id<UITraitEnvironment> environment); 269 bool IsCompactTablet(id<UITraitEnvironment> environment);
261 270
262 // Whether the main application window's rootViewController has a compact 271 // Whether the main application window's rootViewController has a compact
263 // iPad horizontal size class. 272 // iPad horizontal size class.
264 bool IsCompactTablet(); 273 bool IsCompactTablet();
265 274
266 // Returns the current first responder. 275 // Returns the current first responder.
267 UIResponder* GetFirstResponder(); 276 UIResponder* GetFirstResponder();
268 277
269 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ 278 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698