reprennent le principe du GFA basic et permet la copie de partie d'ecran et meme un stretch
peut etre que cela correspond a ce que tu cherche a faire....
Code : Tout sélectionner
; English forum: http://purebasic.myforums.net/viewtopic.php?t=7731&highlight=
; Author: einander
; Date: 08. October 2003
;Conversion Purebasic 4.10 : Dobro
; My dreams come true: working GFA16 commands in PB!
; CLS,GET,PUT,STRETCH,GRAB ;(grab is a PUT for part of image)
;Binary raster operation - october 7 - 2003 - by Einander
;Combines the bits from the selected pen with the bits in the destination bitmap.
;(Bit-block transfer of color Data from source DC into a destination DC)
; -********Choose your BitMap on line 39*************
;With Debugger option Off, gets your BitMap; else, only part of debug window
; 15 combination modes:
;#BLACKNESS, #DSTINVERT, #MERGECOPY, #MERGEPAINT, #NOTSRCCOPY, #NOTSRCERASE ;#PATCOPY
; #PATINVERT, #PATPAINT, #SRCAND, #SRCCOPY, #SRCERASE, #SRCINVERT, #SRCPAINT, #WHITENESS
Declare Get(n_wind,x,y,Wi,He) ; Get source image - returns image handle
Declare Put(n_wind,x,y,IMG,mode) ; Draws image from IMG TO DEST (DEST = GetDC_(SrcID))
Declare Stretch(n_wind,x,y,Wi,He,IMG,mode) ; draws stretched image
Declare Grab(n_wind,StartX,StartY,Wi,He,IMG,x,y,mode) ; draws part of image
Declare CLS(n_wind,color) ; clear screen
;__________________________
UseJPEGImageDecoder()
IMAGE$="D:\Mes_Photos\Capture_ecran\avatar2.jpg"
#Window=0
LoadImage(1,IMAGE$)
WIMG=100 : HIMG=100
ResizeImage(1,WIMG,HIMG) ; STARTING WITH 100 X 100 PIXS
id=OpenWindow(#Window,0,0,WIMG,HIMG,"",#PB_Window_BorderLess )
StartDrawing(WindowOutput(#Window))
DrawImage(ImageID(1),0,0)
IMG=Get(#Window,0,0,WIMG,HIMG)
StopDrawing()
CloseWindow(0)
_X=GetSystemMetrics_(#SM_CXSCREEN) : _Y=GetSystemMetrics_(#SM_CYSCREEN)
hwnd=OpenWindow(#Window,0,0,_X,_Y,"",#WS_OVERLAPPEDWINDOW | #WS_MAXIMIZE)
CLS(#Window,#Black)
;Testing some modes
Put(#Window,220,100,IMG,#SRCCOPY)
Put(#Window,350,100,IMG,#SRCPAINT)
Stretch(#Window,20,200,200,200,IMG,#NOTSRCCOPY)
x=0 : y=_Y-150
Repeat
Grab(#Window,0,0,50,50,IMG,20+i,y,#SRCPAINT)
i+50
Grab(#Window,50,50,50,50,IMG,20+i,y,#SRCPAINT)
y-50
Until y<50
Repeat
Until WaitWindowEvent()= #PB_Event_CloseWindow
End
Procedure Get(n_wind,x,y,Wi,He) ; Get source image - returns image handle
SRC=GetDC_(WindowID(n_wind))
DEST = CreateCompatibleDC_(SRC)
SelectObject_(DEST,CreateImage(0,Wi,He))
BitBlt_(DEST,0,0,Wi,He,SRC,x,y,#SRCCOPY)
ProcedureReturn DEST
EndProcedure
Procedure Put(n_wind,x,y,IMG,mode) ; Draws image from IMG TO DEST (DEST = GetDC_(SrcID))
BitBlt_(GetDC_(WindowID(n_wind)),x,y,ImageWidth(n_wind),ImageHeight(n_wind),IMG,0,0,mode)
EndProcedure
Procedure Stretch(n_wind,x,y,Wi,He,IMG,mode) ; draws stretched image
StretchBlt_(GetDC_(WindowID(n_wind)),x,y,Wi,He,IMG,0,0,ImageWidth(n_wind),ImageHeight(n_wind),mode)
EndProcedure
Procedure Grab(n_wind,StartX,StartY,Wi,He,IMG,x,y,mode) ; draws part of image
BitBlt_(GetDC_(WindowID(n_wind)),x,y,Wi,He,IMG,StartX,StartY,mode)
EndProcedure
Procedure CLS(n_wind,color) ; clear screen
StartDrawing(WindowOutput(n_wind))
Box(0,0,WindowWidth(n_wind),WindowHeight(n_wind),color)
StopDrawing()
EndProcedure
; ExecutableFormat=Windows
; EnableXP
; DisableDebugger
; EOF