Code: Select all
;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 48*************
;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
Procedure Get(X,Y,Wi,He) ; Get source image - returns image handle
SRC=GETDC_(WindowID())
DEST = CreateCompatibleDC_(SRC)
SelectObject_(DEST,CreateImage(0,Wi,He))
BitBlt_(DEST,0,0,Wi,He,SRC,X,Y,#SRCCOPY)
ReleaseDC_(WindowID(),Src)
ProcedureReturn DEST
EndProcedure
Procedure Put(X,Y,IMG,MODE) ; Draws image from IMG TO DEST (DEST = GetDC_(SrcID))
hDC=GETDC_(WindowID())
BitBlt_(hDC,X,Y,ImageWidth(),ImageHeight(),IMG,0,0,MODE)
ReleaseDC_(WindowID(),hDC)
EndProcedure
Procedure Stretch(X,Y,Wi,He,IMG,MODE) ; draws stretched image
hDC=GETDC_(WindowID())
StretchBlt_(hDC,X,Y,Wi,He,IMG,0,0,ImageWidth(),ImageHeight(),MODE)
ReleaseDC_(WindowID(),hDC)
EndProcedure
Procedure Grab(StartX,StartY,Wi,He,IMG,X,Y,MODE) ; draws part of image
hDC=GETDC_(WindowID())
BitBlt_(hDC,X,Y,Wi,He,IMG,StartX,StartY,MODE)
ReleaseDC_(WindowID(),hDC)
EndProcedure
Procedure CLS(COLOR) ; clear screen
StartDrawing(WindowOutput())
Box(0,0,WindowWidth(),WindowHeight(),COLOR)
StopDrawing()
EndProcedure
;__________________________
IMAGE$="**************CHOOSE HERE YOUR BMP******************************"
LoadImage(1,Image$)
WIMG=100 : HIMG=100
ResizeImage(1,WIMG,HIMG) ; STARTING WITH 100 X 100 PIXS
id=OpenWindow(0,0,0,WIMG,HIMG,#PB_Window_BorderLess ,"")
StartDrawing(WindowOutput())
DrawImage(UseImage(1),0,0)
IMG=Get(0,0,WIMG,HIMG)
StopDrawing()
CloseWindow(0)
_X=GetSystemMetrics_(#SM_CXSCREEN) : _Y=GetSystemMetrics_(#SM_CYSCREEN)
hWnd=OpenWindow(0,0,0,_X,_Y,#WS_OVERLAPPEDWINDOW | #WS_MAXIMIZE,"")
CLS(#blue)
;Testing some modes
PUT(220,100,IMG,#SRCCOPY)
PUT(350,100,IMG,#SRCPAINT)
STRETCH(20,200,200,200,IMG,#NOTSRCERASE)
x=0 : y=_Y-150
Repeat
GRAB(0,0,50,50,IMG,20+i,y,#SRCINVERT)
i+50
GRAB(50,50,50,50,IMG,20+i,y,#SRCINVERT)
y-50
Until y<50
Repeat
Until WaitWindowEvent()= #PB_Event_CloseWindow
End