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.
Diff: widgets/EAImage.h
- Revision:
- 1:f04bcaea1d60
- Parent:
- 0:839ecbf5cb2a
- Child:
- 6:4fe6f365cbeb
--- a/widgets/EAImage.h Thu Feb 11 12:21:18 2010 +0000
+++ b/widgets/EAImage.h Thu Mar 04 10:54:06 2010 +0000
@@ -8,6 +8,7 @@
#include "EAWidget.h"
class EALCD;
+class EAColor;
/**
* Class to handle loading and displaying an image.
@@ -16,19 +17,6 @@
class EAImage: public EAWidget
{
public:
- EAImage();
- ~EAImage();
-
- bool load(const char* path);
-
- inline const char* path() const { return _path; }
-
- inline bool isValid() const { return (_path != NULL); }
-
- virtual void paint(EALCD& lcd);
- virtual void paint(EALCD& lcd, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
-
-private:
struct EABMPHeader {
unsigned int headerSize;
unsigned int width;
@@ -42,11 +30,39 @@
unsigned int noColors;
unsigned int noImportantColors;
};
-
+
+ EAImage();
+ ~EAImage();
+
+ bool load(const char* path);
+ void unload();
+
+ inline const char* path() const { return _path; }
+
+ inline bool isValid() const { return (_path != NULL); }
+
+ virtual void paint(EALCD& lcd);
+ virtual void paint(EALCD& lcd, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
+
+ inline const EABMPHeader& info() { return _header; }
+
+ inline bool isMask() { return _mask; }
+ inline void setMask(bool value) { _mask = value; }
+
+private:
char* _path;
+ EAColor* _palette;
unsigned int _dataOffset;
+ EABMPHeader _header;
+ bool _mask;
bool _loadHeader(const char* path);
+ bool _loadPalette(FILE* fp);
+
+ int _wordsInRow();
+ int _wordForX(unsigned int x);
+ int _xWordOffset(unsigned int x);
+ unsigned short _getColourAtOffset(unsigned int word, int offset);
};