How to.... ?

Discuss any general programming issues here
Post Reply
gerograph
Posts: 39
Joined: Thu Mar 04, 2010 9:38 pm

How to.... ?

Post by gerograph »

1) How to gain a white border with shadows around an Image ?
2) How to zoom the whole thing (Image on white border) from center to nearly full screen ?

O.k. here are the details:
1) I need a downscaled image with white borders and shadow. I thought best way is to create a white png brush (e.g. 320x240) and output image onto that brush. But I am uncertain wether the image could be a bit smaller than the white brush, in order to create a white frame (original image size is e.g .800x600). The whole "package" should then be moved from border of screen to center (guess MoveBrush() is what I need here).

2) The whole package should then be resized from screen center to nearly full screen (320x240 -> original size 800x600). As far as I recall, "ZoomCenter" Transition effect only zooms from 1x1 Pixel to full size ?

However, please keep in mind that I haven't good Documentation here at the moment + that I just need a basic Idea on howto gain the desired effect, most effectivly.

Some Ideas ?
pecaN
Posts: 124
Joined: Thu Jun 10, 2010 4:15 pm

Re: How to.... ?

Post by pecaN »

this one is really interesting, i try to help you ... !!
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: How to.... ?

Post by Allanon »

Hi Gerograph,
the first idea that comes to mind is to make a shaded brush bigger then the original brush, let's say you have you brush <A> with size w=100 and h=50
if you have to make a 2 pixels white border you could clone this brush to another brush <B> then:
1.Zoom brush <B> to the size of w=104 and h = 54
2.Use TintBrush() on brush <B> to make it white
3.Select brush <B> and display brush <A> at 2, 2

Now you have brush <B> that is the brush <A> with 2 pixels white border

Not tested but it should work
pecaN
Posts: 124
Joined: Thu Jun 10, 2010 4:15 pm

Re: How to.... ?

Post by pecaN »

Ok, so i would need some additional info : would you use only one specific picture, or you want to use it with many pics (eg. for a picture viewer.. )
would you use layers ?
if you need only one picture, i would recommend you to create it in tvpaint and save as a brush - it is then much easier to achieve desired result...

anyway, drawing an image with border and shade is very simple via the BOX command !! Boxes can be filled with texture and can have borders and shadows...
so here you are :

@DISPLAY {Mode = "Windowed", Width = 900, Height = 700, Color = #olive} /* opens a screen */

@BRUSH 1, "pix.png" /* picture 800x600 */
EnableLayers()

ScaleBrush(1, 320, 256)
SetFillStyle(#filltexture,1) /* fill box with texture from picture */
SetFormStyle(#shadow, $939393, 8, #SHDWSOUTHEAST) /* set shadow */
SetFormStyle(#EDGE,#white,3) /* set edge */
box(4,4,320,256,$00ff00) /* draw a box at 4,4 position */
SetLayerName(1, "box") /* we need layer name so we can then move it */

MoveLayer("box", 4,4, #center, #center, #slowspeed) /* move it to the center */
WaitLeftMouse

this will draw a brush with 3 pixels white border with grey shadow and moves it from 4,4 to the center of the screen...
gerograph
Posts: 39
Joined: Thu Mar 04, 2010 9:38 pm

Re: How to.... ?

Post by gerograph »

@all
Thanx for the infos, helped me quiete a lot to get started, I post solution details here later !
Post Reply