March 08, 2021, 03:37:31 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] skinnable windows by dan_upright [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] skinnable windows by dan_upright [ 1+ years ago ] (Read 548 times)
BlitzBot
Jr. Member
Posts: 1
[bb] skinnable windows by dan_upright [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
skinnable windows
Author :
dan_upright
Posted :
1+ years ago
Description :
setup the two .decls files and then pass the function your window handle, an image (which should be the same size as the window) and a mask colour and it'll make the window shape match the non-masked areas of the image
Code :
Code: BlitzBasic
user32.decls:
----
.lib
"user32.dll"
SetWindowRgn%
(
hWnd%, hRgn%, bRedraw%
)
----
gdi32.decls:
----
.lib
"gdi32.dll"
CreateRectRgn%
(
X1%, Y1%, X2%, Y2%
)
CombineRgn%
(
hDestRgn%, hSrcRgn1%, hSrcRgn2%, nCombineMode%
)
DeleteObject%
(
hObject%
)
----
and
the blitz
function
:
----
Function
skin_window
(
window, img, r, g, b
)
w =
ImageWidth
(
img
)
h =
ImageHeight
(
img
)
LockBuffer
ImageBuffer
(
img
)
mask =
(
255
Shl
24
)
+
(
r
Shl
16
)
+
(
g
Shl
8
)
+ b
hWnd = QueryObject
(
window,
1
)
hRgn = CreateRectRgn
(
0
,
0
, w, h
)
For
y =
0
To
h -
1
For
x =
0
To
w -
1
pixel =
ReadPixelFast
(
x, y,
ImageBuffer
(
img
)
)
If
pixel = mask
hTempRgn = CreateRectRgn
(
x, y, x +
1
, y +
1
)
CombineRgn
(
hRgn, hRgn, hTempRgn,
3
)
DeleteObject
(
hTempRgn
)
EndIf
Next
Next
UnlockBuffer
ImageBuffer
(
img
)
SetWindowRgn
(
hWnd, hRgn,
True
)
DeleteObject
(
hRgn
)
End Function
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] skinnable windows by dan_upright [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal