Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MaximInterface
Diff: Image.hpp
- Revision:
- 8:a0d75dff3c9b
- Parent:
- 0:33d4e66780c0
- Child:
- 10:71359af61af8
--- a/Image.hpp Thu Mar 09 11:38:33 2017 -0600 +++ b/Image.hpp Thu Apr 06 15:16:30 2017 -0500 @@ -39,23 +39,13 @@ class Image : public Graphic { public: - explicit Image(const Bitmap & bitmap, Graphic * parent = NULL) : - Graphic(parent), m_bitmap(bitmap) - { - // Graphic dimensions default to the bitmap dimensions. - setWidth(preferredWidth()); - setHeight(preferredHeight()); - } + explicit Image(const Bitmap & bitmap) : m_bitmap(bitmap) { } - virtual int preferredWidth() const { return m_bitmap.width(); } - virtual int preferredHeight() const { return m_bitmap.height(); } + int preferredWidth() const { return m_bitmap.width(); } + int preferredHeight() const { return m_bitmap.height(); } - virtual Bitmap render() const - { - Bitmap bitmap(width(), height()); - bitmap.overlay(m_bitmap, 0, 0); - return bitmap; - } +protected: + virtual void doRender(Bitmap & bitmap) const; private: Bitmap m_bitmap;