Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Everkosus

Pages: [1]
1
TI-Nspire / Re: [Ndless] n2DLib
« on: September 13, 2014, 08:22:10 am »
Well i wrote a program which converts any image to the raw data and write it to a new file, but you're right a function that loads a .bmp and does the whole conversion would be much better. xD
I just thought the possibility to store the images in files and load them dynamically would be good.

2
TI-Nspire / Re: [Ndless] n2DLib
« on: September 13, 2014, 06:54:54 am »

Hey grate lib, but in my opinion there should be a function that loads a image from a file, so i made a function that does that. Maybe you want to include this function in to you lib.


Code: [Select]
unsigned short* imageLoadFromFile(char *path){

FILE* readFile = fopen(path, "rb" );
if(readFile == NULL){
return NULL;
}


fseek(readFile, 0L, SEEK_END);
int size = ftell(readFile);
fseek(readFile, 0L, SEEK_SET);

unsigned short *array;


array = (unsigned short *) malloc(size);


if(array == NULL) {
return NULL;
}
int i;
for(i = 0; i < size/2; i++){
array[i] = fgetc(readFile) << 8;
array[i] += fgetc(readFile);
}
fclose(readFile);
return array;
}

Pages: [1]