Creating windowShapes in Rev

Dar Scott dsc at
Wed Dec 31 00:04:32 EST 2003

On Tuesday, December 30, 2003, at 09:34 PM, Ken Norris wrote:

> The problems for me come when I try to import something from one of my 
> cheap
> external paint programs that just don't show up properly in Rev images,
> mainly because of cross-platform compatibility I think. I end up 
> having to
> additionally take them into PhotoShop or somewhere else and resetting
> filetypes. Very time consuming experiments.

I often have problems with downloaded images.  I suspect that image 
file creators and/or Revolution are not handling some things correctly.

I have had very little success with pasting.  I import.

I just discovered that the PNG type you get from clipboard["image"] 
does not behave as I expected.

> ----------
>>> 1) If we can 'export snapshot' into an image, it should produce an
>>> 8-bit
>>> image rectangle with white pixels outside the paint area to the edges
>>> of the
>>> rectangle.
>> Except I don't know about "8-bit", I'd say yes.
> ----------
> Yes, I see what you mean. What I'm getting at is that maskData, like 
> stuff
> you paint with the Paint Palette, only works with 8-bit colors.

I looked at the data you get from the 'text' property of an image.  It 
is PNG.  The one I looked at had gamma info.  It had a palette with an 
alpha augmentation.

I don't know what you mean with maskData and 8-bit colors.

> ----------
>>> If I 'export snapshot' into an 'image' will it automatically convert
>>> to an
>>> image format, i.e., Rev's own 1-byte proprietary format?
>> I don't know.  I export to a variable as PNG.  I suspect this is the
>> same as a PNG file, but I have not checked.  I set the text property 
>> of
>> the image to the variable value.  An image shows up.  I don't know
>> about the proprietary format.
> -----------
> Well, like I said, I'm only concerned with maskData at this juncture. I
> don't know what the dynamic color range of a regular PNG is. If it is 
> higher
> than 8-bit, then it probably can't be used as a mask for windowShapes,
> unless Rev somehow switches it into a Rev-proprietary 8-bit inmage.

It is quite variable.

What I mean is that I know it works with PNG.  I think it did not work 
with some other type.  If you want to use export snapshot, then you 
might need to specify PNG.

However, you probably want _import_ snapshot and that avoids the whole 
issue.  Sorry about the bunny trail.

> -----------
>>> You still have to go through every pixel and re-render, right?
>> Yes, but in the simplest case, you build a new maskData based on image
>> data.  It will be fastest to accumulate in order.  This build does not
>> need to know the height and width (formatted) because it makes a pixel
>> transformation.
> -----------
> ??? This is what I don't understand. How does it work? ImageData is a 
> 32-bit
> thing, 4 bytes/pixel. According to the docs, maskData is 8-bit (1
> byte/pixel) only. I mean, sure, you can make a pixel which only uses 8 
> of
> its 32 bits, but that doesn't change it's actual depth, IOW, it's 
> still a 32
> bit pixel, and I would think that any image made with it cannot be 
> used as
> maskData unless you convert it somehow.
> So, is this the "transformation" you speak of? Again, how does it 
> work? I
> haven't succeeded in making an 8-bit mask from a 32-bit image in Rev. 
> I can
> do it very easily in other Mac-only venues, but not here, so far.

This should be a 10 to 20 line function in the simple case.  I'll send 
something later, I'm being called.

Dar Scott


More information about the Use-livecode mailing list