Calculator Community > Casio PRIZM
[PRIZM] Paint
blue_bear_94:
Nice work! I made a similar program for the TI-89 named Kraphyko, but the 24K limit prevented me from going farther.
Spenceboy98:
*BUMP*
Updates:
Faster image saving and loading.
I got it to load a new image. :P
More screenshots(doodles):
Zoomed:
TIfanx1999:
Looks quite nice! :)
Spenceboy98:
*BUMP*
I'm experimenting with trying to get it to save BMP. The problem is that I try to open it and it says that it is corrupt.
Here is my saving code:
--- Code: ---void saveBMP(char *filename, color_t *data, int width, int height){
BMPHEAD bh;
memset ((char *)&bh,0,sizeof(BMPHEAD)); /* sets everything to 0 */
memcpy (bh.id,"BM",2);
bh.reserved[0] = 0;
bh.reserved[1] = 0;
bh.headersize = 54L;
bh.infoSize = 0x28L;
bh.width = width;
bh.depth = height;
bh.biPlanes = 1;
bh.bits = 24;
bh.biCompression = 0L;
int bytesPerLine;
bytesPerLine = bh.width * 3; /* (for 24 bit images) */
/* round up to a dword boundary */
if (bytesPerLine & 0x0003)
{
bytesPerLine |= 0x0003;
++bytesPerLine;
}
bh.filesize=bh.headersize+(long)bytesPerLine*bh.depth;
int size = bh.headersize+(long)bytesPerLine*bh.depth;
char * PATH;
PATH = alloca(strlen("\\\\fls0\\")+strlen1(filename)+strlen(".bmp")+1);
strcpy(PATH, "\\\\fls0\\");
strcat(PATH, filename);
strcat(PATH, ".bmp");
unsigned short * pFile = alloca(2*(strlen(PATH)+1));
Bfile_StrToName_ncpy(pFile, (unsigned char*)PATH, strlen(PATH)+1);
Bfile_CreateEntry_OS(pFile, CREATEMODE_FILE, &size);
int hFile = Bfile_OpenFile_OS(pFile, 2);
Bfile_WriteFile_OS(hFile, &bh, sizeof(bh));
char *linebuf;
linebuf = (char *) malloc(bytesPerLine*sizeof(char));
if (linebuf == NULL){
Bfile_CloseFile_OS(hFile);
return;
}
int line;
for (line = height; line >= 0; line --){
for(int i = 0; i < width; i++){
linebuf[i] = data[line*width+i];
}
Bfile_WriteFile_OS(hFile, linebuf, sizeof(linebuf));
}
Bfile_CloseFile_OS(hFile);
free(linebuf);
}
--- End code ---
Using this website for basis: http://www.siggraph.org/education/materials/HyperVis/asp_data/compimag/bmpfile.htm
I don't think loading the data is going correctly. Can someone please help?
DJ Omnimaga:
This isn't the right sub-forum to ask for programming help. You should use the Lua or C programming help section for that, else only people who check Casio stuff will see your request.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version