[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Drawing model (take 2)
Here is an attempt to address the Drawing model comment: "Color space for compositing not described, is alpha linear or not (maybe described later?) What is the influence of grnode on compositing - grouping complexifies compositing, neds to be carefully described." This could be a replacement or in addition to 2.2.2 Drawing model. Modifications: - color values are premultiplied. - addition of three simple examples. - typos in last paragraph. Questions: - Is this too much? - Is this not enough? - What should we say (if anything) about Escape 45 and RGBA/sRGBA? - What should we say (if anything) about transparent rasters? - What should we say (if anything) about transparent cell arrays? --- Implementations of WebCGM are expected to behave as though they implement a drawing model corresponding to the one described below. A real implementation is not required to implement the model in this way, but the result on any device supported by the implementation shall match that described by this model. 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) 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). Alpha compositing is performed in the current COLOUR MODEL (see T.16.19). Primitives in a WebCGM document have an implicit drawing order, with the first primitives in the WebCGM document getting drawn first. Subsequent primitives are drawn on top of previously drawn primitives. Primitives which have a value for Escape 45 other than fully opaque, have the effect of producing a temporary separate canvas initialized to transparent black onto which the primitive is drawn. The canvas is then composited into the background, taking into account the Escape 45 value. The presence of APS in the primitive list has no effect on the rendering. No temporary canvas are created. It is identical to the case of no APS. -- 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.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]