[GRASS-dev] cause for bad colors in output from png driver

Hamish hamish_nospam at yahoo.com
Wed May 9 21:11:47 EDT 2007

Glynn Clements wrote:
> The framebuffer is always stored as B,G,R,A (the format used by 32-bpp
> BMP files).

(answers my earlier r.what.color question)

> This corresponds to 0xAARRGGBB on a little-endian system and
> 0xBBGGRRAA on a big-endian system (e.g. Mac).

dumb question: are Intel Macs now little endian?

> Externally (DRV_color, DRV_lookup_color), the alpha value is always
> zero (0 = opaque, 255 = transparent),

in gis.h I used:

typedef struct
    unsigned char r, g, b, a;  /* red, green, blue, and alpha */
} RGBA_Color ;

typedef RGBA_Color RGB_Color;

/* RGBA_Color alpha presets */
#define RGBA_COLOR_OPAQUE     255
#define RGBA_COLOR_NONE         0

Are the above alpha OPAQUE and TRANSPARENT values backwards? I had
pictured alpha as opacity, with OPAQUE being 100% and TRANSPARENT as 0%.
COLOR_NONE is used to indicate that the RGB array hasn't been filled.
(d.vect color=none)


More information about the grass-dev mailing list