#include </home/zeitlin/src/wx/github/interface/wx/rawbmp.h>
A class template with ready to use implementations for getting direct and efficient access to wxBitmap's internal data and wxImage's internal data through a standard interface.
It is possible to extend this class (interface) to other types of image content.
Implemented on Windows, GTK+ and OS X:
Implemented everywhere:
例:
wxBitmap bmp; wxNativePixelData data(bmp); if ( !data ) { // ... raw access to bitmap data unavailable, do something else ... return; } if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) { // ... complain: the bitmap it too small ... return; } wxNativePixelData::Iterator p(data); // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b p.Offset(data, 10, 10); for ( int y = 0; y < 10; ++y ) { wxNativePixelData::Iterator rowStart = p; for ( int x = 0; x < 10; ++x, ++p ) { p.Red() = r; p.Green() = g; p.Blue() = b; } p = rowStart; p.OffsetY(data, 1); }
クラス | |
class | Iterator |
The iterator of class wxPixelData. More... | |
Public Types | |
typedef Image | ImageType |
The type of the class we're working with. | |
Public Member Functions | |
wxPixelData (Image &image) | |
Create pixel data object representing the entire image. | |
wxPixelData (Image &i, const wxRect &rect) | |
Create pixel data object representing the area of the image defined by rect. | |
wxPixelData (Image &i, const wxPoint &pt, const wxSize &sz) | |
Create pixel data object representing the area of the image defined by pt and sz. | |
operator bool () const | |
Return true of if we could get access to bitmap data successfully. | |
Iterator | GetPixels () const |
Return the iterator pointing to the origin of the image. | |
wxPoint | GetOrigin () const |
Returns origin of the rectangular region this wxPixelData represents. | |
int | GetWidth () const |
Return width of the region this wxPixelData represents. | |
int | GetHeight () const |
Return height of the region this wxPixelData represents. | |
wxSize | GetSize () const |
Return the area which this wxPixelData represents in the image. | |
int | GetRowStride () const |
Return the distance between two rows. |
typedef Image wxPixelData< Image, PixelFormat >::ImageType |
The type of the class we're working with.
wxPixelData< Image, PixelFormat >::wxPixelData | ( | Image & | image | ) |
Create pixel data object representing the entire image.
wxPixelData< Image, PixelFormat >::wxPixelData | ( | Image & | i, |
const wxRect & | rect | ||
) |
Create pixel data object representing the area of the image defined by rect.
wxPixelData< Image, PixelFormat >::wxPixelData | ( | Image & | i, |
const wxPoint & | pt, | ||
const wxSize & | sz | ||
) |
Create pixel data object representing the area of the image defined by pt and sz.
int wxPixelData< Image, PixelFormat >::GetHeight | ( | ) | const |
Return height of the region this wxPixelData represents.
wxPoint wxPixelData< Image, PixelFormat >::GetOrigin | ( | ) | const |
Returns origin of the rectangular region this wxPixelData represents.
Iterator wxPixelData< Image, PixelFormat >::GetPixels | ( | ) | const |
Return the iterator pointing to the origin of the image.
int wxPixelData< Image, PixelFormat >::GetRowStride | ( | ) | const |
Return the distance between two rows.
wxSize wxPixelData< Image, PixelFormat >::GetSize | ( | ) | const |
Return the area which this wxPixelData represents in the image.
int wxPixelData< Image, PixelFormat >::GetWidth | ( | ) | const |
Return width of the region this wxPixelData represents.
wxPixelData< Image, PixelFormat >::operator bool | ( | ) | const |
Return true of if we could get access to bitmap data successfully.