Keyhole effect?

Richard Gaskin ambassador at fourthworld.com
Wed Apr 15 15:02:52 EDT 2020


Mark Waddingham wrote:
 > On 2020-04-15 02:30, Richard Gaskin via use-livecode wrote:
 >> Monte Goulding wrote:
 >>
 >>> If I understand what you want correctly then:
 >>>
 >>> Create image
 >>> Create mask object
 >>> Group both
 >>> Set the ink of the mask object to blendDstIn
 >>> Set the ink of the group to blendSrcOver
 >>
 >> Super, Monte. That works well.
 >>
 >> I was up late with a tool I'd made to let me walk through all sorts
 >> of combinations, but I hadn't thought to group them.
 >
 > Oh look, clearly the 'useful' inks haven't really been removed -
 > they've just been replaced with the modern equivalents which give
 > much better fidelity results ;)


Whenever I fail to add, "...or seemingly so based on 22 years of 
experience in delivering applications with LiveCode, but of course 
notwithstanding the full scope of all possible things one might try 
given infinite time", please consider that implied. :)

I'm not the first person to have work stopped on a feature when the 
older inks were removed.

Monte's suggestion, and you your explanation, are very helpful.  I've 
passed them along to another developer I know who held up some of their 
own work when the method they'd been using was no longer available.

The new inks are indeed quite good, and the group trick is a very 
helpful key to unlocking how to use them well. Thank you.


 > Just to explain why the group is necessary - if a group has the
 > 'blendSrcOver' ink applied then it becomes a 'transparency group'.
 >
 > This means it has its own alpha channel which can be affected by the
 > 'destination alpha modifying' porter-duff operations. So in this case:
 >
 >    1) The group is a transparency group so allocates its own
 > transparent buffer
 >    2) The image is composited into the buffer
 >    3) The mask is then composited into the buffer with the DstIn ink.
 > This means that the destination buffer alpha is adjusted so it is only
 > 'in' the mask (an analog of ANDing the buffers alpha channel with the
 > mask's alpha channel - indeed, previously I'm guessing you would have
 > done this using some sort of AND bitwise ink and being careful with
 > colors used).
 >    4) The buffer is then composited with the background.
 >
 > The transparency group thing is needed partly for efficiency and
 > partly because you can't remove alpha from an opaque destination
 > - which a window provides.
 >
 > Hope this helps!
 >
 > Mark.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com






More information about the use-livecode mailing list