I've been playing around with some of the graphics commands, and am running into a snag:
The code listed below works just fine in windowed mode -- but as soon as I switch to full-screen, it starts acting up.
What it is supposed to do:
1) Load a full-color image from disk
2) Change a rectangle to dark black-and-white
3) Load a masked 'frame'-image from disk, which will be used as a border around the B&W area. the screen outside of the border will remail full-color
In windowed mode this works just fine, but in full-screen mode both the B&W area and the full-color edges won't get drawn: just the frame itself, with a black box in the middle and black edges around it.
Note: To pull up or switch away from the frame image in the code below, press 'TAB'. Press ESC to quit.
Any insights would be much appreciated!
The code listed below works just fine in windowed mode -- but as soon as I switch to full-screen, it starts acting up.
What it is supposed to do:
1) Load a full-color image from disk
2) Change a rectangle to dark black-and-white
3) Load a masked 'frame'-image from disk, which will be used as a border around the B&W area. the screen outside of the border will remail full-color
In windowed mode this works just fine, but in full-screen mode both the B&W area and the full-color edges won't get drawn: just the frame itself, with a black box in the middle and black edges around it.
Note: To pull up or switch away from the frame image in the code below, press 'TAB'. Press ESC to quit.
Any insights would be much appreciated!
Global gfx$ Global frame$ Graphics 640,480,16,1 gfx$=LoadImage("background.jpg") ; 640x480 background image frame$=LoadImage("frame.png") ; 640x480 overlay image, color 0,255,0 transparent MaskImage frame$,0,255,0 SetBuffer=BackBuffer() DrawImage gfx$,0,0 Flip While True If KeyDown(1) Then End ; Press Esc If KeyDown(15) Then ; Press TAB overlay(100,100,540,380) ; Changes a rectangle to dark greyscale FlushKeys While Not KeyDown(15) Wend FlushKeys DrawImage gfx$,0,0 Flip End If Wend Function overlay(xstart,ystart,xend,yend) SetBuffer=FrontBuffer() gfxtemp$=CreateImage(640,480) GrabImage gfxtemp$,0,0 SetBuffer BackBuffer() DrawImage gfxtemp$,0,0 LockBuffer For y=ystart To yend For x=xstart To xend temp1=ReadPixel(x,y) orgb=(temp1 And 255) orgg=(temp1 And 65280) Shr 8 orgr=(temp1 And 16711680) Shr 16 temp2=(orgr+orgg+orgb) Shr 3 ; Average red/green/blue, and darken WritePixel x,y,temp2+(temp2 Shl 8)+(temp2 Shl 16) ; write greyscale pixels Next Next UnlockBuffer DrawImage frame$,0,0 Flip gfxtemp$="" End Function