no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | cybiko:graphicsmemoryformat [2009/11/27 17:54] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Picture File Format====== | ||
+ | The cybiko internal graphics memory format is | ||
+ | very simple. It is exactly 4000 bytes. (160x100/4) | ||
+ | It is formatted left to right, top to bottom, | ||
+ | 4 pixels per byte, most significant bits to the left, | ||
+ | 0=white, | ||
+ | |||
+ | This is an exact representation of the 2bpp used by the LCD graphics display. | ||
+ | < | ||
+ | i.e. $E4 = | ||
+ | pixel 0,0 = black | ||
+ | pixel 1,0 = dark | ||
+ | pixel 2,0 = light | ||
+ | pixel 3,0 = white | ||
+ | </ | ||
+ | The full screen *.pic files that are created with | ||
+ | the SDK Converter or the CyberLoad Converter are | ||
+ | the same format except 8 header bytes are added | ||
+ | or 4008 bytes total. | ||
+ | |||
+ | Example code snippet that will save the screen to a file. | ||
+ | <code c> | ||
+ | void SaveScreenShot(struct DisplayGraphics* gfx,char* filename) | ||
+ | { | ||
+ | int err; | ||
+ | //output file | ||
+ | struct FileOutput* pFile; | ||
+ | |||
+ | //allocate output file structure | ||
+ | pFile=(struct FileOutput*)malloc(sizeof(struct FileOutput)); | ||
+ | |||
+ | //construct output file | ||
+ | FileOutput_ctor(pFile); | ||
+ | |||
+ | //open output file | ||
+ | FileOutput_open(pFile, | ||
+ | |||
+ | //write the header | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | FileOutput_write_byte(pFile, | ||
+ | | ||
+ | //write pixel information | ||
+ | err = FileOutput_write(pFile, | ||
+ | |||
+ | //destroy the file struct | ||
+ | FileOutput_dtor(pFile, | ||
+ | |||
+ | beep( err ? BEEP_ERROR : BEEP_OK ); | ||
+ | } | ||
+ | </ | ||
+ | {{tag> |