DrawImageRect query

Archives Forums/BlitzPlus Programming/DrawImageRect query

Who was John Galt?(Posted 2003) [#1]
I'm using some code to plonk my scrolly background, like so;
format_code('DrawImageRect map,0,0,p1\mapx,p1\mapy,800,600')

All this worked fine until recently when I upgraded from Blitz 2d to Blitz+. Now when I scroll off the top or left of them image (mapx or mapy<0) [which I want to be able to do!!], I see a clipped background image, but the top left of the full map image remains at (0,0) on the screen, rather than continuing to move down,right as I scroll up,left. Is this a known mod or error with B+?


cbmeeks(Posted 2003) [#2]
we would have to see a better example.

Can you post more code?

cb


Who was John Galt?(Posted 2003) [#3]
Sure-

format_code('
Global use_key=28, up_key=200, down_key=208, left_key=203,right_key=205,fire_key=157, exit_key=1
screenx=800
screeny=600

map=CreateImage(1600,1200)
x=800
y=600
SetBuffer ImageBuffer(map)
Color 255,255,0
Oval 0,0,1600,1200,1
Color 0,0,0
Oval 500,500,200,200,1
Oval 1100,500,200,200,1
Rect 600,900,400,50,1


Graphics screenx,screeny,16,0
While Not KeyDown(exit_key)
SetBuffer BackBuffer()
Cls
If KeyDown(right_key) x=x-5
If KeyDown(left_key) x=x+5
If KeyDown(up_key) y=y+5
If KeyDown(down_key) y=y-5
DrawBlockRect map,0,0,x,y,800,600
Flip
Wend
')


Mark Tiffany(Posted 2003) [#4]
So the problem is that in Blitz2d, DrawBlockRect allowed negative offsets quite happily, but Blitz+ clips any negative values to 0,0. Yet Blitz+ doesn't clip offsets if they're more than the size of the image! I'd say there's definitely a bug here - either DrawBlockRect should accept negatives like it used to, or it should clip <0 AND >SIZE. I think the former would be better!