| @@ -95575,15 +95575,9 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const | |||
| return newImage; | |||
| } | |||
| const var Image::getTag() const | |||
| NamedValueSet* Image::getProperties() const | |||
| { | |||
| return image == 0 ? var::null : image->userTag; | |||
| } | |||
| void Image::setTag (const var& newTag) | |||
| { | |||
| if (image != 0) | |||
| image->userTag = newTag; | |||
| return image == 0 ? 0 : &(image->userData); | |||
| } | |||
| Image::BitmapData::BitmapData (Image& image, const int x, const int y, const int w, const int h, const bool /*makeWritable*/) | |||
| @@ -96480,6 +96474,8 @@ public: | |||
| image = Image ((transparent >= 0) ? Image::ARGB : Image::RGB, | |||
| imageWidth, imageHeight, (transparent >= 0)); | |||
| image.getProperties()->set ("originalImageHadAlpha", image.hasAlphaChannel()); | |||
| readImage ((buf[8] & 0x40) != 0, transparent); | |||
| break; | |||
| @@ -211967,6 +211963,7 @@ const Image JPEGImageFormat::decodeImage (InputStream& in) | |||
| if (jpeg_start_decompress (&jpegDecompStruct)) | |||
| { | |||
| image = Image (Image::RGB, width, height, false); | |||
| image.getProperties()->set ("originalImageHadAlpha", false); | |||
| const bool hasAlphaChan = image.hasAlphaChannel(); // (the native image creator may not give back what we expect) | |||
| const Image::BitmapData destData (image, true); | |||
| @@ -237674,6 +237671,7 @@ const Image PNGImageFormat::decodeImage (InputStream& in) | |||
| image = Image (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| (int) width, (int) height, hasAlphaChan); | |||
| image.getProperties()->set ("originalImageHadAlpha", image.hasAlphaChannel()); | |||
| hasAlphaChan = image.hasAlphaChannel(); // (the native image creator may not give back what we expect) | |||
| const Image::BitmapData destData (image, true); | |||
| @@ -267560,8 +267558,12 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| if (loadedImage != 0) | |||
| { | |||
| const bool hasAlphaChan = CGImageGetAlphaInfo (loadedImage) != kCGImageAlphaNone; | |||
| Image image (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo (loadedImage); | |||
| const bool hasAlphaChan = (alphaInfo != kCGImageAlphaNone | |||
| && alphaInfo != kCGImageAlphaNoneSkipLast | |||
| && alphaInfo != kCGImageAlphaNoneSkipFirst); | |||
| Image image (Image::ARGB, // (CoreImage doesn't work with 24-bit images) | |||
| (int) CGImageGetWidth (loadedImage), (int) CGImageGetHeight (loadedImage), | |||
| hasAlphaChan, Image::NativeImage); | |||
| @@ -267575,6 +267577,9 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| CFRelease (loadedImage); | |||
| #endif | |||
| // Because it's impossible to create a truly 24-bit CG image, this flag allows a user | |||
| // to find out whether the file they just loaded the image from had an alpha channel or not. | |||
| image.getProperties()->set ("originalImageHadAlpha", hasAlphaChan); | |||
| return image; | |||
| } | |||
| } | |||
| @@ -272254,8 +272259,12 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| if (loadedImage != 0) | |||
| { | |||
| const bool hasAlphaChan = CGImageGetAlphaInfo (loadedImage) != kCGImageAlphaNone; | |||
| Image image (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo (loadedImage); | |||
| const bool hasAlphaChan = (alphaInfo != kCGImageAlphaNone | |||
| && alphaInfo != kCGImageAlphaNoneSkipLast | |||
| && alphaInfo != kCGImageAlphaNoneSkipFirst); | |||
| Image image (Image::ARGB, // (CoreImage doesn't work with 24-bit images) | |||
| (int) CGImageGetWidth (loadedImage), (int) CGImageGetHeight (loadedImage), | |||
| hasAlphaChan, Image::NativeImage); | |||
| @@ -272269,6 +272278,9 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| CFRelease (loadedImage); | |||
| #endif | |||
| // Because it's impossible to create a truly 24-bit CG image, this flag allows a user | |||
| // to find out whether the file they just loaded the image from had an alpha channel or not. | |||
| image.getProperties()->set ("originalImageHadAlpha", hasAlphaChan); | |||
| return image; | |||
| } | |||
| } | |||
| @@ -64,7 +64,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 52 | |||
| #define JUCE_BUILDNUMBER 79 | |||
| #define JUCE_BUILDNUMBER 80 | |||
| /** Current Juce version number. | |||
| @@ -25352,21 +25352,12 @@ public: | |||
| void createSolidAreaMask (RectangleList& result, | |||
| float alphaThreshold = 0.5f) const; | |||
| /** Returns a user-specified data item that was set with setTag(). | |||
| setTag() and getTag() allow you to attach an arbitrary identifier value to an | |||
| image. The value is shared between all Image object that are referring to the | |||
| same underlying image data object. | |||
| */ | |||
| const var getTag() const; | |||
| /** Attaches a user-specified data item to this image, which can be retrieved using getTag(). | |||
| setTag() and getTag() allow you to attach an arbitrary identifier value to an | |||
| image. The value is shared between all Image object that are referring to the | |||
| same underlying image data object. | |||
| /** Returns a NamedValueSet that is attached to the image and which can be used for | |||
| associating custom values with it. | |||
| Note that if this Image is null, this method will fail to store the data. | |||
| If this is a null image, this will return a null pointer. | |||
| */ | |||
| void setTag (const var& newTag); | |||
| NamedValueSet* getProperties() const; | |||
| /** Creates a context suitable for drawing onto this image. | |||
| Don't call this method directly! It's used internally by the Graphics class. | |||
| @@ -25411,7 +25402,7 @@ public: | |||
| const int width, height; | |||
| int pixelStride, lineStride; | |||
| uint8* imageData; | |||
| var userTag; | |||
| NamedValueSet userData; | |||
| SharedImage (const SharedImage&); | |||
| SharedImage& operator= (const SharedImage&); | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 52 | |||
| #define JUCE_BUILDNUMBER 79 | |||
| #define JUCE_BUILDNUMBER 80 | |||
| /** Current Juce version number. | |||
| @@ -104,6 +104,8 @@ public: | |||
| image = Image ((transparent >= 0) ? Image::ARGB : Image::RGB, | |||
| imageWidth, imageHeight, (transparent >= 0)); | |||
| image.getProperties()->set ("originalImageHadAlpha", image.hasAlphaChannel()); | |||
| readImage ((buf[8] & 0x40) != 0, transparent); | |||
| break; | |||
| @@ -304,6 +304,7 @@ const Image JPEGImageFormat::decodeImage (InputStream& in) | |||
| if (jpeg_start_decompress (&jpegDecompStruct)) | |||
| { | |||
| image = Image (Image::RGB, width, height, false); | |||
| image.getProperties()->set ("originalImageHadAlpha", false); | |||
| const bool hasAlphaChan = image.hasAlphaChannel(); // (the native image creator may not give back what we expect) | |||
| const Image::BitmapData destData (image, true); | |||
| @@ -228,6 +228,7 @@ const Image PNGImageFormat::decodeImage (InputStream& in) | |||
| image = Image (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| (int) width, (int) height, hasAlphaChan); | |||
| image.getProperties()->set ("originalImageHadAlpha", image.hasAlphaChannel()); | |||
| hasAlphaChan = image.hasAlphaChannel(); // (the native image creator may not give back what we expect) | |||
| const Image::BitmapData destData (image, true); | |||
| @@ -252,15 +252,9 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const | |||
| return newImage; | |||
| } | |||
| const var Image::getTag() const | |||
| NamedValueSet* Image::getProperties() const | |||
| { | |||
| return image == 0 ? var::null : image->userTag; | |||
| } | |||
| void Image::setTag (const var& newTag) | |||
| { | |||
| if (image != 0) | |||
| image->userTag = newTag; | |||
| return image == 0 ? 0 : &(image->userData); | |||
| } | |||
| //============================================================================== | |||
| @@ -29,7 +29,7 @@ | |||
| #include "../colour/juce_Colour.h" | |||
| #include "../contexts/juce_Graphics.h" | |||
| #include "../../../containers/juce_Variant.h" | |||
| #include "../../../containers/juce_NamedValueSet.h" | |||
| //============================================================================== | |||
| /** | |||
| @@ -354,21 +354,12 @@ public: | |||
| float alphaThreshold = 0.5f) const; | |||
| //============================================================================== | |||
| /** Returns a user-specified data item that was set with setTag(). | |||
| setTag() and getTag() allow you to attach an arbitrary identifier value to an | |||
| image. The value is shared between all Image object that are referring to the | |||
| same underlying image data object. | |||
| */ | |||
| const var getTag() const; | |||
| /** Attaches a user-specified data item to this image, which can be retrieved using getTag(). | |||
| setTag() and getTag() allow you to attach an arbitrary identifier value to an | |||
| image. The value is shared between all Image object that are referring to the | |||
| same underlying image data object. | |||
| /** Returns a NamedValueSet that is attached to the image and which can be used for | |||
| associating custom values with it. | |||
| Note that if this Image is null, this method will fail to store the data. | |||
| If this is a null image, this will return a null pointer. | |||
| */ | |||
| void setTag (const var& newTag); | |||
| NamedValueSet* getProperties() const; | |||
| //============================================================================== | |||
| /** Creates a context suitable for drawing onto this image. | |||
| @@ -415,7 +406,7 @@ public: | |||
| const int width, height; | |||
| int pixelStride, lineStride; | |||
| uint8* imageData; | |||
| var userTag; | |||
| NamedValueSet userData; | |||
| SharedImage (const SharedImage&); | |||
| SharedImage& operator= (const SharedImage&); | |||
| @@ -800,8 +800,12 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| if (loadedImage != 0) | |||
| { | |||
| const bool hasAlphaChan = CGImageGetAlphaInfo (loadedImage) != kCGImageAlphaNone; | |||
| Image image (hasAlphaChan ? Image::ARGB : Image::RGB, | |||
| CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo (loadedImage); | |||
| const bool hasAlphaChan = (alphaInfo != kCGImageAlphaNone | |||
| && alphaInfo != kCGImageAlphaNoneSkipLast | |||
| && alphaInfo != kCGImageAlphaNoneSkipFirst); | |||
| Image image (Image::ARGB, // (CoreImage doesn't work with 24-bit images) | |||
| (int) CGImageGetWidth (loadedImage), (int) CGImageGetHeight (loadedImage), | |||
| hasAlphaChan, Image::NativeImage); | |||
| @@ -815,6 +819,9 @@ const Image juce_loadWithCoreImage (InputStream& input) | |||
| CFRelease (loadedImage); | |||
| #endif | |||
| // Because it's impossible to create a truly 24-bit CG image, this flag allows a user | |||
| // to find out whether the file they just loaded the image from had an alpha channel or not. | |||
| image.getProperties()->set ("originalImageHadAlpha", hasAlphaChan); | |||
| return image; | |||
| } | |||
| } | |||