cancel
Showing results for 
Search instead for 
Did you mean: 

JPEG Display Error

fjahn9
Associate II
Posted on April 06, 2016 at 08:35

Hello,

When I try to draw JPEG�s I get a faulty display.

http://www.ecs-online.dyndns.org/Uploads/Original.jpg

http://www.ecs-online.dyndns.org/Uploads/Incorrect.JPG

MS_LoadFileIntoMemory(&fileNames[currentSel][0], arrayImagePreview1, MEMORY_SPACE_IMAGE_PREVIEW_1, USBH_Path, &realFileSizePreview1);

prepareDrawPicture(); //For newXPos, newYPos, numeratorDraw, denominator

GUI_JPEG_DrawScaled(arrayImagePreview1, realFileSizePreview1, newXPos, newYPos, numeratorDraw, denominator);

int MS_LoadFileIntoMemory(char *fileName, char *fileBuffer, uint32_t fileSize, char* _Path, uint32_t* realFileSize)

{

uint32_t numberOfBytesRead; //Anzahl der tats�chlich gelesenen Zeichen

uint32_t numberOfBytesToRead; //Anzahl der zu lesenden Zeichen

int result; //Ergebniss der FAT Aktionen

char file_path[MAX_FILENAME_LEN + 4] = ''''; //Pfad zur Datei, + SD_Path l�nge (''0:/'') + String End Zeichen

FIL file; //Datei Handle

//Fehlerpr�fungen

assert_param(fileBuffer != NULL);

assert_param(fileName != NULL);

assert_param(fileName[0] != '\0');

assert_param(fileSize != 0);

//Pfadt zusammenbauen

//strcat(file_path, USBH_Path);

//strcat(file_path, SD_Path);

strcat(file_path, _Path);

strcat(file_path, fileName);

//Datei �ffnen

result = f_open(&file, file_path, FA_OPEN_EXISTING | FA_READ);

if (result != FR_OK)

{

GUI_DispString(fileName);

GUI_DispString('' Open File...ERROR\n'');

printf('' Open File...ERROR\n'');

return -1;

}

//Komplette Datei auslesen. Falls die Datei gr��er als der

//verf�gbarer Speicher ist, wird auf maximal m�gliche L�nge begrenzt

numberOfBytesToRead = file.fsize;

if (numberOfBytesToRead > fileSize)

{

numberOfBytesToRead = fileSize;

}

//Datei auslesen

result = f_read(&file,fileBuffer,numberOfBytesToRead,&numberOfBytesRead);

if (result != FR_OK)

{

result = f_close(&file);

GUI_DispString(fileName);

GUI_DispString('' Read File...ERROR\n'');

printf('' Read File...ERROR\n'');

return -2;

}

if(numberOfBytesToRead != numberOfBytesRead)

{

result = f_close(&file);

GUI_DispString(''numberOfBytesToRead != numberOfBytesRead ...ERROR\n'');

printf(''numberOfBytesToRead != numberOfBytesRead ...ERROR\n'');

return -3;

}

if(realFileSize != NULL)

{

*realFileSize = numberOfBytesRead;

}

//Datei schlie�en

result = f_close(&file);

if (result != FR_OK)

{

GUI_DispString(fileName);

GUI_DispString('' Close File...ERROR\n'');

printf('' Close File...ERROR\n'');

return -4;

}

return 0;

}

Does anyone have an idea where my mistake is?

Thanks a lot

Jens

#stemwin
0 REPLIES 0