Transparent Images in LC

Rick Harrison harrison at all-auctions.com
Sat Apr 1 21:30:29 EDT 2017


Hi Paul,

I just took one of my old transparent .png images that I used 
to use a couple of years ago and imported it as a control into an 
LC 8.1.3 stack.  It worked just fine.

I think I might have created it with “Graphic Converter” for Mac.
If you put one of your images into a “DropBox” account with
a link for me I could take a look at it for you, and see if I can
find anything wrong with it.

Rick


> On Mar 31, 2017, at 9:46 AM, 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