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

Unified Diff: ui/gfx/image/image.h

Issue 10799014: Add support for PNG representation in gfx::Image (Closed) Base URL: http://git.chromium.org/chromium/src.git@bookmark-sync
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/image/image.cc » ('j') | ui/gfx/image/image.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image.h
diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h
index 04a79daffec0673be643d72e04bf7a53e760f501..f16f6ab63684e5b5b4db0b38afad71968bca80cb 100644
--- a/ui/gfx/image/image.h
+++ b/ui/gfx/image/image.h
@@ -55,6 +55,7 @@ class UI_EXPORT Image {
kImageRepCocoa,
kImageRepCairo,
kImageRepSkia,
+ kImageRepPNG,
};
typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap;
@@ -62,6 +63,12 @@ class UI_EXPORT Image {
// Creates an empty image with no representations.
Image();
+ // Creates a new image by copying the PNG-encoded input for use as the default
+ // representation. For example (from an std::vector):
+ // std::vector<unsigned char> png = ...;
+ // gfx::Image image(&png.front(), png.size());
+ Image(const unsigned char* png, size_t input_size);
+
// Creates a new image by copying the ImageSkia for use as the default
// representation.
explicit Image(const ImageSkia& image);
@@ -98,6 +105,7 @@ class UI_EXPORT Image {
// Converts the Image to the desired representation and stores it internally.
// The returned result is a weak pointer owned by and scoped to the life of
// the Image.
+ const std::vector<unsigned char>* ToImagePNG() const;
const SkBitmap* ToSkBitmap() const;
const ImageSkia* ToImageSkia() const;
#if defined(TOOLKIT_GTK)
@@ -120,6 +128,7 @@ class UI_EXPORT Image {
// backing pixels are shared amongst all copies (a fact of each of the
// converted representations, rather than a limitation imposed by Image) and
// so the result should be considered immutable.
+ std::vector<unsigned char>* CopyImagePNG() const;
ImageSkia* CopyImageSkia() const;
SkBitmap* CopySkBitmap() const;
#if defined(TOOLKIT_GTK)
« no previous file with comments | « no previous file | ui/gfx/image/image.cc » ('j') | ui/gfx/image/image.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698