Skip to content

Instantly share code, notes, and snippets.

@iArnold
Created October 30, 2015 13:29
Show Gist options
  • Save iArnold/979411a137248580bb62 to your computer and use it in GitHub Desktop.
Save iArnold/979411a137248580bb62 to your computer and use it in GitHub Desktop.
transparency test
Red [
Needs: 'View
]
system/view/debug?: yes
live?: system/view/auto-sync?: no
workstation?: system/view/platform/product = 1
print [
"Windows" switch system/view/platform/version [
10.0.0 [pick ["10" "10 Server" ] workstation?]
6.3.0 [pick ["8.1" "Server 2012 R2"] workstation?]
6.2.0 [pick ["8" "Server 2012" ] workstation?]
6.1.0 [pick ["7" "Server 2008 R1"] workstation?]
6.0.0 [pick ["Vista" "Server 2008" ] workstation?]
5.2.0 [pick ["Server 2003" "Server 2003 R2"] workstation?]
5.1.0 ["XP"]
5.0.0 ["2000"]
]
"build" system/view/platform/build
]
win: make face! [
type: 'window text: "Transparency Test" offset: 500x500 size: 800x800
]
win/pane: reduce [
canvas: make face! [
type: 'base text: "canvas" offset: 100x100 size: 400x400 color: silver
draw: [
dummy draw contents
]
]
canvas2: make face! [
type: 'base text: "canvas2" offset: 200x200 size: 400x400 color: blue
draw: []
]
make face! [
type: 'image offset: 280x180 size: 78x78
data: [%../project/gui/Xiangqi_General_TR.png]
options: [drag-on: 'down]
actors: object [
on-drag-start: func [face [object!] event [event!]][
print "drag starts"
;face/state/4: face/state/4 + 4x4
;face/offset: face/offset - 4x4
;unless live? [show face]
]
on-drag: func [face [object!] event [event!]][
prin dot
]
on-drop: func [face [object!] event [event!]][
print "dropping"
;face/offset: face/offset + 4x4
;unless live? [show face]
]
]
]
make face! [ ; Quit button
type: 'button text: "Quit" offset: 600x440 size: 60x24
actors: object [
on-click: func [face [object!] event [event!]][
print "calling unview"
unview/all
]
]
]
]
canvas/draw: [
line-cap round
pen black
line 20x20 340x20 340x380 20x380 20x20
]
canvas2/draw: [
line-cap round
pen red
line 20x20 340x20 340x380 20x380 20x20
]
show win
do-events
<html>
<head>
<title>Red transparency</title>
</head>
<body style="background-color:#efafbf">
<img src="Xiangqi_Advisor_TR.png" alt="advisor" style="width:80px;height:80px;">
</br>
This should prove that the used png image is indeed transparent.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment