- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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*128nomfic='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 -> screenstatus=SelectObject(hDCCompatibleBitMap,hDCBitMap)
status=StretchBlt(hdcScreen,100,100,bmp.bmWidth,bmp.bmHeight,hDCCompatibleBitMap,1,1,bmp.bmWidth,bmp.bmHeight,SRCCOPY)
return endNow 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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page