About window shape

Romain Lafourcade lafourcade.romain at numericable.fr
Mon Jun 2 11:35:01 EDT 2003


> <lafourcade.romain at numericable.fr> wrote:
>> Hello.
>> One of my first attempt at developing something
>> useful with RR 1.1.1 was a
>> very simple note pad (something like the one we used
>> to have on Mac) for my
>> girlfriend's PC.
>> 
>> Lately I was looking at the brand new RR 2.0 and
>> noticed a WindowShape
>> property that would be quite interesting to re-vamp
>> my note pad with
>> "lightly rounded edges".
>> 
>> However I have no idea of how to resize the stack
>> while KEEPING the rounded
>> edges. Does anyone have a hint ?
>> 
>> Romain
>> 
> 
> Bonjour Romain,
> 
> I experimented with this for a bit last week, and
> here's my conclusion : by updating the image that the
> windowshape is linked to, you can update the look of
> the stack.
> 
> However, the same experiment shows that as you enlarge
> the image using the built in commands, you get jagged
> edges as everything is resized proportionately.
> 
> So here's one idea of how we could use this
> information by maintaining a separate image solely for
> the windowshape of the stack
> - first read up on the structure of imageData and
> maskData properties
> - the width and height of the imageData and the
> maskData must match, so :
> length(imageData)=length(maskData*4)
> - if you use rounded corners, you have transparent
> pixels in each of the corners, on the first 5 lines
> and the last 5 lines presumably
> - if you make sure that the minimum window size is
> 10x10 pixels, the following should work
> - basically you're going to be building a maskData on
> the fly and then the matching imageData
> - start with a clean 10x10 maskdata (ie 100 chars
> representing the transparency of the 4 corners ;
> ASCII-value 0 = transparent, ASCII-value 255 = opaque)
> - start with the new width (say 150), and insert a
> string of 150-10=140 times numToChar(255) after char
> 5,155,305,455,605,755,905,1055,1205,1355 of your new
> maskData
> - now we'll insert enough numToChar(255) to cover the
> new height ; say the new heightr is 250, then we need
> to insert a string the length of 150*(250-10)=36000
> times numToChar(255), after char 1500 of the new
> maskData
> - before we can change the maskData we also need to
> build new imageData ; since we're not actually
> displaying the image anywhere, colour is not an issue
> ; so we can safely fill it up with 150*250*4=150000
> spaces
> - then update the width,height,maskData and imageData
> of our windowshape image, and the window should
> reflect our updates and have nice rounded corners
> 
> I came up with this theory as I was investigating a
> way of building drawers and still keeping things in a
> single stack. However, I don't have time to
> investigate this path anymore.
> It is very well possible that this is horrendously
> slow, as Transcript doesn't have a built-in
> replicate() function.
> 
> Nevertheless, I hope this helps in some way,
> 
> Jan Schenkel.
Hi, Jan.

That's what I was afraid of, this solution look quite slow but i'll give it
a try later tonight.

Thanks Jan.

Romain




More information about the use-livecode mailing list