How to make an area transparent ?

mg.srikanth
mg.srikanth Global Mapper User
edited November 2012 in SDK
Hi,
How do I apply transparency to a layer/feature on the map display using sdk?
Or how do I draw a translucent area feature?

Srikanth

Comments

  • global_mapper
    global_mapper Administrator
    edited November 2012
    For raster layers use GM_SetRasterDisplayOptions to set a particular color transparent for a raster layer or to make the layer translucent.

    For area features, use GM_SetAreaFeatureDrawStyle. The color is a 4-byte value and you can use the upper byte for an alpha value for translucency if you use GM_BRUSH_SOLID as the fill style.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • mg.srikanth
    mg.srikanth Global Mapper User
    edited November 2012
    Hi Mike,
    I used GM_SetAreaFeatureDrawStyle but the color is taking RGB only how to specify ARGB value? I tried assigning (A,R,G,B) values but did not work for me, how to specify alpha value for a color, can u provide a sample syntax for it?

    Thanks

    Srikanth.
  • global_mapper
    global_mapper Administrator
    edited November 2012
    It is just the upper 8 bits of the value. So just setup the 24-bit color that you want, then add the alpha left shifted by 24-bits to put it in the top. For example, to setup red with an alpha of 200, do the following:

    uint8 theAlpha = 200;
    theAreaStyle.mBrushColor = COLORREF( 255, 0, 0 ) + ( theAlpha << 24 );

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • mg.srikanth
    mg.srikanth Global Mapper User
    edited November 2012
    Thank you Mike,
    COLORREF( 255, 0, 0 ) + ( theAlpha << 24 ); - did not work for me but the following worked
    RGB( 255, 0, 0 ) + ( theAlpha << 24 );

    Thanks Mike