Re: Transparent Images in LC

2017-04-01 Thread Rick Harrison via use-livecode
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 
>  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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Transparent Images in LC

2017-04-01 Thread Paul Dupuis via use-livecode
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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Transparent Images in LC

2017-03-30 Thread hh via use-livecode
Yes, I also have seen this sometimes when special kinds of alphachannel
(flattened/premultiplied/postmultiplied) were used in the PNG to import.

Nevertheless the following 'standard' import script works for me nearly
always in LC 6/7/8/9:

on mouseUp
  set the paintcompression to RLE
  if there is no img "import" then create img "import"
  -- handles alphachannel clever, even creates sometimes its own:
  set the resizequality of img "import" to "best" 
  put "Select a file to import" into prmpt
  answer file prmpt titled prmpt -- avoid mac 10.12 bug
  if it is empty then exit mouseUp
  put URL("binfile:" & it) into img "import"
  -- don't "hide" my click region with transpareny:
  set topleft of img "import" to the bottomleft of me
end mouseUp

> Paul D. wrote:
> 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.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Transparent Images in LC

2017-03-30 Thread Rick Harrison via use-livecode
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 
>  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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Transparent Images in LC

2017-03-30 Thread Richard Gaskin via use-livecode

Paul Dupuis wrote:

> 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.

My experience is like Bob's: lots of PNGs imported into LC for many 
years across many versions, and have never seen "slashed background 
lines" or lost transparency.


Perhaps double-check with your graphics person about how those were 
produced.  PNG is flexible and supports many options; maybe settings 
established for something else were left in place for the images 
exported to you.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for Desktop, Mobile, and Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Transparent Images in LC

2017-03-30 Thread Bob Sneidar via use-livecode
I use transparent PNG's all over my app and do not have that issue. It may be 
the PNG is protected in some way. I can send you one of my PNG's to test with 
to see if you get the same problem with them. 

Bob S


> On Mar 30, 2017, at 10:16 , Paul Dupuis via use-livecode 
>  wrote:
> 
> 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.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Transparent Images in LC

2017-03-30 Thread Paul Dupuis via use-livecode
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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode