equal
deleted
inserted
replaced
494 mask := aForm. |
494 mask := aForm. |
495 gcId notNil ifTrue:[ |
495 gcId notNil ifTrue:[ |
496 (mask == nil) ifTrue:[ |
496 (mask == nil) ifTrue:[ |
497 device setBitmapMask:nil in:gcId |
497 device setBitmapMask:nil in:gcId |
498 ] ifFalse:[ |
498 ] ifFalse:[ |
499 mask := mask on:device. |
499 mask := mask asFormOn:device. |
500 id := mask id. |
500 id := mask id. |
501 (mask depth == 1) ifTrue:[ |
501 (mask depth == 1) ifTrue:[ |
502 device setBitmapMask:id in:gcId |
502 device setBitmapMask:id in:gcId |
503 ] ifFalse:[ |
503 ] ifFalse:[ |
504 device setPixmapMask:id in:gcId |
504 device setPixmapMask:id in:gcId |
850 All coordinates are in device coordinates." |
850 All coordinates are in device coordinates." |
851 |
851 |
852 |deviceDrawable id srcGCId| |
852 |deviceDrawable id srcGCId| |
853 |
853 |
854 aDrawable graphicsDevice ~~ device ifTrue:[ |
854 aDrawable graphicsDevice ~~ device ifTrue:[ |
855 deviceDrawable := aDrawable on:device. |
855 deviceDrawable := aDrawable asFormOn:device. |
856 ] ifFalse:[ |
856 ] ifFalse:[ |
857 deviceDrawable := aDrawable |
857 deviceDrawable := aDrawable |
858 ]. |
858 ]. |
859 |
859 |
860 id := deviceDrawable id. |
860 id := deviceDrawable id. |
877 srcGCId := deviceDrawable gcId. |
877 srcGCId := deviceDrawable gcId. |
878 |
878 |
879 ((deviceDrawable depth == 1) and:[device depth ~~ 1]) ifTrue:[ |
879 ((deviceDrawable depth == 1) and:[device depth ~~ 1]) ifTrue:[ |
880 device |
880 device |
881 copyPlaneFromId:id |
881 copyPlaneFromId:id |
882 x:srcX y:srcY |
882 x:srcX y:srcY gc:srcGCId |
883 to:drawableId |
883 to:drawableId |
884 x:dstX y:dstY |
884 x:dstX y:dstY gc:gcId |
885 width:w height:h |
885 width:w height:h |
886 gc:gcId |
|
887 ] ifFalse:[ |
886 ] ifFalse:[ |
888 device |
887 device |
889 copyFromId:id |
888 copyFromId:id |
890 x:srcX y:srcY gc:srcGCId |
889 x:srcX y:srcY gc:srcGCId |
891 to:drawableId |
890 to:drawableId |
904 All coordinates are in device coordinates." |
903 All coordinates are in device coordinates." |
905 |
904 |
906 |deviceDrawable id srcGCId| |
905 |deviceDrawable id srcGCId| |
907 |
906 |
908 aDrawable graphicsDevice ~~ device ifTrue:[ |
907 aDrawable graphicsDevice ~~ device ifTrue:[ |
909 deviceDrawable := aDrawable on:device. |
908 deviceDrawable := aDrawable asFormOn:device. |
910 ] ifFalse:[ |
909 ] ifFalse:[ |
911 deviceDrawable := aDrawable |
910 deviceDrawable := aDrawable |
912 ]. |
911 ]. |
913 |
912 |
914 id := deviceDrawable id. |
913 id := deviceDrawable id. |
928 self initGC |
927 self initGC |
929 ]. |
928 ]. |
930 |
929 |
931 device |
930 device |
932 copyPlaneFromId:id |
931 copyPlaneFromId:id |
933 x:srcX y:srcY |
932 x:srcX y:srcY gc:(deviceDrawable gcId) |
934 to:drawableId |
933 to:drawableId |
935 x:dstX y:dstY |
934 x:dstX y:dstY gc:gcId |
936 width:w height:h |
935 width:w height:h |
937 gc:gcId |
|
938 |
936 |
939 "Modified: 15.6.1996 / 15:36:42 / cg" |
937 "Modified: 15.6.1996 / 15:36:42 / cg" |
940 ! ! |
938 ! ! |
941 |
939 |
942 !DeviceGraphicsContext methodsFor:'copying'! |
940 !DeviceGraphicsContext methodsFor:'copying'! |
1864 certain, that the colors are real colors (actually, only for |
1862 certain, that the colors are real colors (actually, only for |
1865 noColor or allColor)." |
1863 noColor or allColor)." |
1866 |
1864 |
1867 |id w h easy paintDither tmpForm |
1865 |id w h easy paintDither tmpForm |
1868 fgId noColor allColor allBits pX pY |
1866 fgId noColor allColor allBits pX pY |
1869 mask maskId deviceForm| |
1867 mask maskId deviceForm deviceMask| |
1870 |
1868 |
1871 w := aForm width. |
1869 w := aForm width. |
1872 h := aForm height. |
1870 h := aForm height. |
1873 |
1871 |
1874 pX := x rounded. |
1872 pX := x rounded. |
1875 pY := y rounded. |
1873 pY := y rounded. |
1876 |
1874 |
1877 aForm graphicsDevice ~~ device ifTrue:[ |
1875 aForm graphicsDevice ~~ device ifTrue:[ |
1878 deviceForm := aForm on:device |
1876 deviceForm := aForm asFormOn:device |
1879 ] ifFalse:[ |
1877 ] ifFalse:[ |
1880 deviceForm := aForm |
1878 deviceForm := aForm |
1881 ]. |
1879 ]. |
1882 |
1880 |
1883 id := deviceForm id. |
1881 id := deviceForm id. |
1884 |
1882 |
1885 id isNil ifTrue:[ |
1883 id isNil ifTrue:[ |
1886 deviceForm := aForm on:device. |
1884 deviceForm := aForm asFormOn:device. |
1887 id := deviceForm id. |
1885 id := deviceForm id. |
1888 id isNil ifTrue:[ |
1886 id isNil ifTrue:[ |
1889 'DEVGC: invalid form draw - ignored' errorPrintNL. |
1887 'DEVGC: invalid form draw - ignored' errorPrintNL. |
1890 ^ self |
1888 ^ self |
1891 ]. |
1889 ]. |
1900 (aForm depth ~~ 1) ifTrue:[ |
1898 (aForm depth ~~ 1) ifTrue:[ |
1901 (mask := aForm mask) notNil ifTrue:[ |
1899 (mask := aForm mask) notNil ifTrue:[ |
1902 mask depth == 1 ifFalse:[ |
1900 mask depth == 1 ifFalse:[ |
1903 'DEVGC: alpha channel not yet supported' errorPrintCR. |
1901 'DEVGC: alpha channel not yet supported' errorPrintCR. |
1904 ] ifTrue:[ |
1902 ] ifTrue:[ |
1905 maskId := (mask on:device) id. |
1903 deviceMask := mask asFormOn:device. |
|
1904 maskId := deviceMask id. |
1906 maskId notNil ifTrue:[ |
1905 maskId notNil ifTrue:[ |
1907 " |
1906 " |
1908 create temp-form; |
1907 create temp-form; |
1909 " |
1908 " |
1910 tmpForm := Form width:w height:h depth:device depth on:device. |
1909 tmpForm := Form width:w height:h depth:device depth on:device. |
1928 " |
1927 " |
1929 device setForeground:allBits background:0 in:tmpForm gcId. |
1928 device setForeground:allBits background:0 in:tmpForm gcId. |
1930 device setFunction:#and in:tmpForm gcId. |
1929 device setFunction:#and in:tmpForm gcId. |
1931 device |
1930 device |
1932 copyPlaneFromId:maskId |
1931 copyPlaneFromId:maskId |
1933 x:0 y:0 |
1932 x:0 y:0 gc:(deviceMask gcId) |
1934 to:tmpForm id |
1933 to:tmpForm id |
1935 x:0 y:0 |
1934 x:0 y:0 gc:tmpForm gcId |
1936 width:w height:h |
1935 width:w height:h. |
1937 gc:tmpForm gcId. |
|
1938 |
1936 |
1939 |
1937 |
1940 " |
1938 " |
1941 stamp out mask in destination |
1939 stamp out mask in destination |
1942 " |
1940 " |
1943 device setForeground:0 background:allBits in:gcId. |
1941 device setForeground:0 background:allBits in:gcId. |
1944 device setFunction:#and in:gcId. |
1942 device setFunction:#and in:gcId. |
1945 device |
1943 device |
1946 copyPlaneFromId:maskId |
1944 copyPlaneFromId:maskId |
1947 x:0 y:0 |
1945 x:0 y:0 gc:(deviceMask gcId) |
1948 to:drawableId |
1946 to:drawableId |
1949 x:pX y:pY |
1947 x:pX y:pY gc:gcId |
1950 width:w height:h |
1948 width:w height:h. |
1951 gc:gcId. |
|
1952 "/ Delay waitForSeconds:3. |
1949 "/ Delay waitForSeconds:3. |
1953 " |
1950 " |
1954 or-in tempform-bits ... |
1951 or-in tempform-bits ... |
1955 " |
1952 " |
1956 device setFunction:#or in:gcId. |
1953 device setFunction:#or in:gcId. |
2026 " |
2023 " |
2027 device setForeground:0 background:allBits in:gcId. |
2024 device setForeground:0 background:allBits in:gcId. |
2028 device setFunction:#and in:gcId. |
2025 device setFunction:#and in:gcId. |
2029 device |
2026 device |
2030 copyPlaneFromId:id |
2027 copyPlaneFromId:id |
2031 x:0 y:0 |
2028 x:0 y:0 gc:(deviceForm gcId) |
2032 to:drawableId |
2029 to:drawableId |
2033 x:pX y:pY |
2030 x:pX y:pY gc:gcId |
2034 width:w height:h |
2031 width:w height:h. |
2035 gc:gcId. |
|
2036 ]. |
2032 ]. |
2037 |
2033 |
2038 fgId ~~ 0 ifTrue:[ |
2034 fgId ~~ 0 ifTrue:[ |
2039 " |
2035 " |
2040 or-in fg-bits ... |
2036 or-in fg-bits ... |
2041 " |
2037 " |
2042 device setForeground:fgId background:0 in:gcId. |
2038 device setForeground:fgId background:0 in:gcId. |
2043 device setFunction:#or in:gcId. |
2039 device setFunction:#or in:gcId. |
2044 device |
2040 device |
2045 copyPlaneFromId:id |
2041 copyPlaneFromId:id |
2046 x:0 y:0 |
2042 x:0 y:0 gc:(deviceForm gcId) |
2047 to:drawableId |
2043 to:drawableId |
2048 x:pX y:pY |
2044 x:pX y:pY gc:gcId |
2049 width:w height:h |
2045 width:w height:h |
2050 gc:gcId. |
|
2051 ]. |
2046 ]. |
2052 " |
2047 " |
2053 flush foreground/background cache |
2048 flush foreground/background cache |
2054 " |
2049 " |
2055 foreground := nil. |
2050 foreground := nil. |
2085 " |
2080 " |
2086 device setForeground:0 background:allBits in:gcId. |
2081 device setForeground:0 background:allBits in:gcId. |
2087 device setFunction:#and in:gcId. |
2082 device setFunction:#and in:gcId. |
2088 device |
2083 device |
2089 copyPlaneFromId:id |
2084 copyPlaneFromId:id |
2090 x:0 y:0 |
2085 x:0 y:0 gc:(deviceForm gcId) |
2091 to:drawableId |
2086 to:drawableId |
2092 x:pX y:pY |
2087 x:pX y:pY gc:gcId |
2093 width:w height:h |
2088 width:w height:h. |
2094 gc:gcId. |
|
2095 " |
2089 " |
2096 or-in temp into destination |
2090 or-in temp into destination |
2097 " |
2091 " |
2098 device setForeground:allBits background:0 in:gcId. |
2092 device setForeground:allBits background:0 in:gcId. |
2099 device setFunction:#or in:gcId. |
2093 device setFunction:#or in:gcId. |
2143 h := aForm height. |
2137 h := aForm height. |
2144 |
2138 |
2145 pX := x rounded. |
2139 pX := x rounded. |
2146 pY := y rounded. |
2140 pY := y rounded. |
2147 |
2141 |
2148 aForm graphicsDevice ~~ device ifTrue:[ |
2142 deviceForm := aForm asFormOn:device. |
2149 deviceForm := aForm on:device |
|
2150 ] ifFalse:[ |
|
2151 deviceForm := aForm |
|
2152 ]. |
|
2153 |
|
2154 id := deviceForm id. |
2143 id := deviceForm id. |
2155 |
2144 |
2156 "temporary ..." |
2145 "temporary ..." |
2157 (id isNil |
2146 (id isNil |
2158 or:[aForm graphicsDevice ~~ device]) ifTrue:[ |
2147 or:[aForm graphicsDevice ~~ device]) ifTrue:[ |
2159 deviceForm := deviceForm on:device. |
2148 deviceForm := deviceForm asFormOn:device. |
2160 id := deviceForm id. |
2149 id := deviceForm id. |
2161 id isNil ifTrue:[ |
2150 id isNil ifTrue:[ |
2162 'DEVGC: invalid form draw - ignored' errorPrintNL. |
2151 'DEVGC: invalid form draw - ignored' errorPrintNL. |
2163 ^ self |
2152 ^ self |
2164 ]. |
2153 ]. |
2225 foreground := paint. |
2214 foreground := paint. |
2226 background := bgPaint. |
2215 background := bgPaint. |
2227 ]. |
2216 ]. |
2228 device |
2217 device |
2229 copyPlaneFromId:id |
2218 copyPlaneFromId:id |
2230 x:0 y:0 |
2219 x:0 y:0 gc:(deviceForm gcId) |
2231 to:drawableId |
2220 to:drawableId |
2232 x:pX y:pY |
2221 x:pX y:pY gc:gcId |
2233 width:w height:h |
2222 width:w height:h. |
2234 gc:gcId. |
|
2235 ^ self |
2223 ^ self |
2236 ]. |
2224 ]. |
2237 |
2225 |
2238 " |
2226 " |
2239 hard case: paint and/or bgPaint are dithered or patterns |
2227 hard case: paint and/or bgPaint are dithered or patterns |
2262 " |
2250 " |
2263 device setForeground:0 background:allBits in:gcId. |
2251 device setForeground:0 background:allBits in:gcId. |
2264 device setFunction:#and in:gcId. |
2252 device setFunction:#and in:gcId. |
2265 device |
2253 device |
2266 copyPlaneFromId:id |
2254 copyPlaneFromId:id |
2267 x:0 y:0 |
2255 x:0 y:0 gc:(deviceForm gcId) |
2268 to:drawableId |
2256 to:drawableId |
2269 x:pX y:pY |
2257 x:pX y:pY gc:gcId |
2270 width:w height:h |
2258 width:w height:h |
2271 gc:gcId. |
|
2272 ]. |
2259 ]. |
2273 |
2260 |
2274 fgId ~~ 0 ifTrue:[ |
2261 fgId ~~ 0 ifTrue:[ |
2275 " |
2262 " |
2276 or-in fg-bits ... |
2263 or-in fg-bits ... |
2277 " |
2264 " |
2278 device setForeground:fgId background:0 in:gcId. |
2265 device setForeground:fgId background:0 in:gcId. |
2279 device setFunction:#or in:gcId. |
2266 device setFunction:#or in:gcId. |
2280 device |
2267 device |
2281 copyPlaneFromId:id |
2268 copyPlaneFromId:id |
2282 x:0 y:0 |
2269 x:0 y:0 gc:(deviceForm gcId) |
2283 to:drawableId |
2270 to:drawableId |
2284 x:pX y:pY |
2271 x:pX y:pY gc:gcId |
2285 width:w height:h |
2272 width:w height:h |
2286 gc:gcId. |
|
2287 ]. |
2273 ]. |
2288 " |
2274 " |
2289 flush foreground/background cache |
2275 flush foreground/background cache |
2290 " |
2276 " |
2291 foreground := nil. |
2277 foreground := nil. |
2311 " |
2297 " |
2312 device setForeground:allBits background:0 in:gcId. |
2298 device setForeground:allBits background:0 in:gcId. |
2313 device setFunction:#and in:gcId. |
2299 device setFunction:#and in:gcId. |
2314 device |
2300 device |
2315 copyPlaneFromId:id |
2301 copyPlaneFromId:id |
2316 x:0 y:0 |
2302 x:0 y:0 gc:(deviceForm gcId) |
2317 to:drawableId |
2303 to:drawableId |
2318 x:pX y:pY |
2304 x:pX y:pY gc:gcId |
2319 width:w height:h |
2305 width:w height:h |
2320 gc:gcId. |
|
2321 ]. |
2306 ]. |
2322 |
2307 |
2323 " |
2308 " |
2324 or-in bg-bits ... |
2309 or-in bg-bits ... |
2325 " |
2310 " |
2326 bgId ~~ 0 ifTrue:[ |
2311 bgId ~~ 0 ifTrue:[ |
2327 device setForeground:0 background:bgId in:gcId. |
2312 device setForeground:0 background:bgId in:gcId. |
2328 device setFunction:#or in:gcId. |
2313 device setFunction:#or in:gcId. |
2329 device |
2314 device |
2330 copyPlaneFromId:id |
2315 copyPlaneFromId:id |
2331 x:0 y:0 |
2316 x:0 y:0 gc:(deviceForm gcId) |
2332 to:drawableId |
2317 to:drawableId |
2333 x:pX y:pY |
2318 x:pX y:pY gc:gcId |
2334 width:w height:h |
2319 width:w height:h |
2335 gc:gcId. |
|
2336 ]. |
2320 ]. |
2337 " |
2321 " |
2338 flush foreground/background cache |
2322 flush foreground/background cache |
2339 " |
2323 " |
2340 foreground := nil. |
2324 foreground := nil. |
3406 ! ! |
3390 ! ! |
3407 |
3391 |
3408 !DeviceGraphicsContext class methodsFor:'documentation'! |
3392 !DeviceGraphicsContext class methodsFor:'documentation'! |
3409 |
3393 |
3410 version |
3394 version |
3411 ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.16 1996-08-15 16:28:54 cg Exp $' |
3395 ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.17 1996-08-15 17:23:47 cg Exp $' |
3412 ! ! |
3396 ! ! |
3413 DeviceGraphicsContext initialize! |
3397 DeviceGraphicsContext initialize! |