Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ======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,1=light,2=dark,3=black: This is an exact representation of the 2bpp used by the LCD graphics display. <code> i.e. $E4 = pixel 0,0 = black pixel 1,0 = dark pixel 2,0 = light pixel 3,0 = white </code> 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,filename,TRUE); //write the header FileOutput_write_byte(pFile,0x02);//this is a pic file FileOutput_write_byte(pFile,0x01);//only one picture in file FileOutput_write_byte(pFile,0xA0);//width of 160 FileOutput_write_byte(pFile,0x64);//height of 100 FileOutput_write_byte(pFile,0x00);//left side FileOutput_write_byte(pFile,0x00);//top side FileOutput_write_byte(pFile,0xA0);//width FileOutput_write_byte(pFile,0x64);//height //write pixel information err = FileOutput_write(pFile,DisplayGraphics_get_buf_addr(gfx),4000) != 4000; //destroy the file struct FileOutput_dtor(pFile,FREE_MEMORY); beep( err ? BEEP_ERROR : BEEP_OK ); } </code> {{tag>cybiko}} cybiko/graphicsmemoryformat.txt Last modified: 2009/11/27 17:54by 127.0.0.1