Bug 33711 - Alpha Value Normalization from 255 to 128
Summary: Alpha Value Normalization from 255 to 128
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 1.8.8
Hardware: Other Linux (All)
: highest blocker
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-30 02:43 UTC by ssseintr
Modified: 2018-05-29 10:44 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description ssseintr 2011-01-30 02:43:52 UTC
Dear Cairo Team,

Thanks for the excellent graphics engine. My self Vicky and developing embedded applications for consumer electronics. 

I'm using cairo in one platform it is linux based. The problem is the hardware in which I'm working restricts the Alpha value to 128(in ARGB32). So both cairo drawing & native drawing makes the hardware acceleration impossible. I'm using cairo's image surface, not any native backend's like x11 or directfb.

Can u pls show me the way where can i restrict the alpha value to 128. So for my platform, 0-full transparent & 128-Opaque.

Thanks in advance.

With Regards,
Vicky,.
Comment 1 Bill Spitzak 2011-01-30 16:06:15 UTC
I think he is saying that the hardware has 8 bits of alpha but basically 
treats all numbers <128 as zero and all numbers >=128 as 255.

Cairo can just produce the final image in it's own image memory and send 
it to the hardware as an opaque image. If for some reason they want 
Cairo's output to composite atop something else using the hardware, the 
best I can suggest is dithering using error diffusion of the alpha 
channel. Each pixel in the image buffer from cairo is either replaced 
with the unpremultiplied value with alpha==255, or with black with alpha==0.

On 01/30/2011 02:43 AM, bugzilla-daemon@freedesktop.org wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=33711
>
>             Summary: Alpha Value Normalization from 255 to 128
>             Product: cairo
>             Version: 1.8.8
>            Platform: Other
>          OS/Version: Linux (All)
>              Status: NEW
>            Severity: blocker
>            Priority: medium
>           Component: image backend
>          AssignedTo: cworth@cworth.org
>          ReportedBy: ssseintr@gmail.com
>           QAContact: cairo-bugs@cairographics.org
>
>
> Dear Cairo Team,
>
> Thanks for the excellent graphics engine. My self Vicky and developing embedded
> applications for consumer electronics.
>
> I'm using cairo in one platform it is linux based. The problem is the hardware
> in which I'm working restricts the Alpha value to 128(in ARGB32). So both cairo
> drawing&  native drawing makes the hardware acceleration impossible. I'm using
> cairo's image surface, not any native backend's like x11 or directfb.
>
> Can u pls show me the way where can i restrict the alpha value to 128. So for
> my platform, 0-full transparent&  128-Opaque.
>
> Thanks in advance.
>
> With Regards,
> Vicky,.
>
Comment 2 ssseintr 2011-01-30 20:54:57 UTC
Dear Bill Spitzak,

Thanks for your comment.

Actually my problem is,

my hardware has only 128 level of transparency. 

 (i.e) 0,1,2,3....,128

0 means full transparent 64 means semi transparent & 128 means opaque.

but cairo assumes & produces final image with 256 level of transparency.

  (i.e) 0,1,2,3,....,255.

I need to change the code in cairo, so which can produce the final image with only 128 level of transparency.

Is it possible in cairo to change level of transparency from 155 to 128 or I have to change in pixman..?

Expecting your reply.

Thanks & Regards,
Vicky.
Comment 3 ssseintr 2011-01-30 20:57:41 UTC
Dear Bill Spitzak,

Thanks for your comment.

Actually my problem is,

my hardware has only 128 level of transparency. 

 (i.e) 0,1,2,3....,128

0 means full transparent 64 means semi transparent & 128 means opaque.

but cairo assumes & produces final image with 256 level of transparency.

  (i.e) 0,1,2,3,....,255.

I need to change the code in cairo, so which can produce the final image with
only 128 level of transparency.

Is it possible in cairo to change level of transparency from 256 to 128 or I
have to change in pixman..?

Expecting your reply.

Thanks & Regards,
Vicky.
Comment 4 Siarhei Siamashka 2011-01-31 14:09:43 UTC
Could you clarify, is the supported range for alpha value actually 0-127 or 0-128 on your hardware?
Comment 5 ssseintr 2011-02-23 21:45:44 UTC
0-127 is my hardware's alpha ranges.
Comment 6 Siarhei Siamashka 2011-02-24 03:00:36 UTC
(In reply to comment #5)
> 0-127 is my hardware's alpha ranges.

OK, thanks for the clarification. So contrary to your initial report 127 is actually opaque. Then it's a simple case of adding x1a7r8g8b8 format to pixman as suggested in bug 33741

The 0-128 range would have been a bit more tricky, but at least I could see some more or less reasonable justification for somebody trying such format (for example it might help to avoid divisions by 255 or 127 for alpha blending).
Comment 7 ssseintr 2011-03-21 06:26:22 UTC
hi,

actually i'm using cairo on top of pixman(only pixman surface is supported) as
my graphics engine. I want to accelerate on top of my hardware. 

Which one is better, either doing it on pixman or doing it on cairo..?

Currently I'm using s/w only surface by disabling all other surfaces.

Please guide me to accelerate on top of h/w so i can get the jet fast graphics engine.

Regards,
Vicky


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.