|
Post by floyesoft on Sept 26, 2010 16:57:25 GMT 1
hi
i want a put function with extended option now we are with gfa :
local hs as handle get 0,0,400,400, hd put 0,0,hd
it's work
but i want only put a specified rectangle like :
put 0,0,hd,0,0,100,200 but not exist
i find some example with bitblt but i dont understand how does it work
somebody can make me a function like get() ... put() function with extend option like bitblt
thanks a lot
|
|
lab
New Member
Posts: 3
|
Post by lab on Sept 27, 2010 11:10:29 GMT 1
hi floyesoft! heres a Quick and dirty:
Circle 50, 50, 35 Circle 50, 50, 25 Circle 50, 50, 45
Local a$ Get 0, 0, 100, 100, a$ Cls Put 10, 10, cut(10, 10, 50, 50, a$)
Function cut(x1, y1, x2, y2, p$) As String Local cut$ OpenW 2, 0, 0 Put 0, 0, p$ Get x1, y1, x2, y2, cut$ CloseW 2 Return cut$ EndFunction
regards, labman
|
|
|
Post by floyesoft on Sept 27, 2010 19:08:34 GMT 1
In fact i search a join between bitblt and get function
|
|
|
Post by drdave on Sept 29, 2010 22:11:43 GMT 1
I think that BitBlt indeed does what you want. See attached file. Here is a part of the example code OpenW 5, 300, 300, 600, 600 Win_5.Caption = "WINDOW-5" OpenW 4, 0, 300, 300, 300 Win_4.Caption = "WINDOW-4" OpenW 3, 600, 0, 300, 300 Win_3.Caption = "WINDOW-3" OpenW 2, 300, 0, 300, 300 Win_2.Caption = "WINDOW-2" OpenW 1, 0, 0, 300, 300 Win_1.Caption = "WINDOW-1" AutoRedraw = True
Local x%, i%, b% = 300 For x% = 0 To 500 Color Rand(_C) Line Rand(b%), Rand(b%), Rand(b%), Rand(b%) Next
//Copy a square out of the center of Win1 and draw it in Win4 starting at 10,10 BitBlt Win_1.hDC, 100, 100, 100, 100, Win_4.hDC , 10, 10
//Add the code for the function definition given below. //Then you can uncomment the next line and see the effect. 'PutBitBlt(Win_5.hDC, 120, 120, Win_1.hDC, 0, 0, 200, 200)
Local z% KeyGet z% For i% = 1 To 5 CloseW i% Next Do : Sleep : Until Me Is Nothing
And here is a function in the format that you requested Function PutBitBlt(dstObjecthDC, dstX%, dstY%, srcObjecthDC, srcX%, srcY%, srcW%, srcH%) BitBlt srcObjecthDC, srcX%, srcY%, srcW%, srcH%, dstObjecthDC, dstX%, dstY% End Function
DrDave Attachments:
|
|
|
Post by floyesoft on Oct 1, 2010 21:00:17 GMT 1
Yes wonderful but CAN i make the same thing without open the others Windows ?
|
|
|
Post by drdave on Oct 2, 2010 12:45:24 GMT 1
Yes wonderful but CAN i make the same thing without open the others Windows ? Hmmmm. Is your computer with GFA Basic broken? I am guessing it must be, because why else would you ask such a question when it is a SIMPLE matter of making a minor code change and you can see if it works in a single window! DrDave
|
|
|
Post by floyesoft on Oct 2, 2010 21:25:02 GMT 1
No of course no
In fact i search to make a redraw of moving objet with mouse but when i use put/get function i must to use thé entire screen of copy...
Get 0,0,_x,_y,redraw Do X=mousex Y=mousey If ancx!=x and ancy!=y Put 0,0,redraw Circle x,y,6 Endif Ancx=x Ancy=y Loop
As you see the entire screen is copied and i Want only put the area under the mouse
|
|
|
Post by drdave on Oct 3, 2010 17:16:27 GMT 1
No of course no In fact i search to make a redraw of moving objet with mouse but when i use put/get function i must to use thé entire screen of copy... Get 0,0,_x,_y,redraw Do X=mousex Y=mousey If ancx!=x and ancy!=y Put 0,0,redraw Circle x,y,6 Endif Ancx=x Ancy=y Loop As you see the entire screen is copied and i Want only put the area under the mouse C'mon floyesoft! Why do you think you must copy the ENTIRE screen with Get() ? Didn't you read the Help entry for GET So, open a window. Make it at least 300 by 300, or even make it full screen. Draw something on it. After that, add this code. Local Region$, dstX% = 0, dstY% = 0 Do Get MouseX - 50, MouseY - 50, MouseX + 50, MouseY + 50, Region$ Put dstX%, dstY%, Region$ Loop
The Get() copies a square that is 100 by 100 pixels with the cursor in the center. The Put() paints this square starting in the upper left corner of your window. If for some reason you want to paint the square to another location just change values of dstX% and dstY%. If you want this all wrapped up in a function, you should be able to look at the previous function that I gave you and write this one. DrDave
|
|