[Gdal-dev] how to draw images on Windows

Frank Warmerdam warmerdam at pobox.com
Fri Mar 5 13:11:04 EST 2004


Áõ Ç컪 wrote:
> hi, all
> i am new to GDAL. it is great. and i would like to know how to visualize 
> the images on Windows with Windows GDI.
> any suggestions would be very appreciated.
> thanks in advance

Áõ Ç컪,

There is no built-in support for display within the GDAL library.  It may
be that someone will volunteer some suggestions on how to do this, but
I wouldn't hold my breath.

Generally, you can just read up on how GDI image drawing is done.  You
will need to load the raster data into a "DIB" (I think that is the
right terminology), which is a raster image in memory.  You have to
create all the DIB headers yourself, but the data can be loaded into
the raster array itself directly using GDAL's RasterIO() functions.

Be carefuly about band mappings and image orientation.  I think DIBs
are upside down (the first line in the buffer is the bottom of the image)
and that they are in BGRA or perhaps ABGR order instead of the RGB or
RGBA you would normally get from GDAL supported raster files.

If you find your getting an upside image, or one with red and blue
mixed up you might want to ask here how to remap these sorts of things
using the GDAL RasterIO() calls.  Till then, good luck with GDI.  I
certainly don't want to touch it again!

Good luck,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list