Retrieves a section of an image as raw pixel data, so it can be read or written to. More...
#include <juce_Image.h>
Classes | |
class | BitmapDataReleaser |
Used internally by custom image types to manage pixel data lifetime. More... | |
Public Types | |
enum | ReadWriteMode { readOnly, writeOnly, readWrite } |
Public Member Functions | |
BitmapData (Image &image, int x, int y, int w, int h, ReadWriteMode mode) | |
BitmapData (const Image &image, int x, int y, int w, int h) | |
BitmapData (const Image &image, ReadWriteMode mode) | |
~BitmapData () | |
Rectangle< int > | getBounds () const noexcept |
Returns the size of the bitmap. More... | |
uint8 * | getLinePointer (int y) const noexcept |
Returns a pointer to the start of a line in the image. More... | |
Colour | getPixelColour (int x, int y) const noexcept |
Returns the colour of a given pixel. More... | |
uint8 * | getPixelPointer (int x, int y) const noexcept |
Returns a pointer to a pixel in the image. More... | |
void | setPixelColour (int x, int y, Colour colour) const noexcept |
Sets the colour of a given pixel. More... | |
Public Attributes | |
uint8 * | data |
The raw pixel data, packed according to the image's pixel format. More... | |
std::unique_ptr< BitmapDataReleaser > | dataReleaser |
int | height |
int | lineStride |
The number of bytes between each line. More... | |
PixelFormat | pixelFormat |
The format of the data. More... | |
int | pixelStride |
The number of bytes between each pixel. More... | |
int | width |
Retrieves a section of an image as raw pixel data, so it can be read or written to.
You should only use this class as a last resort - messing about with the internals of an image is only recommended for people who really know what they're doing!
A BitmapData object should be used as a temporary, stack-based object. Don't keep one hanging around while the image is being used elsewhere.
Depending on the way the image class is implemented, this may create a temporary buffer which is copied back to the image when the object is deleted, or it may just get a pointer directly into the image's raw data.
You can use the stride and data values in this class directly, but don't alter them! The actual format of the pixel data depends on the image's format - see Image::getFormat(), and the PixelRGB, PixelARGB and PixelAlpha classes for more info.
juce::Image::BitmapData::BitmapData | ( | Image & | image, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
ReadWriteMode | mode | ||
) |
juce::Image::BitmapData::BitmapData | ( | const Image & | image, |
ReadWriteMode | mode | ||
) |
juce::Image::BitmapData::~BitmapData | ( | ) |
Returns the size of the bitmap.
Returns a pointer to the start of a line in the image.
The coordinate you provide here isn't checked, so it's the caller's responsibility to make sure it's not out-of-range.
Returns the colour of a given pixel.
For performance reasons, this won't do any bounds-checking on the coordinates, so it's the caller's repsonsibility to make sure they're within the image's size.
Returns a pointer to a pixel in the image.
The coordinates you give here are not checked, so it's the caller's responsibility to make sure they're not out-of-range.
Sets the colour of a given pixel.
For performance reasons, this won't do any bounds-checking on the coordinates, so it's the caller's repsonsibility to make sure they're within the image's size.
uint8* juce::Image::BitmapData::data |
The raw pixel data, packed according to the image's pixel format.
std::unique_ptr<BitmapDataReleaser> juce::Image::BitmapData::dataReleaser |
int juce::Image::BitmapData::height |
int juce::Image::BitmapData::lineStride |
The number of bytes between each line.
PixelFormat juce::Image::BitmapData::pixelFormat |
The format of the data.
Referenced by juce::RenderingHelpers::EdgeTableFillers::ImageFill< DestPixelType, SrcPixelType, repeatPattern >::copyRow(), juce::RenderingHelpers::SoftwareRendererSavedState::fillWithGradient(), juce::RenderingHelpers::SoftwareRendererSavedState::fillWithSolidColour(), juce::RenderingHelpers::EdgeTableFillers::renderImageTransformed(), and juce::RenderingHelpers::EdgeTableFillers::renderImageUntransformed().
int juce::Image::BitmapData::pixelStride |
The number of bytes between each pixel.
Referenced by juce::RenderingHelpers::EdgeTableFillers::ImageFill< DestPixelType, SrcPixelType, repeatPattern >::copyRow(), juce::RenderingHelpers::EdgeTableFillers::ImageFill< DestPixelType, SrcPixelType, repeatPattern >::getDestPixel(), juce::RenderingHelpers::EdgeTableFillers::SolidColour< PixelType, replaceExisting >::getPixel(), juce::RenderingHelpers::EdgeTableFillers::Gradient< PixelType, GradientType >::getPixel(), juce::RenderingHelpers::EdgeTableFillers::ImageFill< DestPixelType, SrcPixelType, repeatPattern >::getSrcPixel(), and juce::RenderingHelpers::EdgeTableFillers::SolidColour< PixelType, replaceExisting >::replaceLine().
int juce::Image::BitmapData::width |