Home | History | Annotate | Download | only in image

Lines Matching defs:Image

5 #include "ui/gfx/image/image.h"
13 #include "ui/gfx/image/image_png_rep.h"
14 #include "ui/gfx/image/image_skia.h"
28 #include "ui/gfx/image/cairo_cached_surface.h"
31 #include "ui/gfx/image/image_skia_util_ios.h"
34 #include "ui/gfx/image/image_skia_util_mac.h"
102 gchar* image = NULL;
106 pixbuf, &image, &image_size, "png", &error, NULL));
109 png_bytes->data().assign(image, image + image_size);
110 g_free(image);
122 gfx::Size UIImageSize(UIImage* image);
129 gfx::Size NSImageSize(NSImage* image);
138 // Returns a 16x16 red image to visually show error in decoding PNG.
194 // An ImageRep is the object that holds the backing memory for an Image. Each
197 // to take ownership of the image, without having to retain it or increase its
201 explicit ImageRep(Image::RepresentationType rep) : type_(rep) {}
208 CHECK_EQ(type_, Image::kImageRepPNG);
213 CHECK_EQ(type_, Image::kImageRepSkia);
219 CHECK_EQ(type_, Image::kImageRepGdk);
224 CHECK_EQ(type_, Image::kImageRepCairo);
231 CHECK_EQ(type_, Image::kImageRepCocoaTouch);
236 CHECK_EQ(type_, Image::kImageRepCocoa);
241 Image::RepresentationType type() const { return type_; }
248 Image::RepresentationType type_;
253 ImageRepPNG() : ImageRep(Image::kImageRepPNG) {
257 : ImageRep(Image::kImageRepPNG),
273 // Read the PNG data to get the image size, caching it.
301 // Takes ownership of |image|.
302 explicit ImageRepSkia(ImageSkia* image)
303 : ImageRep(Image::kImageRepSkia),
304 image_(image) {
322 ImageSkia* image() { return image_.get(); }
334 : ImageRep(Image::kImageRepGdk),
370 : ImageRep(Image::kImageRepCairo),
404 explicit ImageRepCocoaTouch(UIImage* image)
405 : ImageRep(Image::kImageRepCocoaTouch),
406 image_(image) {
407 CHECK(image);
427 UIImage* image() const { return image_; }
437 explicit ImageRepCocoa(NSImage* image)
438 : ImageRep(Image::kImageRepCocoa),
439 image_(image) {
440 CHECK(image);
460 NSImage* image() const { return image_; }
469 // The Storage class acts similarly to the pixels in a SkBitmap: the Image
471 // ImageReps. This way, the Image can be cheaply copied.
474 ImageStorage(gfx::Image::RepresentationType default_type)
483 gfx::Image::RepresentationType default_representation_type() {
486 gfx::Image::RepresentationMap& representations() { return representations_; }
502 // The type of image that was passed to the constructor. This key will always
504 gfx::Image::RepresentationType default_representation_type_;
514 // All the representations of an Image. Size will always be at least one, with
516 gfx::Image::RepresentationMap representations_;
518 STLValueDeleter<Image::RepresentationMap> representations_deleter_;
525 Image::Image() {
529 Image::Image(const std::vector<ImagePNGRep>& image_reps) {
540 storage_ = new internal::ImageStorage(Image::kImageRepPNG);
545 Image::Image(const ImageSkia& image) {
546 if (!image.isNull()) {
547 storage_ = new internal::ImageStorage(Image::kImageRepSkia);
549 new ImageSkia(image));
555 Image::Image(GdkPixbuf* pixbuf) {
557 storage_ = new internal::ImageStorage(Image::kImageRepGdk);
565 Image::Image(UIImage* image)
566 : storage_(new internal::ImageStorage(Image::kImageRepCocoaTouch)) {
567 if (image) {
568 internal::ImageRepCocoaTouch* rep = new internal::ImageRepCocoaTouch(image);
573 Image::Image(NSImage* image) {
574 if (image) {
575 storage_ = new internal::ImageStorage(Image::kImageRepCocoa);
576 internal::ImageRepCocoa* rep = new internal::ImageRepCocoa(image);
582 Image::Image(const Image& other) : storage_(other.storage_) {
585 Image& Image::operator=(const Image& other) {
590 Image::~Image() {
594 Image Image::CreateFrom1xBitmap(const SkBitmap& bitmap) {
595 return gfx::Image(ImageSkia::CreateFrom1xBitmap(bitmap));
599 Image Image::CreateFrom1xPNGBytes(const unsigned char* input,
602 return gfx::Image();
608 return gfx::Image(image_reps);
611 const SkBitmap* Image::ToSkBitmap() const {
616 const ImageSkia* Image::ToImageSkia() const {
641 ImageSkiaFromUIImage(native_rep->image())));
649 ImageSkiaFromNSImage(native_rep->image())));
659 return rep->AsImageRepSkia()->image();
663 GdkPixbuf* Image::ToGdkPixbuf() const {
678 *skia_rep->image()->bitmap()));
690 CairoCachedSurface* const Image::ToCairo() const {
704 UIImage* Image::ToUIImage() const {
718 UIImage* image = UIImageFromImageSkia(*skia_rep->image());
719 base::mac::NSObjectRetain(image);
720 rep = new internal::ImageRepCocoaTouch(image);
729 return rep->AsImageRepCocoaTouch()->image();
732 NSImage* Image::ToNSImage() const {
749 NSImage* image = NSImageFromImageSkiaWithColorSpace(*skia_rep->image(),
751 base::mac::NSObjectRetain(image);
752 rep = new internal::ImageRepCocoa(image);
761 return rep->AsImageRepCocoa()->image();
765 scoped_refptr<base::RefCountedMemory> Image::As1xPNGBytes() const {
796 cocoa_touch_rep->image());
803 png_bytes = internal::Get1xPNGBytesFromNSImage(cocoa_rep->image());
810 png_bytes = internal::Get1xPNGBytesFromImageSkia(skia_rep->image());
837 SkBitmap Image::AsBitmap() const {
841 ImageSkia Image::AsImageSkia() const {
846 NSImage* Image::AsNSImage() const {
851 scoped_refptr<base::RefCountedMemory> Image::Copy1xPNGBytes() const {
858 ImageSkia* Image::CopyImageSkia() const {
862 SkBitmap* Image::CopySkBitmap() const {
867 GdkPixbuf* Image::CopyGdkPixbuf() const {
875 UIImage* Image::CopyUIImage() const {
876 UIImage* image = ToUIImage();
877 base::mac::NSObjectRetain(image);
878 return image;
881 NSImage* Image::CopyNSImage() const {
882 NSImage* image = ToNSImage();
883 base::mac::NSObjectRetain(image);
884 return image;
888 bool Image::HasRepresentation(RepresentationType type) const {
892 size_t Image::RepresentationCount() const {
899 bool Image::IsEmpty() const {
903 int Image::Width() const {
909 int Image::Height() const {
915 gfx::Size Image::Size() const {
921 void Image::SwapRepresentations(gfx::Image* other) {
926 void Image::SetSourceColorSpace(CGColorSpaceRef color_space) {
932 Image::RepresentationType Image::DefaultRepresentationType() const {
941 internal::ImageRep* Image::GetRepresentation(
952 void Image::AddRepresentation(internal::ImageRep* rep) const {