[Bf-committers] Re: image editor / draw alpha

Branan Riley branan at gmail.com
Wed Jun 14 00:20:20 CEST 2006


The problem is the draw alpha option, to show what the alpha looks
like. It's using a single 32-bit value for the display of the alpha,
which is actually all four components, not just the alpha.

I did a test with an image, and it's definately using all four
channels. I'm getting drastically different values based on the color,
not just on the alpha.

Here's the offending code segment...

static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int
recty, unsigned int *recti)
{

    /* swap bytes, so alpha is most significant one, then just draw it
as luminance int */
    glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
    glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE,
GL_UNSIGNED_INT, recti);
    glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
}

Sorry I wasn't clear earlier.

On 6/13/06, Ton Roosendaal <ton at blender.org> wrote:
> Hi,
>
> The rgba rects in Blender fully follow the opengl standard for 32 bits
> graphics.
> Alpha is not "lumincance" really...
>
> We do store the 32 bits color in a single unsigned int yes, but it is
> only read by interpreting it as a char array, so endian insensitive.
>
> -Ton-
>
> On 13 Jun, 2006, at 20:56, Branan Riley wrote:
>
> > Whilst looking at the rgb/bgr jpeg issue (which is very strange, still
> > needs messing with) I noticed something odd in the image code.
> >
> > Rather than showing just the alpha as luminance as it should, it shows
> > ABGR (ARGB? does blender use RGB or BGR internally?) as a single
> > 32-bit luminance value.
> >
> > This isn't what's intended, I'd expect. I don't see how it can be
> > fixed easily, either. Off the top of my head, there are three
> > solutions:
> >
> > (A) sperating the alpha data before re-drawing (slow)
> > (B) Doing (A) once when the image is created / loaded, and storing the
> > result with the image buffer
> > (C) getting rid of the ability to draw just the alpha.
> >
> > I can implement (A) in a matter of minutes. (B) would involve changes
> > to how data is stored, which would mean SDNA stuff, which I know
> > nothing about. Anyone have an opinion on how best to fix this?
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at projects.blender.org
> > http://projects.blender.org/mailman/listinfo/bf-committers
> >
> >
> >
> ------------------------------------------------------------------------
> --
> Ton Roosendaal  Blender Foundation ton at blender.org
> http://www.blender.org
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list