[futurebasic] Re: [FB] Scrolling Picture

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Fri, 28 Feb 2003 00:47:28 -0500
> Thank you for the explanation.
> I have two questions so far....
> #1 Ref the first two statements in the following code. Should I be 
> doing a
> loop send each of my pictures to Gworld?

Sure.

DIM i
For i = 1 to TotalPicts // or =  0 to totalpicts -1 perhaps
myPictH = myPictHandles(whichone)
myDestinationRect;8 = @ myPictRects(whichOne) // Prestored Rects
LONG IF MyPictH // Know size of rect in advance...this method
    DrawPicture(myPictH,myDestinationRect)
END IF
next i
// All should be in place now in proper position on BigPicture GW.

Helps to draw things out on paper when doing things like this I have 
found.

> #2 Ref the last line of the code. It uses two MyBigRect's can they be
> different sizes? I am assuming one is the source and the other is the
> destination


The Big Rect is the size of your GWorld image. Actually, since you are 
scrolling it, you will just want to copy from Big Picture, the proper 
size rect that matches the current window size, which is presumably 
smaller.

So, just have a myWndDstRect as Rect, and set that.

DIM myBigSrcRect as Rect
DIM myWndDstRect as Rect


SetRect(myWndDstRect ,0,0,Window(_width),Window(_height))
myBigSrcRect;8 = @ myWndDstRect // now same size (Big Picture same 
height, right? )

offsetRect(myBigSrcRect, currentScrollX, 0) // Horizontal Scroll, maybe 
-currentScrollX

FN CopyQuick( myGWorld, myCurPort, myBigSrcRect, myWndDstRect , 
_srcCopy )
// Now copy from myGWorld is from current scroll place on "The Big 
Picture".

Copybits will scale things if the 2 rects are not identical in absolute 
size...this may or may not be a good thing. Factors divisible by 2 are 
best in that case.  (Double up, or scale down)

Otherwise, scrolling is just copying to the window, in a loop, while 
changing currentScrollX...thus you are copying to the window a 
different portion of the big picture over time, and it will appear to 
move in the direction of your scroll variable...you on occasion however 
have to use a pair of rects so as to "loop" the thing properly, so that 
it "wraps"

In this case, you have srcRectA, and srcRectB, and when srcRectB is all 
the way to the right, you use srcRectA to complete the proper size, and 
place both smaller rects that so that things seem continuous, 
imagewise. Easier done than said. :)

Robert

> Thanks also for your other two comments which ncame in as I wrote 
> this. My
> pictures are derived from PICTURE ON/OFF.
>
> myPictH = myPictHandles(whichone)
> myDestinationRect;8 = @ myPictRects(whichOne) // Prestored Rects
> LONG IF MyPictH // Know size of rect in advance...this method
>    DrawPicture(myPictH,myDestinationRect)
> END IF
> SetGWorld(myCurPort,myCurDevice)// now big picture is in GWorld
>
>
> // When you need a copy sent to your window...
> Window Output #YourWindowID
> GetGWorld(myCurPort,myCurDevice)
> FN CopyQuick( myGWorld, myCurPort, myBigRect, myBigRect, _srcCopy )
>
>
> --
> To unsubscribe, send ANY message to 
> <futurebasic-unsubscribe@...>
>