juce_DrawableImage.h

Go to the documentation of this file.
00001 /*
00002   ==============================================================================
00003 
00004    This file is part of the JUCE library - "Jules' Utility Class Extensions"
00005    Copyright 2004-7 by Raw Material Software ltd.
00006 
00007   ------------------------------------------------------------------------------
00008 
00009    JUCE can be redistributed and/or modified under the terms of the
00010    GNU General Public License, as published by the Free Software Foundation;
00011    either version 2 of the License, or (at your option) any later version.
00012 
00013    JUCE is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with JUCE; if not, visit www.gnu.org/licenses or write to the
00020    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00021    Boston, MA 02111-1307 USA
00022 
00023   ------------------------------------------------------------------------------
00024 
00025    If you'd like to release a closed-source product which uses JUCE, commercial
00026    licenses are also available: visit www.rawmaterialsoftware.com/juce for
00027    more information.
00028 
00029   ==============================================================================
00030 */
00031 
00032 #ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
00033 #define __JUCE_DRAWABLEIMAGE_JUCEHEADER__
00034 
00035 #include "juce_Drawable.h"
00036 
00037 
00038 //==============================================================================
00044 class JUCE_API  DrawableImage  : public Drawable
00045 {
00046 public:
00047     //==============================================================================
00048     DrawableImage();
00049 
00051     virtual ~DrawableImage();
00052 
00053     //==============================================================================
00060     void setImage (const Image& imageToCopy);
00061 
00077     void setImage (Image* imageToUse,
00078                    const bool releaseWhenNotNeeded);
00079 
00081     Image* getImage() const throw()                             { return image; }
00082 
00084     void clearImage();
00085 
00087     void setOpacity (const float newOpacity);
00088 
00090     float getOpacity() const throw()                            { return opacity; }
00091 
00101     void setOverlayColour (const Colour& newOverlayColour);
00102 
00104     const Colour& getOverlayColour() const throw()              { return overlayColour; }
00105 
00106 
00107     //==============================================================================
00109     void draw (Graphics& g, const AffineTransform& transform) const;
00111     void getBounds (float& x, float& y, float& width, float& height) const;
00113     bool hitTest (float x, float y) const;
00115     Drawable* createCopy() const;
00116 
00117     //==============================================================================
00118     juce_UseDebuggingNewOperator
00119 
00120 private:
00121     Image* image;
00122     bool canDeleteImage;
00123     float opacity;
00124     Colour overlayColour;
00125 
00126     DrawableImage (const DrawableImage&);
00127     const DrawableImage& operator= (const DrawableImage&);
00128 };
00129 
00130 
00131 #endif   // __JUCE_DRAWABLEIMAGE_JUCEHEADER__