New keyword pixel?

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: New keyword pixel?

Post by jacque » Mon Dec 16, 2013 4:20 pm

Actually the first byte is the alpha transparency. It's only always zero when there is no alpha mask.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: New keyword pixel?

Post by Mark » Mon Dec 16, 2013 4:25 pm

Hi Jaque,

Are you sure? I didn't check it now, but I thought we have the alphaMask for transparency and the extra byte wasn't used after all.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: New keyword pixel?

Post by jacque » Tue Dec 17, 2013 1:35 am

We may both be right, I had to go look it up to find out where I got the info. The "export [format] as RAW" command uses the first pixel to indicate the alpha channel, which is probably where I picked up the idea. That was in the 4.5 release notes and is marked "experimental". I do see that in the externals documentation for iOS though, RGB comprises the first 3 bytes and the last byte is ignored. Those notes say that the format depends on the OS, so it may vary.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

Re: New keyword pixel?

Post by ThatOneGuy » Thu Dec 19, 2013 3:18 am

Well it's good to know that it isn't entirely impossible to just change the image's pixels to what you want. In fact, this method doesn't sound all that bad and can be done fairly quickly with a repeat loop.

Having the ability to just do "set pixel (x,y) of img "imageName" to (A,R,G,B)" would make things simple.

The same effect can be gained by getting the formattedWidth of the image and multiplying by four to get the data width of the image, then getting the number of rows (of pixels) from the top of the image multiplied by the data width and added to four multiplied by the distance (in pixels) from the left side of the image. That value can be used for the seek location when changing the imageData. In that way you can just set the 4 values (as ASCII characters) in that place to what you want and the exact pixel you wanted to change will become what you wanted.

It's actually very easy when you think about it.

Post Reply