31 scaleImageToFit (
true),
32 preserveProportions (
true),
82Image ImageButton::getCurrentImage()
const
100 return overImage.
isValid() ? overImage
106 return downImage.
isValid() ? downImage
124 const int iw =
im.getWidth();
125 const int ih =
im.getHeight();
128 int x = (w -
iw) / 2;
129 int y = (h -
ih) / 2;
133 if (preserveProportions)
162 if (! scaleImageToFit)
188 if (alphaThreshold == 0)
193 return im.isNull() || ((! imageBounds.
isEmpty())
194 && alphaThreshold <
im.getPixelAt (((x - imageBounds.
getX()) *
im.getWidth()) / imageBounds.
getWidth(),
Represents a colour, also including a transparency value.
int getHeight() const noexcept
Returns the component's height in pixels.
float getAlpha() const noexcept
Returns the component's current transparency level.
void repaint()
Marks the whole component as needing to be redrawn.
virtual bool hitTest(int x, int y)
Tests whether a given point is inside the component.
void setSize(int newWidth, int newHeight)
Changes the size of the component.
int getWidth() const noexcept
Returns the component's width in pixels.
bool isEnabled() const noexcept
Returns true if the component (and all its parents) are enabled.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
A graphics context, used for drawing a component or image.
Holds a fixed-size bitmap.
int getWidth() const noexcept
Returns the image's width (in pixels).
int getHeight() const noexcept
Returns the image's height (in pixels).
bool isValid() const noexcept
Returns true if this image isn't null.
ValueType getX() const noexcept
Returns the x coordinate of the rectangle's left-hand-side.
void setSize(ValueType newWidth, ValueType newHeight) noexcept
Changes the rectangle's size, leaving the position of its top-left corner unchanged.
ValueType getWidth() const noexcept
Returns the width of the rectangle.
ValueType getY() const noexcept
Returns the y coordinate of the rectangle's top edge.
bool isEmpty() const noexcept
Returns true if the rectangle's width or height are zero or less.
ValueType getHeight() const noexcept
Returns the height of the rectangle.
void setBounds(ValueType newX, ValueType newY, ValueType newWidth, ValueType newHeight) noexcept
Changes all the rectangle's coordinates.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.