OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cgmo-webcgm message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re[2]: [cgmo-webcgm] Drawing model (take 2)


BTW, I forgot to mention (again), that the examples are using a 'argb'
notation instead of 'rgba'.

Any way, it doesn't seem to be the source of your question. As I said
in this version of the wording "all color values use premultiplied
alpha".

So fully transparent red is not (0,1,0,0) it is (0,0,0,0). That should
work.

-- 
Regards,
 Benoit   mailto:benoit@itedo.com

This e-mail and any attachments are confidential and may be protected
by legal privilege. If you are not the intended recipient, be aware
that any disclosure, copying, distribution or use of this e-mail or
any attachment is prohibited. If you have received this e-mail in
error, please notify us immediately by returning it to the sender and
delete this copy from your system. Thank you for your cooperation. 


Thursday, April 20, 2006, 10:36:40 AM, you wrote:

> [...1 of 2...]

> I'll write more about Benoit's questions in next message.  But for now, a
> technical nit...

> I wonder if there's a bug in the equations?

>>[...]
>>WebCGM uses a painters model of rendering. Colors are applied in
>>successive operations to the output device. When an area overlaps a
>>previously colored area the new color partially or completely obscures
>>the old. When the color is not completely opaque the result on the
>>output device is defined by the following (mathematical) rules for
>>compositing (all color values use premultiplied alpha):
>>
>>Pr, Pg, Pb    - Primitive color value
>>Pa            - Primitive alpha value
>>Cr, Cg, Cb    - Canvas color value (before blending)
>>Ca            - Canvas alpha value (before blending)
>>Cr', Cg', Cb' - Canvas color value (after blending)
>>Ca'           - Canvas alpha value (after blending)
>>Ca' = 1 - (1 - Pa) * (1 - Ca)

> Are the following equations correct?  If primitive is fully transparent
> red, for example (0, 1, 0, 0), then it should not affect the canvas, 
> right?  I.e., intuitively Cr'=Cr.  But the equation gives,

> Cr' = Cr + Pr

> Similarly, the equation gives intuitively wrong result for Pa=1 (fully
> opaque).  So I think the equation actually needs to be:

> Cr' = (1 - Pa)*Cr + Pa*Pr

> Thoughts?

> -Lofton.

>>Cr' = (1 - Pa) * Cr + Pr
>>Cg' = (1 - Pa) * Cg + Pg
>>Cb' = (1 - Pa) * Cb + Pb
>>
>>Example #1:
>>Primitive is semi transparent red: (Pa, Pr, Pg, Pb) = (0.5,0.5,0,0)
>>Canvas is opaque black: (Ca, Cr, Cg, Cb) = (1,0,0,0)
>>Ca' = 1 - (1 - 0.5) * (1 - 1) = 1
>>Cr' = (1 - 0.5) * 0 + 0.5 = 0.5
>>Cg' = (1 - 0.5) * 0 + 0 = 0
>>Cb' = (1 - 0.5) * 0 + 0 = 0
>>The result is an opaque dark red (1,0.5,0,0).
>>
>>Example #2:
>>Primitive is opaque red: (Pa, Pr, Pg, Pb) = (1,1,0,0)
>>Canvas is semi transparent black: (Ca, Cr, Cg, Cb) = (0.5,0,0,0)
>>Ca' = 1 - (1 - 1) * (1 - 0.5) = 1
>>Cr' = (1 - 1) * 0 + 1 = 1
>>Cg' = (1 - 1) * 0 + 0 = 0
>>Cb' = (1 - 1) * 0 + 0 = 0
>>The result is an opaque red (1,1,0,0).
>>
>>Example #3:
>>Primitive is semi transparent red: (Pa, Pr, Pg, Pb) = (0.5,0.5,0,0)
>>Canvas is semi transparent black: (Ca, Cr, Cg, Cb) = (0.5,0,0,0)
>>Ca' = 1 - (1 - 0.5) * (1 - 0.5) = 0.75
>>Cr' = (1 - 0.5) * 0 + 0.5 = 0.5
>>Cg' = (1 - 0.5) * 0 + 0 = 0
>>Cb' = (1 - 0.5) * 0 + 0 = 0
>>The result is a transparent dark red (0.75,0.5,0,0).




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]