[haiku-bugs] Re: [Haiku] #10007: OP_INVERT and anti-aliasing don't play together

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Tue, 29 Nov 2016 06:22:59 -0000

#10007: OP_INVERT and anti-aliasing don't play together
----------------------------------+----------------------------
   Reporter:  Pete                |      Owner:  stippi
       Type:  bug                 |     Status:  assigned
   Priority:  normal              |  Milestone:  R1
  Component:  Kits/Interface Kit  |    Version:  R1/Development
 Resolution:                      |   Keywords:
 Blocked By:                      |   Blocking:
Has a Patch:  0                   |   Platform:  All
----------------------------------+----------------------------

Comment (by pulkomandy):

 The inversion is not done with an XOR, but with a negation: {{{d[0] = 255
 - _p.data8[0];}}}. This is also a reversible operation: {{{255 - (255 - x)
 = 255 - 255 + x = x}}}.

 This formula is used when the drawing fully covers a pixel. When there is
 only partial coverage, that new color is blended with the previous one:
 {{{BLEND(d, 255 - _p.data8[2], 255 - _p.data8[1], 255 - _p.data8[0],
 a);}}} (with a being the coverage percentage).

 The BLEND macro does: {{{d[0] = ((((b - _p.data8[0]) * a) + (_p.data8[0]
 << 8)) >> 8);}}} (with "b" the new color, "a" the coverage, and _p the
 initial value of the pixel). Blending in this way is not a self-reversible
 operation. I don't know if we can design a reversible blend for this
 purpose.

--
Ticket URL: <https://dev.haiku-os.org/ticket/10007#comment:7>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: