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 IMAGES

JohnNichols
Valued Contributor III
2,415 Views

Steve:

I was looking to use some Fortran code to fill in BITMAP arrays and then export the image to a BMP file.  I found a couple of sample codes online, one from a Stanford Prof is old school Fortran, but it works well.

I looked in the samples, but did not see anything of use.  I looked at the Forum posts from 2002 onwards, but this is a lot of QUICKWIN stuff and I do not enjoy that route at all.

Are you aware of any simple plain code that will allow me to create BITMAPS in Fortran -- I tried the

 

module RCImageBasic
  implicit none
 
  type rgbimage
     integer, dimension(:,:), pointer :: red, green, blue
     integer :: width, height
  end type rgbimage
 
  type rgb
     integer :: red, green, blue
  end type rgb
 
  interface operator (==)
     module procedure rgbequal
  end interface
 
  interface operator (.dist.)
     module procedure colordistance
  end interface

but it saves as a PPM, which needs GIMP and I prefer Paint.net.

Any thoughts

JMN

0 Kudos
6 Replies
Steven_L_Intel1
Employee
2,413 Views

The only bitmap functions we provide relate to QuickWin. See http://msdn.microsoft.com/en-us/library/dd183377(v=vs.85).aspx for a list of Windows API functions for dealing with bitmaps - these will be defined in module GDI32.

0 Kudos
JohnNichols
Valued Contributor III
2,413 Views

Steve:

I thought that was the answer, but I just wanted to check.

DISLIN appears to be the other way to go. I am about to try it with IFORT.

This all started because I found a brief code in C for a Water Supply Analysis system and I thought putting it into Fortran would be fun. Without mecej4 I would still be back using a lousy inversion routine. PARDISO is sweet, but http://en.wikipedia.org/wiki/Paradiso_(Amsterdam) is actually a building.

It is fun, but it is a much bigger exercise than I anticipated.

I was reading the EPANET manual and it suggested the C code had unlimited nodes. This clearly is not true.

JMN

 

0 Kudos
JVanB
Valued Contributor II
2,413 Views

Warning: possible duplicate message. I was interrupted by a captcha last time.

ifort has all you need to save .BMP images to a file because it has OpenGL and Win32 API interfaces. There is a crude example on the web at http://home.comcast.net/~kmbtib/Fortran_stuff/avl.zip . It's so poorly documented that it's even hard to see what it's supposed to do, but if you unzip into a folder and run the executable and open the only .DAT file available, then hit the <ENTER> key a few times and then the W key it makes a .BMP file! Subroutine drawBmp is responsible for drawing the BMP and saving it to disk. OpenGL draws much nicer images than gdi32 functions do, but it's not a simple API. Having a working example to build from is a big plus.

0 Kudos
andrew_4619
Honored Contributor III
2,413 Views

What are you trying to do? I have a Fortran routine that captures a full window (or the client area of a window) and saves it to a specified bitmap file, this uses using the windrows sdk. You can have it if it helps.

0 Kudos
Paul_Curtis
Valued Contributor I
2,413 Views

The attached .f90 file (abstracted from a much larger program) contains a fortran module which grabs the screen to a bitmap which is then saved as a .bmp file, and illustrates many concepts for bitmap file creation.  I have other F90/WinAPI codes for printing bitmaps.

0 Kudos
JohnNichols
Valued Contributor III
2,413 Views

Guys:

Thanks heaps. This is for my water supply analysis program MAGNI - Norse God Thor's son, name means Strong.

I have taken the standard gradient algorithm and with a lot of help from mecej4 and others got it running with PARDISO. This had been one of my Holy Grail Quests since '88. The program now handles quite complex models, so the problem one runs into is looking at the results. I can easily output the results as DXF files, which are very easy to write and debug, but not everyone has AutoCAD so I was looking to make some bitmap images of the results. Bitmaps is not something I have touched in Fortran.  

If you want to see how some people get to live in Heaven now, have a look at http://www.lakelandcam.co.uk/ - scan down for the pictures.

JMN

 

0 Kudos
Reply