Steven Rhodes / CNCAirbrush
Revision:
2:6d2a681c5cdf
Parent:
0:461ddbab4fd1
Child:
3:328a79795feb
--- a/Bitmap.h	Tue Apr 17 09:38:44 2012 +0000
+++ b/Bitmap.h	Wed Apr 18 22:32:47 2012 +0000
@@ -31,21 +31,10 @@
 #include "mbed.h"
 
 struct Row {
-    int rowNum;
-    long * string;
-    int length;
-    
-    /**
-    * Get the pixel at a position
-    * @param pixel column
-    *
-    * @return true if the pixel is black
-    */
-    bool pixel(int column);
 };
 
 class Bitmap {
-
+public:
     /**
     * Constructor to deal with bitmap
     *
@@ -60,14 +49,21 @@
     *
     * @return true if the image is successfully loaded
     */
-    bool loadImg(char* filename);
+    bool openImg(char* filename);
 
     /**
-    * Retrieve the selected row.
+    * Change the row we're looking at.
     *
-    * @return a pointer to a row struct
+    * @return true if successful.
     */
-    Row * getRow(int row);
+    bool setRow(int row);
+
+    /**
+    * Get whether we should draw a pixel at the given spot
+    * 
+    * @return true if there's a pixel.
+    */
+    bool isPixel(int pixel);
 
     /**
     * Return the height of the bitmap
@@ -82,5 +78,27 @@
     * @return width
     */
     int getWidth();
+    
+    /**
+    * Close the image when we're done with it
+    *
+    * @return true if properly closed
+    */
+    bool closeImg(void);
+    
+private:
+    FILE * fp;
+    bool loaded;
+    long offset, width, height, row_size, row_num;
+    long * row_data;
+    
+    /**
+    * Get the pixel at a position
+    * @param pixel column
+    *
+    * @return true if the pixel is black
+    */
+    bool pixel(int column);
+
 };
 #endif
\ No newline at end of file