![]() You could then pretty easily construct the pixel bytes on the fly from the XBM pixel data It will take some figuring out but once you understand both data formats, So you will need to figure out what order the bytes and pixels are needed to be inįor the printer bitmaps and potentially (more than likely) have to remap them Or the bytes can be stored vertically with the same bit ordering option. The pixels in the bytes can stored horizontally and the pixels can be MSB to LSB or LSB to MSB There are many different ways to represent pixels in memory. So you can't really tell the vertical from the horizontal. The sparkfun bitmap example code is not too helpful in understanding the data format.Īnd the example in the manual is also somewhat useless in that they did a 3x3 byte array The data format needed for bitmaps was not obvious. I took quick look at the manual and their sample code. This->SetDot(x+xbmx, y+xbmy, bg_color) // XBM 0 bits are bg color * Traverse through the XBM data byte by byte and plot pixel by pixelįor(xbmy = 0 xbmy SetDot(x+xbmx, y+xbmy, fg_color) // XBM 1 bits are fg color Uint8_t x, uint8_t y, uint8_t fg_color, uint8_t bg_color) Void glcd::DrawBitmapXBM_P(uint8_t width, uint8_t height, uint8_t *xbmbits, * The xbm bitmap pixel data format is the same as the X11 bitmap pixel data. * xbmbits a ponter to the XBM bitmap pixel data Void glcd::DrawBitmapXBM(ImageXBM_t bitmapxbm, uint8_t x, uint8_t y, uint8_t color)ĭrawBitmapXBM_P(width, height, xbmbits, x, y, color, bg_color) * Color is optional and defaults to BLACK. * The bitmap data is assumed to be in program memory. * The glcd xbm bitmap data format consists of 1 byte of width followed by 1 byte of height followed * Draws a x11 XBM bitmap image with the upper left corner at location x,y * y the y coordinate of the upper left corner of the bitmap * x the x coordinate of the upper left corner of the bitmap * bitmapxbm a ponter to the glcd XBM bitmap data * Draw a glcd bitmap image in x11 XBM bitmap data format To help you get started understanding XBM format, here is the rendering routine from the glcd library: /** I also included the width and height into the same data so that the full XBM data is ![]() When dealing with the AVR you will have to put the data in progmem. You will have to modify the format slightly to work with the AVR because of the ![]() You can then compile it directly by either including it orīut if you wanting this data to be used on an AVR chip say with Arduino (The glcd library I support will support XBM bitmap format in an upcomming release) It is much more compact for simple on/off pixel type images. I use the same tool (gimp) but prefer X11 bitmap format. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |