Transparent Images in LC

Rick Harrison harrison at all-auctions.com
Thu Mar 30 14:10:16 EDT 2017


Hi Paul,

I’ve used .png images with transparencies with no problems before.
It almost sounds like the alpha-channel information is getting lost
somehow.

What program are you using to create your images?

Good luck tracking it down!

Rick


> On Mar 30, 2017, at 1:16 PM, Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> NOTE: I am using LC 6.7.11 for an update to a legacy app.
> 
> I was trying to import (as a control) a transparent PNG (i.e. the
> "white" parts allow whatever is underneath to show through) and instead
> of transparancy, I get the slashed background lines transparent PNG are
> often displayed with. Thinking it might be the PNG itself, I have our
> graphics person create a PNG that was transparent and shows up as
> transparent in other app, it still was not importing with the
> transparent parts transparent in LC.
> 
> Ultimately, I took the same image with the "transparent" parts as actual
> white and used the code below to create a transparency mask
> 
> command makeMask pObj
>  -- pObjs is a reference to an Image object
>  local tMaskData -- set to 0 [tranparent] for each byte in imageData
> that is white
>  get the imageData of pObj -- 4 bytes, 0,r,g,b white = 255, black = 0
>  put the number of bytes in it into X
>  repeat with i=1 to X step 4
>    if i > X then exit repeat
>    put byte (i+1) of it into r
>    put byte (i+2) of it into g
>    put byte (i+3) of it into b
>    put byteToNum(r) into rV
>    put byteToNum(g) into gV
>    put byteToNum(b) into bV
>    if rV=255 and gV=255 and bV=255 then
>      put numToByte(0) after tMaskData
>    else
>      put numToByte(1) after tMaskData
>    end if
>  end repeat
>  set the maskData of pObj to tMaskData
> end makeMask
> 
> Am I missing something? Is there a way to actually import an image with
> its transparency or is the only way via script control and scripting is
> the only way has anyone make a plugin tool to do this and if you have
> could you contribute the tool to the community edition and commercial
> versions so a tool to import transparent images becomes part of the main
> LiveCode distribution?
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list