PDA

View Full Version : GDI+ not drawing after bitmap change



syn
11-24-2007, 09:32 PM
Hi,

I just started developing a gauge two days ago and I'm already suffering MS' lack of documentation.

My intention is to create a Radiogoniometer gauge for multiplayer ATC, to use it with the tower view. I started by using de SDK.FlightInfo gauge as a template.

After I finished programming the gauge I decided to change the background from the black one to a map of the zone in which I intend to control traffic, and here I encountered the problem.

With the default bitmaps from the SDK I have no problem at all, everything works fine, but when I put my own bitmap the drawing code stops working.

I attach the relevant parts of the code in case someone can see where the cause of the problem may be.


MAKE_STATIC
(
VDFMap_image,
BMP_FLIGHT_MAP_BLANK,
NULL,
NULL,
IMAGE_USE_ERASE|IMAGE_USE_BRIGHT|IMAGE_CREATE_DIBSECTION,
0,
MAP_LEFT_BORDER, MAP_TOP_BORDER
)

PELEMENT_HEADER VDFMap_next[] = { &VDFMap_image.header, NULL };


MAKE_STATIC
(
VDFMap_background,
BMP_FLIGHT_MAP_BACKGROUND,
VDFMap_next,
NULL,
IMAGE_USE_TRANSPARENCY,
0,
0,0
)

PELEMENT_HEADER VDFMap_list = &VDFMap_background.header;

------------------------------------------------

and in the callback I get the HDC this way:

PELEMENT_STATIC_IMAGE pelement = (PELEMENT_STATIC_IMAGE)(pgauge->elements_list[0]->next_element[0]);

if (pelement)
{
PIXPOINT dim = pelement->image_data.final->dim;
HDC hdc = pelement->hdc;


Graphics graphics(hdc);

-------------------------------------------------------

Can anyone help me here?? Im really stuck...

Thanks

n4gix
11-25-2007, 11:00 PM
If you are trying to draw over the top of a bitmap image, it won't work...

The DIBSECTION is NOT transparent...

Try adding the IMAGE_NO_STATIC_BLENDING to the list:

IMAGE_USE_ERASE|IMAGE_USE_BRIGHT|IMAGE_CREATE_DIBSECTION|IMAGE_NO_STATIC_BLENDING

I have a sinking feeling that it won't help though, as I'm pretty sure it has been depecrated with FS2004.

FSX + Acceleration has introduced a new flag IMAGE_ERASE_ALWAYS, but that won't work unless the user has Acceleration installed... :(