Global Mapper v26.0

Shader color palette info for my own legend

unjedai
unjedai Global Mapper User
edited August 2012 in SDK
I'd like to get information on the color palette used by the shader for elevation rasters so I can draw my own legend but I can't seem to find it anywhere. GM_LayerInfo_t has a mPaletteSize but it is always 0. GM_CustomShader_t has mElevColorList but it's empty, probably because I'm using the Atlas shader and not a custom shader. Are the color palettes for the built in shaders available via the SDK or documented somewhere?

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2012
    The atlas shader doesn't directly expose the palette anywhere, but it's basically as follows as percentages of the elevation range from the minimum to maximum elevation:

    0: RGB(0,0,255)
    6.6%: RGB(0,255,255)
    20%: RGB(0,255,0)
    46.6%: RGB(255,255,0)
    100%: RGB(255,0,0)

    This could in theory be turned into a custom shader, but it predates the custom shader and is also slightly faster with the built-in values.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • unjedai
    unjedai Global Mapper User
    edited August 2012
    That's exactly what I need, thank you. Can I get the palette info on the other built-in shaders also? Actually I only need Color Ramp Shader, Global Shader, and HSV Shader as those are the only ones I use.
  • global_mapper
    global_mapper Administrator
    edited August 2012
    The color ramp is as below:

    0% - RGB(0,0,255)
    25% - RGB(0,255,255)
    50% - RGB(0,255,0)
    75% - RGB(255,255,0)
    100% - RGB(255,0,0)

    The global shader is just a normal ranged custom shader, you can initialize another shader from it in the application and see it's values. The HSV shader doesn't have a set range like that, it is calculated based on several different configurable values.

    If you really want to get anything programmatically I would create a custom elevation grid layer with a small array of values using GM_CreateCustomElevGridLayer, then use GM_DrawLayerListToBitmap to render that to a bitmap, then access the colors in that to see how it was shaded.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com