Pyro higlevel API
|
Container for bitmap image data. More...
Classes | |
class | Private |
Public Member Functions | |
BitmapImage (uint32 nFlags=Bitmap::SHARE_FRAMEBUFFER) | |
Default constructor. More... | |
BitmapImage (const BitmapImage &cSource, uint32 nFlags=Bitmap::SHARE_FRAMEBUFFER) | |
Copy constructor. More... | |
BitmapImage (StreamableIO *pcSource, uint32 nFlags=Bitmap::SHARE_FRAMEBUFFER) | |
Constructor. More... | |
BitmapImage (const uint8 *pData, const IPoint &cSize, color_space eColorSpace, uint32 nFlags=Bitmap::SHARE_FRAMEBUFFER) | |
Constructor. More... | |
virtual | ~BitmapImage () |
virtual const String | ImageType (void) const |
Get object type. More... | |
virtual bool | IsValid (void) const |
Find out if the bitmap object is valid. More... | |
virtual status_t | Load (StreamableIO *pcSource, const String &cType="") |
Load bitmap from a stream (file, memory, resource etc.). More... | |
virtual status_t | Save (StreamableIO *pcDest, const String &cType) |
Write bitmap to a stream. More... | |
virtual void | Draw (const Point &cPos, View *pcView) |
Draw an image to a View. More... | |
virtual void | Draw (const Rect &cSource, const Rect &cDest, View *pcView) |
Draw an image to a View. More... | |
virtual status_t | SetSize (const Point &cSize) |
Scale the bitmap. More... | |
virtual Point | GetSize (void) const |
Get bitmap size. More... | |
void | SetBitmapData (const uint8 *pData, const IPoint &cSize, color_space eColorSpace, uint32 nFlags=Bitmap::SHARE_FRAMEBUFFER) |
Set raw bitmap data. More... | |
color_space | GetColorSpace () const |
Get bitmap colour space. More... | |
virtual status_t | SetColorSpace (color_space eColorSpace) |
Set colour space. More... | |
virtual Bitmap * | LockBitmap (void) |
Lock the internal Bitmap object. More... | |
virtual void | UnlockBitmap (void) |
Unlock the internal Bitmap object. More... | |
virtual BitmapImage & | operator= (const BitmapImage &cSource) |
Copy the contents of another bitmap. More... | |
virtual View * | GetView () |
Obtain a View for rendering into the bitmap. More... | |
virtual void | ResizeCanvas (const Point &cSize) |
Change the size of the bitmap. More... | |
virtual uint32 * | operator[] (int row) |
Direct access to pixels. More... | |
void | Sync () |
Flush the render queue, and wait til the rendering is done. More... | |
void | Flush () |
Flush the render queue. More... | |
virtual status_t | ApplyFilter (const Message &cFilterData) |
status_t | GrayFilter (void) |
Create a greyed image. More... | |
status_t | HighlightFilter (void) |
Make the image highlighted. More... | |
status_t | AlphaToOverlay (uint32 cTransparentColor) |
Convert alpha channel to overlay. More... | |
status_t | GlowFilter (Color32_s cInnerColor, Color32_s cOuterColor, int nRadius) |
Add glow effect to the image. More... | |
status_t | ColorizeFilter (Color32_s cColor) |
Public Member Functions inherited from os::Image | |
Image () | |
Default constructor. More... | |
virtual | ~Image () |
Rect | GetBounds (void) const |
Get image bounds. More... | |
virtual status_t | ApplyFilter (uint32 nFilterID) |
Static Public Member Functions | |
static os::BitmapImage * | GetImageFromResource (const os::String &cName) |
Additional Inherited Members | |
Public Types inherited from os::Image | |
enum | { F_NONE, F_GRAY, F_HIGHLIGHT, F_ALPHA_TO_OVERLAY, F_GLOW, F_COLORIZE } |
Filter types. More... | |
Public Attributes inherited from os::Image | |
enum os::Image:: { ... } | FilterType |
BitmapImage::BitmapImage | ( | uint32 | nFlags = Bitmap::SHARE_FRAMEBUFFER | ) |
nFlags | Bitmap flags, see os::Bitmap. |
References os::BitmapImage::Private::m_nBitmapFlags.
BitmapImage::BitmapImage | ( | const BitmapImage & | cSource, |
uint32 | nFlags = Bitmap::SHARE_FRAMEBUFFER |
||
) |
cSource | Original BitmapImage object to copy. |
nFlags | Bitmap flags, see os::Bitmap. |
References os::BitmapImage::Private::m_nBitmapFlags.
BitmapImage::BitmapImage | ( | StreamableIO * | pcSource, |
uint32 | nFlags = Bitmap::SHARE_FRAMEBUFFER |
||
) |
pcSource | A pointer to a StreamableIO object. Could be a file, a resource or any data source that can be represented as a stream of data. The Translator API is used to try to recognize the format and load it as bitmap data. If you need to explicitly specify the file format, use Load(). |
nFlags | Bitmap flags, see os::Bitmap. |
References Load(), and os::BitmapImage::Private::m_nBitmapFlags.
BitmapImage::BitmapImage | ( | const uint8 * | pData, |
const IPoint & | cSize, | ||
color_space | eColorSpace, | ||
uint32 | nFlags = Bitmap::SHARE_FRAMEBUFFER |
||
) |
pData | Pointer to an array of raw bitmap data. |
cSize | The size of the bitmap in pixels. |
eColorSpace | Color space, for instance CS_RGB32. |
nFlags | Bitmap flags, see os::Bitmap. |
References os::BitmapImage::Private::m_nBitmapFlags, and SetBitmapData().
|
virtual |
status_t BitmapImage::AlphaToOverlay | ( | uint32 | cTransparentColor | ) |
cTransparentColor | The colour that will be transparent. Typically you will use the default, TRANSPARENT_RGB32. |
References os::BitmapImage::Private::AssertBitmapFlags(), CS_RGB32, os::Bitmap::GetBounds(), os::Bitmap::GetBytesPerRow(), GetColorSpace(), os::Rect::Height(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_pcBitmap, os::Bitmap::SHARE_FRAMEBUFFER, and os::Bitmap::UnlockRaster().
Referenced by ApplyFilter().
|
virtual |
Reimplemented from os::Image.
References AlphaToOverlay(), ColorizeFilter(), os::Image::F_ALPHA_TO_OVERLAY, os::Image::F_COLORIZE, os::Image::F_GLOW, os::Image::F_GRAY, os::Image::F_HIGHLIGHT, os::Message::FindColor32(), os::Message::FindInt32(), os::Message::GetCode(), GlowFilter(), GrayFilter(), HighlightFilter(), and TRANSPARENT_RGB32.
Referenced by SplashView::SetImage(), and SplashView::SplashView().
status_t BitmapImage::ColorizeFilter | ( | Color32_s | cColor | ) |
References os::BitmapImage::Private::AssertBitmapFlags(), os::Color32_s::blue, CLAMP255, os::Bitmap::GetBounds(), os::Bitmap::GetBytesPerRow(), os::Color32_s::green, os::Rect::Height(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_pcBitmap, os::Color32_s::red, os::Bitmap::SHARE_FRAMEBUFFER, and os::Bitmap::UnlockRaster().
Referenced by ApplyFilter().
Implements os::Image.
References os::View::DrawBitmap(), GetSize(), os::BitmapImage::Private::m_pcBitmap, os::Point::x, and os::Point::y.
Referenced by os::TreeViewNode::_DrawExpanderCross(), and SplashView::Paint().
cSource | Rectangular region in the source Image to draw. |
cDest | Rectangular region in the destination View to draw the image in. If the size of cDest is not equal to cSource, the image data from cSource will be scaled to fit. |
pcView | The View to draw in. |
Implements os::Image.
References os::View::DrawBitmap(), and os::BitmapImage::Private::m_pcBitmap.
void BitmapImage::Flush | ( | void | ) |
References os::Bitmap::Flush(), and os::BitmapImage::Private::m_pcBitmap.
color_space BitmapImage::GetColorSpace | ( | ) | const |
The | bitmap's colour space, one of the values in os::color_space. |
References CS_RGB32, os::Bitmap::GetColorSpace(), and os::BitmapImage::Private::m_pcBitmap.
Referenced by AlphaToOverlay(), GlowFilter(), operator=(), ResizeCanvas(), and SetSize().
|
static |
|
virtual |
Actual | Bitmap size. |
Reimplemented from os::Image.
References os::Bitmap::GetBounds(), os::Rect::Height(), os::BitmapImage::Private::m_pcBitmap, and os::Rect::Width().
Referenced by os::TreeViewNode::_DrawExpanderCross(), Draw(), os::IconDirectoryView::Private::GetDriveIcon(), SplashView::GetPreferredSize(), os::RegistrarManager::GetTypeAndIcon(), GlowFilter(), os::IconDirectoryView::HandleMessage(), operator=(), Save(), and SplashView::SplashView().
|
virtual |
References os::Bitmap::ACCEPT_VIEWS, os::Bitmap::AddChild(), os::BitmapImage::Private::AssertBitmapFlags(), os::Bitmap::GetBounds(), os::BitmapImage::Private::m_pcBitmap, and os::BitmapImage::Private::m_pcView.
cInnerColor | The colour nearest the edge of the picture. |
cOuterColor | The colour at the edge of the glow. Tip: set a low opacity here, to blend the glow with the background. |
nRadius | The width of the glow. |
References os::Color32_s::alpha, os::BitmapImage::Private::AssertBitmapFlags(), os::Color32_s::blue, os::Bitmap::GetBytesPerRow(), GetColorSpace(), GetSize(), os::Color32_s::green, os::Bitmap::LockRaster(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::m_pcBitmap, os::Color32_s::red, os::BitmapImage::Private::SetBitmap(), os::Bitmap::SHARE_FRAMEBUFFER, os::Bitmap::UnlockRaster(), os::Point::x, and os::Point::y.
Referenced by ApplyFilter().
status_t BitmapImage::GrayFilter | ( | void | ) |
References os::BitmapImage::Private::AssertBitmapFlags(), os::Color32_s::blue, CLAMP255, os::COL_NORMAL, os::get_default_color(), os::Bitmap::GetBounds(), os::Bitmap::GetBytesPerRow(), os::Color32_s::green, os::Rect::Height(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_pcBitmap, os::Color32_s::red, os::Bitmap::SHARE_FRAMEBUFFER, and os::Bitmap::UnlockRaster().
Referenced by ApplyFilter().
status_t BitmapImage::HighlightFilter | ( | void | ) |
References os::BitmapImage::Private::AssertBitmapFlags(), os::Color32_s::blue, CLAMP255, os::COL_SEL_WND_BORDER, os::get_default_color(), os::Bitmap::GetBounds(), os::Bitmap::GetBytesPerRow(), os::Color32_s::green, os::Rect::Height(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_pcBitmap, os::Color32_s::red, os::Bitmap::SHARE_FRAMEBUFFER, and os::Bitmap::UnlockRaster().
Referenced by ApplyFilter().
|
virtual |
Implements os::Image.
|
virtual |
Implements os::Image.
References os::BitmapImage::Private::m_pcBitmap.
|
virtual |
pcSource | A pointer to a StreamableIO object. Could be a file, a resource or any data source that can be represented as a stream of data. The Translator API is used to try to recognize the format and load it as bitmap data. |
cType | Used to specify a specific file format, if the automatic recognition is not enough. |
Implements os::Image.
References os::Translator::AddData(), os::BitmapFrameHeader::bf_bytes_per_row, os::BitmapFrameHeader::bf_data_size, os::BitmapFrameHeader::bf_frame, os::BitmapHeader::bh_bounds, os::IRect::bottom, CS_RGB32, os::TranslatorFactory::FindTranslator(), os::Bitmap::GetBytesPerRow(), os::TranslatorFactory::GetDefaultFactory(), os::IRect::Height(), os::IRect::left, os::Bitmap::LockRaster(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::m_pcBitmap, os::StreamableIO::Read(), os::Translator::Read(), os::BitmapImage::Private::SetBitmap(), os::Bitmap::SHARE_FRAMEBUFFER, os::IRect::top, and os::IRect::Width().
Referenced by BitmapImage(), os::IconDirectoryView::DragSelection(), os::IconDirectoryView::GetDirIcon(), os::IconDirectoryView::Private::GetDriveIcon(), os::RegistrarManager::GetTypeAndIcon(), os::IconDirectoryView::HandleMessage(), and MountDialogScanner::ScanPath().
|
virtual |
Pointer | to the locked Bitmap. If the internal Bitmap is not valid, returns NULL (see IsValid()). |
References os::BitmapImage::Private::m_pcBitmap.
|
virtual |
References GetColorSpace(), GetSize(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::m_pcBitmap, SetBitmapData(), os::Point::x, and os::Point::y.
|
virtual |
References os::BitmapImage::Private::AssertBitmapFlags(), os::Bitmap::GetBytesPerRow(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_pcBitmap, and os::Bitmap::SHARE_FRAMEBUFFER.
|
virtual |
cSize | The new size. |
References GetColorSpace(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::SetBitmap(), os::Point::x, and os::Point::y.
|
virtual |
pcDest | A pointer to a StreamableIO object. |
cType | String that describes the file format, eg "image/png". |
Implements os::Image.
References os::Translator::AddData(), os::BitmapFrameHeader::bf_bytes_per_row, os::BitmapFrameHeader::bf_color_space, os::BitmapFrameHeader::bf_data_size, os::BitmapFrameHeader::bf_frame, os::BitmapFrameHeader::bf_header_size, os::BitmapFrameHeader::bf_time_stamp, os::BitmapHeader::bh_bounds, os::BitmapHeader::bh_bytes_per_row, os::BitmapHeader::bh_color_space, os::BitmapHeader::bh_data_size, os::BitmapHeader::bh_flags, os::BitmapHeader::bh_frame_count, os::BitmapHeader::bh_header_size, os::IRect::bottom, CS_RGB32, os::TranslatorFactory::FindTranslator(), os::TranslatorFactory::GetDefaultFactory(), GetSize(), os::IRect::left, os::Bitmap::LockRaster(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::m_pcBitmap, os::Translator::Read(), os::IRect::right, os::Bitmap::SHARE_FRAMEBUFFER, os::IRect::top, os::StreamableIO::Write(), os::Point::x, and os::Point::y.
void BitmapImage::SetBitmapData | ( | const uint8 * | pData, |
const IPoint & | cSize, | ||
color_space | eColorSpace, | ||
uint32 | nFlags = Bitmap::SHARE_FRAMEBUFFER |
||
) |
pData | Pointer to an array of raw bitmap data. |
cSize | The size of the bitmap in pixels. |
eColorSpace | Color space, for instance CS_RGB32. |
nFlags | Bitmap flags, see os::Bitmap. SHARE_FRAMEBUFFER is assumed. |
References os::Bitmap::GetBytesPerRow(), os::Bitmap::LockRaster(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::SetBitmap(), os::Bitmap::SHARE_FRAMEBUFFER, os::IPoint::x, and os::IPoint::y.
Referenced by BitmapImage(), and operator=().
|
virtual |
eColorSpace | The colour space, eg. CS_RGB32. |
0 | for success, -1 for failure. |
|
virtual |
cSize | The new size. |
Reimplemented from os::Image.
References filter_lanczos3, GetColorSpace(), os::BitmapImage::Private::m_nBitmapFlags, os::BitmapImage::Private::m_pcBitmap, Scale(), os::BitmapImage::Private::SetBitmap(), os::Point::x, and os::Point::y.
Referenced by os::IconDirectoryView::DragSelection(), os::IconDirectoryView::Private::GetDriveIcon(), os::RegistrarManager::GetTypeAndIcon(), os::IconDirectoryView::HandleMessage(), and MountDialogScanner::ScanPath().
void BitmapImage::Sync | ( | void | ) |
References os::BitmapImage::Private::m_pcBitmap, and os::Bitmap::Sync().
|
virtual |