4202
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1757
|
3 |
"
|
|
4 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
5 |
All Rights Reserved
|
|
6 |
|
|
7 |
This software is furnished under a license and may be used
|
|
8 |
only in accordance with the terms of that license and with the
|
|
9 |
inclusion of the above copyright notice. This software may not
|
|
10 |
be provided or otherwise made available to, or used by, any
|
|
11 |
other person. No title to or ownership of the software is
|
|
12 |
hereby transferred.
|
|
13 |
"
|
1626
|
14 |
"{ Package: 'stx:libview2' }"
|
1607
|
15 |
|
3454
|
16 |
"{ NameSpace: Smalltalk }"
|
|
17 |
|
1607
|
18 |
Object subclass:#MultiImage
|
|
19 |
instanceVariableNames:'images'
|
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
|
22 |
category:'Graphics-Images'
|
|
23 |
!
|
|
24 |
|
1757
|
25 |
!MultiImage class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
30 |
All Rights Reserved
|
|
31 |
|
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
!
|
|
40 |
|
|
41 |
documentation
|
|
42 |
"
|
|
43 |
A multiImage is an image which is drawn by drawing multiple images on top of each other.
|
4052
|
44 |
Typically, they are used to overlay additional information,
|
|
45 |
for example a stop-icon or a link-arrow over a fileType icon.
|
|
46 |
|
|
47 |
try:
|
|
48 |
MIMETypeIconLibrary iconForFile:'/foo/bar/baz.c' asFilename
|
1757
|
49 |
|
4053
|
50 |
caveat:
|
|
51 |
instances provide enough protocol to be shown as icon, label, etc.
|
|
52 |
(i.e. provide a replacement for images and forms).
|
|
53 |
However, not all tools are prepared for them not having mask, bits etc.
|
|
54 |
Especially, the ImageEditor gets a bit confused and may fall into a debugger,
|
|
55 |
if trying to edit one of my instances.
|
|
56 |
|
1757
|
57 |
[author:]
|
|
58 |
Claus Gittinger
|
|
59 |
"
|
|
60 |
! !
|
1607
|
61 |
|
|
62 |
!MultiImage class methodsFor:'instance creation'!
|
|
63 |
|
|
64 |
images:imageCollection
|
|
65 |
^ self new images:imageCollection
|
|
66 |
! !
|
|
67 |
|
|
68 |
!MultiImage methodsFor:'accessing'!
|
|
69 |
|
1614
|
70 |
device
|
2064
|
71 |
images isNil ifTrue:[^ nil].
|
1614
|
72 |
^ images first device
|
|
73 |
!
|
|
74 |
|
4202
|
75 |
graphicsDevice
|
|
76 |
images isNil ifTrue:[^ nil].
|
|
77 |
^ images first graphicsDevice
|
|
78 |
|
|
79 |
"Created: / 25-10-2018 / 12:40:16 / Claus Gittinger"
|
|
80 |
!
|
|
81 |
|
1614
|
82 |
images
|
|
83 |
"return the value of the instance variable 'images' (automatically generated)"
|
|
84 |
|
|
85 |
^ images
|
|
86 |
!
|
|
87 |
|
1607
|
88 |
images:something
|
|
89 |
"set the value of the instance variable 'images' (automatically generated)"
|
|
90 |
|
|
91 |
images := something.
|
4202
|
92 |
!
|
|
93 |
|
|
94 |
mask
|
|
95 |
^ nil
|
|
96 |
|
|
97 |
"Created: / 25-10-2018 / 12:35:09 / Claus Gittinger"
|
1607
|
98 |
! !
|
|
99 |
|
|
100 |
!MultiImage methodsFor:'displaying'!
|
|
101 |
|
|
102 |
displayOn:aGC x:x y:y opaque:opaque
|
|
103 |
|doOpaque|
|
|
104 |
|
|
105 |
doOpaque := opaque.
|
|
106 |
images do:[:eachImage |
|
|
107 |
eachImage displayOn:aGC x:x y:y opaque:doOpaque.
|
|
108 |
doOpaque := false.
|
|
109 |
].
|
|
110 |
! !
|
|
111 |
|
1614
|
112 |
!MultiImage methodsFor:'misc'!
|
|
113 |
|
4202
|
114 |
asFormOn:aDevice
|
|
115 |
|form|
|
|
116 |
|
|
117 |
form := Form extent:(images first extent) depth:aDevice depth onDevice:aDevice.
|
|
118 |
images do:[:eachImage |
|
|
119 |
eachImage displayOn:form x:0 y:0 opaque:false.
|
|
120 |
].
|
|
121 |
^ form
|
|
122 |
|
|
123 |
"Created: / 25-10-2018 / 12:38:18 / Claus Gittinger"
|
|
124 |
!
|
|
125 |
|
1614
|
126 |
clearMaskedPixels
|
|
127 |
images := images do:[:eachImage | eachImage clearMaskedPixels].
|
|
128 |
^ self
|
|
129 |
!
|
|
130 |
|
|
131 |
onDevice:device
|
1654
|
132 |
images := images collect:[:eachImage | (eachImage onDevice:device) ? eachImage].
|
1614
|
133 |
^ self
|
|
134 |
! !
|
|
135 |
|
3454
|
136 |
|
1614
|
137 |
!MultiImage methodsFor:'queries'!
|
|
138 |
|
1708
|
139 |
ascentOn:aGC
|
|
140 |
"I will not draw myself above the baseline"
|
|
141 |
|
|
142 |
^ 0
|
|
143 |
!
|
|
144 |
|
3324
|
145 |
depth
|
|
146 |
^ images inject:0 into:[:maxSoFar :eachImage | maxSoFar max:eachImage depth].
|
|
147 |
!
|
|
148 |
|
|
149 |
extent
|
|
150 |
^ self width @ self height
|
|
151 |
!
|
|
152 |
|
1614
|
153 |
height
|
|
154 |
^ images inject:0 into:[:maxSoFar :eachImage | maxSoFar max:eachImage height].
|
|
155 |
!
|
|
156 |
|
|
157 |
isImageOrForm
|
|
158 |
^ true
|
|
159 |
!
|
|
160 |
|
|
161 |
width
|
|
162 |
^ images inject:0 into:[:maxSoFar :eachImage | maxSoFar max:eachImage width].
|
|
163 |
! !
|
|
164 |
|
1607
|
165 |
!MultiImage class methodsFor:'documentation'!
|
|
166 |
|
|
167 |
version
|
4052
|
168 |
^ '$Header$'
|
4053
|
169 |
!
|
|
170 |
|
|
171 |
version_CVS
|
|
172 |
^ '$Header$'
|
1607
|
173 |
! !
|
3324
|
174 |
|