Richard Parker / EALCD
Revision:
0:839ecbf5cb2a
Child:
1:f04bcaea1d60
diff -r 000000000000 -r 839ecbf5cb2a widgets/EAImage.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/widgets/EAImage.h	Thu Feb 11 12:21:18 2010 +0000
@@ -0,0 +1,53 @@
+// Copyright 2010 Richard Parker
+
+#ifndef MBED_EAIMAGE_H
+#define MBED_EAIMAGE_H
+
+#include "mbed.h"
+
+#include "EAWidget.h"
+
+class EALCD;
+
+/**
+ * Class to handle loading and displaying an image.
+ * @author Richard Parker
+ */
+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;
+        unsigned int height;
+        unsigned short noColorPlanes;
+        unsigned short bitsPerPixel;
+        unsigned int compressionType;
+        unsigned int bmpSize;
+        unsigned int horizontalRes;
+        unsigned int verticalRes;
+        unsigned int noColors;
+        unsigned int noImportantColors;
+    };
+   
+    char* _path;
+    unsigned int _dataOffset;
+    
+    bool _loadHeader(const char* path);
+    
+};
+
+#endif
\ No newline at end of file