Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

bitmap and jpeg

jmloriot
Beginner
624 Views

Hi,

Thanks to every one for all the informations I had from the forum. I am very happy with fortran programming.

I have a program that displaysa bitmap on the screen and it works fine.

subroutine affiche_bitmap_ok

use kernel32, only: GetLastError

use ifwinty

use gdi32, only: CreateDC, CreateCompatibleDC, ResetDC, SelectObject, GetObjectType, GetObject, &

StretchBlt, DeleteObject, TextOut, StretchDIBits

use user32, only : loadimage,loadbitmap

implicit none

type (T_BITMAP) bmp

TYPE (T_BITMAPINFO) bmi

integer*4 hdcScreen,hdcCompatible,hDCBitMap,status,hDCCompatibleBitMap,Last_Erreur

character nomfic*128

nomfic='c:donlogo casal.bmp'

nomfic=

trim(nomfic)//char(0)

hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);

hdcCompatible = CreateCompatibleDC(hdcScreen);

hDCBitMap=loadimage(0,

loc(nomfic),IMAGE_BITMAP,0,0,LR_LOADFROMFILE)

status=GetObject(hDCBitMap,

sizeof(bmp), loc(bmp))

hDCCompatibleBitMap=CreateCompatibleDC(NULL)

! NULL -> screen

status=SelectObject(hDCCompatibleBitMap,hDCBitMap)

status=StretchBlt(hdcScreen,100,100,bmp.bmWidth,bmp.bmHeight,hDCCompatibleBitMap,1,1,bmp.bmWidth,bmp.bmHeight,SRCCOPY)

return

end

Now I want to do the same thing with a JPEG file.

I guess I have to use StretchDIBits but I have not been able to sort it out.

Does anybody have already done it ?

Thanks in advance

Jean-Marc

0 Kudos
1 Reply
anthonyrichards
New Contributor III
624 Views

This is non-trivial, as JPEG uses a compression algorithm.
If you are in a hurry, I would use a freely available application such as ImageMagick
to convert from Jpeg to Bitmap, then use your own Loadimage code for bitmaps.

Even the widely available application MSPAINT can read and convert between
Jpeg, Tiff and bitmap files. If it is available, there are ways to start MSPAINT with
a file argument and then send it messages using Sendmessage to trigger the appropriate
menu choices to save the displayed file in one of the optional formats it offers, and then close the application.
This can all be done from within your program while keeping the MSPAINT window hidden.

0 Kudos
Reply