Browse Source

Added Image::Bitmap::getBounds method.

tags/2021-05-28
jules 13 years ago
parent
commit
af9c71be38
2 changed files with 19 additions and 10 deletions
  1. +10
    -5
      extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h
  2. +9
    -5
      modules/juce_graphics/images/juce_Image.h

+ 10
- 5
extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h View File

@@ -169,14 +169,19 @@ public:
}
}
static void drawEmptyPanelMessage (Component& comp, Graphics& g, const String& message)
{
const int fontHeight = 13;
const Rectangle<int> area (comp.getLocalBounds());
g.setColour (comp.findColour (mainBackgroundColourId).contrasting (0.7f));
g.setFont ((float) fontHeight);
g.drawFittedText (message, area.reduced (4, 2), Justification::centred, area.getHeight() / fontHeight);
}
void paint (Graphics& g)
{
if (emptyTreeMessage.isNotEmpty() && (rootItem == nullptr || rootItem->getNumSubItems() == 0))
{
g.setColour (findColour (mainBackgroundColourId).contrasting (0.7f));
g.setFont (13.0f);
g.drawFittedText (emptyTreeMessage, getLocalBounds().reduced (4, 2), Justification::centred, 50);
}
drawEmptyPanelMessage (*this, g, emptyTreeMessage);
}
void resized()


+ 9
- 5
modules/juce_graphics/images/juce_Image.h View File

@@ -346,9 +346,14 @@ public:
*/
void setPixelColour (int x, int y, const Colour& colour) const noexcept;
uint8* data;
PixelFormat pixelFormat;
int lineStride, pixelStride, width, height;
/** Returns the size of the bitmap. */
Rectangle<int> getBounds() const noexcept { return Rectangle<int> (width, height); }
uint8* data; /**< The raw pixel data, packed according to the image's pixel format. */
PixelFormat pixelFormat; /**< The format of the data. */
int lineStride; /**< The number of bytes between each line. */
int pixelStride; /**< The number of bytes between each pixel. */
int width, height;
//==============================================================================
/** Used internally by custom image types to manage pixel data lifetime. */
@@ -379,8 +384,7 @@ public:
@param alphaThreshold for a semi-transparent image, any pixels whose alpha is
above this level will be considered opaque
*/
void createSolidAreaMask (RectangleList& result,
float alphaThreshold = 0.5f) const;
void createSolidAreaMask (RectangleList& result, float alphaThreshold) const;
//==============================================================================
/** Returns a NamedValueSet that is attached to the image and which can be used for


Loading…
Cancel
Save