JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
juce::Image::BitmapData Class Referencefinal

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)
 
uint8getLinePointer (int y) const noexcept
 Returns a pointer to the start of a line in the image.
 
uint8getPixelPointer (int x, int y) const noexcept
 Returns a pointer to a pixel in the image.
 
Colour getPixelColour (int x, int y) const noexcept
 Returns the colour of a given pixel.
 
void setPixelColour (int x, int y, Colour colour) const noexcept
 Sets the colour of a given pixel.
 
Rectangle< intgetBounds () const noexcept
 Returns the size of the bitmap.
 

Public Attributes

uint8data
 The raw pixel data, packed according to the image's pixel format.
 
size_t size
 The number of valid/allocated bytes after data.
 
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
 
int height
 
std::unique_ptr< BitmapDataReleaserdataReleaser
 

Detailed Description

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.

Definition at line 309 of file juce_Image.h.

Member Enumeration Documentation

◆ ReadWriteMode

enum juce::Image::BitmapData::ReadWriteMode

Definition at line 312 of file juce_Image.h.

Constructor & Destructor Documentation

◆ BitmapData() [1/3]

juce::Image::BitmapData::BitmapData ( Image image,
int  x,
int  y,
int  w,
int  h,
BitmapData::ReadWriteMode  mode 
)

Definition at line 380 of file juce_Image.cpp.

◆ BitmapData() [2/3]

juce::Image::BitmapData::BitmapData ( const Image image,
int  x,
int  y,
int  w,
int  h 
)

Definition at line 391 of file juce_Image.cpp.

◆ BitmapData() [3/3]

juce::Image::BitmapData::BitmapData ( const Image image,
BitmapData::ReadWriteMode  mode 
)

Definition at line 402 of file juce_Image.cpp.

◆ ~BitmapData()

juce::Image::BitmapData::~BitmapData ( )

Definition at line 413 of file juce_Image.cpp.

Member Function Documentation

◆ getBounds()

Rectangle< int > juce::Image::BitmapData::getBounds ( ) const
noexcept

Returns the size of the bitmap.

Definition at line 349 of file juce_Image.h.

◆ getLinePointer()

uint8 * juce::Image::BitmapData::getLinePointer ( int  y) const
noexcept

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.

Definition at line 328 of file juce_Image.h.

◆ getPixelColour()

Colour juce::Image::BitmapData::getPixelColour ( int  x,
int  y 
) const
noexcept

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 responsibility to make sure they're within the image's size.

Definition at line 417 of file juce_Image.cpp.

◆ getPixelPointer()

uint8 * juce::Image::BitmapData::getPixelPointer ( int  x,
int  y 
) const
noexcept

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.

Definition at line 334 of file juce_Image.h.

◆ setPixelColour()

void juce::Image::BitmapData::setPixelColour ( int  x,
int  y,
Colour  colour 
) const
noexcept

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 responsibility to make sure they're within the image's size.

Definition at line 435 of file juce_Image.cpp.

Member Data Documentation

◆ data

uint8* juce::Image::BitmapData::data

The raw pixel data, packed according to the image's pixel format.

Definition at line 351 of file juce_Image.h.

◆ dataReleaser

std::unique_ptr<BitmapDataReleaser> juce::Image::BitmapData::dataReleaser

Definition at line 368 of file juce_Image.h.

◆ height

int juce::Image::BitmapData::height

Definition at line 356 of file juce_Image.h.

◆ lineStride

int juce::Image::BitmapData::lineStride

The number of bytes between each line.

Definition at line 354 of file juce_Image.h.

◆ pixelFormat

PixelFormat juce::Image::BitmapData::pixelFormat

The format of the data.

Definition at line 353 of file juce_Image.h.

◆ pixelStride

int juce::Image::BitmapData::pixelStride

The number of bytes between each pixel.

Definition at line 355 of file juce_Image.h.

◆ size

size_t juce::Image::BitmapData::size

The number of valid/allocated bytes after data.

May be smaller than "lineStride * height" if this is a section of a larger image.

Definition at line 352 of file juce_Image.h.

◆ width

int juce::Image::BitmapData::width

Definition at line 356 of file juce_Image.h.


The documentation for this class was generated from the following files: