Jump to navigation
This function is handy when working with several Image::BitmapData objects and writing asserts:
Point <int> BitmapData::getSize () const
return Point <int> (width, height);
Open Source: Beast, LayerEffects, VFLib, SimpleDJ, DSP Filters...
I've got a bit of a psychological block about using a Point to hold a size. I've avoided doing so anywhere up to now, and keep thinking that I should probably add a "Size" class specially for that kind of thing. I know that a size is essentially just a point relative to the origin, but it just feels like it should have a different class..
ditto - that's why I frequently lament [to myself, of course] that the Point class wasn't just called Vector2D ;)
I've got a bit of a psychological block about using a Point to hold a size.
Okay, we can just use a rectangle instead:
Rectangle <int> BitmapData::getBounds () const
return Rectangle <int> (0, 0, width, height);
If someone wants the size as a point they could use BitmapData::getBounds().getBottomRight().
FYI, this is non critical. I've created a subclass of BitmapData to facilitate the operations on pixels and I put my getSize() in there.
© 2014 Raw Material Software Ltd.