This is supposed to be a tutorial or at least a help to show you how to make your window whatever shape you like.
This is my first tutorial so please ask if i miss something or if something isn't clear.
It's pretty simple really you just need the these dll's and decls
User32
http://www.blitzbasic.com/codearcs/codearcs.php?code=1179GDI32
http://www.blitzbasic.com/codearcs/codearcs.php?code=1181The SystemProperty("apphwnd") command might need to be replaced with
api_FindWindow("Blitz Runtime Class", title$)
;CODE:_________________________________________________________________
SetBuffer BackBuffer()
Const SM_CXBORDER= 5
Const SM_CYCAPTION= 4
Const GWL_STYLE= -16
Const SWP_NOMOVE= $2
Const SWP_NOZORDER= $4
Const RGN_OR = 2
Const RGN_XOR = 3
hwnd=SystemProperty("apphwnd"); Get the handle to our indow
Gosub createregion
While Not KeyHit(1)
Rect MouseX(),MouseY(),15,15
Rect 50,50,10,10; to show that normal drawing commands work
;line does NOT work
;writepixel(fast) doesn't always work, but sometimes does
Flip
Cls
Wend
End
.createregion
;get rid of the app bar or whatever its called
api_SetWindowLong(hwnd, -16 ,$10000000)
api_MoveWindow(hwnd,400,300,GraphicsWidth(),GraphicsHeight(),1)
; create a round region.
hRegion1 = api_CreateEllipticRgn(20,-20,190,150);
; create a rectangle region.
hRegion2 = api_CreateRectRgn(140,100,300,240);
;add an offset to it
api_OffsetRgn(hRegion2, api_GetSystemMetrics(SM_CXBORDER)*4, api_GetSystemMetrics(SM_CYCAPTION));
; combine the two regions To build a New region
; you will undersand when you see it
api_CombineRgn(hRegion1, hRegion1, hRegion2, RGN_OR)
; use our newly created region
api_SetWindowRgn(hWnd, hRegion1, True);
; Clean up
api_DeleteObject(hRegion1);
api_DeleteObject(hRegion2);
Return
;END CODE:_________________________________________________________________
I think the example should be clear enough but with that teknike its very hard work to do shapes so here is an other one
;CODE:_________________________________________________________________
Graphics 800,600,16,2
SetBuffer BackBuffer()
im=LoadImage("skin.png")
Global w=SystemProperty("apphwnd")
lpPoint=CreateBank(8)
hRegion=ScanRegion(im,ReadPixel(0,0,FrontBuffer()))
api_SetWindowRgn(w, hRegion, True)
oim=LoadImage("image.png")
im=LoadImage("skin.png")
While Not KeyHit(1)
DrawImage(im,0,0);-3,-22)
Flip
Cls
Wend
Function ScanRegion(image,col)
hwnd=w
api_SetWindowLong(hwnd, -16 ,$10000000)
api_MoveWindow(hwnd,20,20,GraphicsWidth(),GraphicsHeight(),1)
hRgn = api_CreateRectRgn(0,0,ImageWidth(image),ImageHeight(image))
If hRgn=0 Then End
DebugLog "hRgn="+hRgn
LockBuffer ImageBuffer(image)
col=ReadPixelFast(0,0,ImageBuffer(image))
For x=0 To ImageWidth(image)-1
For y=0 To ImageHeight(image)-1
If ReadPixelFast(x,y,ImageBuffer(image))=col
hTmpRgn = api_CreateRectRgn(x,y,x+1,y+1)
api_CombineRgn(hRgn, hRgn, hTmpRgn, 3)
api_DeleteObject(hTmpRgn)
EndIf
Next
Next
UnlockBuffer BackBuffer()
Return hRgn
End Function
;END CODE:_________________________________________________________________
There is only one problem that i cant get over and thats the speed

here is an axample that runns a little faster because it uses a preloaded image but still slow.
;CODE:_________________________________________________________________
Graphics 800,600,16,2
SetBuffer BackBuffer()
im=LoadImage("skin.png")
Global w=SystemProperty("apphwnd")
lpPoint=CreateBank(8)
;hRegion=ScanRegion(im,ReadPixel(0,0,FrontBuffer()))
hRegion=Loadregion()
api_SetWindowRgn(w, hRegion, True)
im=LoadImage("skin.png")
While Not KeyHit(1)
DrawImage(im,0,0);-3,-22)
Flip
Cls
Wend
Function Loadregion()
hwnd=w
api_SetWindowLong(hwnd, -16 ,$10000000)
api_MoveWindow(hwnd,20,20,GraphicsWidth(),GraphicsHeight(),1)
file=OpenFile("data.txt")
iw=ReadInt(file)
ih=ReadInt(file)
DebugLog iw+","+ih
hRgn = api_CreateRectRgn(0,0,iw,ih)
For x=0 To iw-1
For y=0 To ih-1
;DebugLog tmp%
If ReadByte(file)=0
hTmpRgn = api_CreateRectRgn(x,y,x+1,y+1)
api_CombineRgn(hRgn, hRgn, hTmpRgn, 3)
api_DeleteObject(hTmpRgn)
EndIf
Next
Next
CloseFile(file)
Return hRgn
End Function
Function ScanRegion(image,col)
hwnd=w
api_SetWindowLong(hwnd, -16 ,$10000000)
api_MoveWindow(hwnd,20,20,GraphicsWidth(),GraphicsHeight(),1)
hRgn = api_CreateRectRgn(0,0,ImageWidth(image),ImageHeight(image))
If hRgn=0 Then End
DebugLog "hRgn="+hRgn
file=WriteFile("data.txt")
WriteInt(file,ImageWidth(image))
WriteInt(file,ImageHeight(image))
LockBuffer ImageBuffer(image)
col=ReadPixelFast(0,0,ImageBuffer(image))
For x=0 To ImageWidth(image)-1
For y=0 To ImageHeight(image)-1
If ReadPixelFast(x,y,ImageBuffer(image))=col
hTmpRgn = api_CreateRectRgn(x,y,x+1,y+1)
api_CombineRgn(hRgn, hRgn, hTmpRgn, 3)
api_DeleteObject(hTmpRgn)
WriteByte(file,0)
Else
WriteByte(file,1)
EndIf
Next
Next
UnlockBuffer BackBuffer()
CloseFile(file)
Return hRgn
End Function
;END CODE:_________________________________________________________________
I just want to say that API-guide is a very god program:)
I'ts not complete but almost. download it at:
http://www.allapi.net/And
I think dbfinteractive is missing a userlib section for blitz:)