1909 (i.e. only 1-bits are drawn from the form). |
1909 (i.e. only 1-bits are drawn from the form). |
1910 If its a deep form (i.e. a pixmap) the current paint |
1910 If its a deep form (i.e. a pixmap) the current paint |
1911 settings are ignored and the form is drawn as-is; |
1911 settings are ignored and the form is drawn as-is; |
1912 however, the mask is applied if present. |
1912 however, the mask is applied if present. |
1913 |
1913 |
1914 The form should must have been allocated on the same device, |
1914 The form should have been allocated on the same device, |
1915 otherwise its converted here, which slows down the draw. |
1915 otherwise its converted here, which slows down the draw. |
1916 No transformation or scaling is done. |
1916 No transformation or scaling is done. |
1917 Care must be taken, that the paint color is correctly allocated |
1917 Care must be taken, that the paint color is correctly allocated |
1918 (by sending #on: to the color) before doing so. |
1918 (by sending #on: to the color) before doing so. |
1919 Using functions other than #copy only makes sense if you are |
1919 Using functions other than #copy only makes sense if you are |
1920 certain, that the colors are real colors (actually, only for |
1920 certain, that the colors are real colors (actually, only for |
1921 noColor or allColor)." |
1921 noColor or allColor)." |
1922 |
1922 |
1923 |id w h easy paintDither depth tmpForm tmpId tmpGCId |
1923 |id w h easy paintDither depth tmpForm tmpId tmpGCId |
1924 fgId noColor allColor allBits pX pY |
1924 fgId noColor allColor allBits pX pY |
1925 mask maskId deviceForm deviceFormGCId deviceMask colorMap| |
1925 mask maskId deviceForm deviceFormGCId deviceMask deviceMaskGcId colorMap| |
1926 |
1926 |
1927 w := aForm width. |
1927 w := aForm width. |
1928 h := aForm height. |
1928 h := aForm height. |
1929 (w = 0 or:[h = 0]) ifTrue:[^ self]. |
1929 (w = 0 or:[h = 0]) ifTrue:[^ self]. |
1930 |
1930 |
1935 deviceForm isNil ifTrue:[ |
1935 deviceForm isNil ifTrue:[ |
1936 Logger warning:'cannot create device-form'. |
1936 Logger warning:'cannot create device-form'. |
1937 ^self |
1937 ^self |
1938 ]. |
1938 ]. |
1939 id := deviceForm drawableId. |
1939 id := deviceForm drawableId. |
1940 "temporary ..." |
1940 "temporary ... what the heck is this??" |
1941 (id isNil |
1941 (id isNil |
1942 or:[aForm graphicsDevice ~~ device]) ifTrue:[ |
1942 or:[aForm graphicsDevice ~~ device]) ifTrue:[ |
1943 deviceForm := deviceForm asFormOn:device. |
1943 deviceForm := deviceForm asFormOn:device. |
1944 id := deviceForm drawableId. |
1944 id := deviceForm drawableId. |
1945 id isNil ifTrue:[ |
1945 id isNil ifTrue:[ |
1972 'DeviceGraphicsContext [warning]: cannot create device-mask' errorPrintCR. |
1972 'DeviceGraphicsContext [warning]: cannot create device-mask' errorPrintCR. |
1973 ^self |
1973 ^self |
1974 ]. |
1974 ]. |
1975 maskId := deviceMask drawableId. |
1975 maskId := deviceMask drawableId. |
1976 maskId notNil ifTrue:[ |
1976 maskId notNil ifTrue:[ |
1977 deviceMask gcId isNil ifTrue:[deviceMask initGC]. |
1977 deviceMaskGcId := deviceMask initGC. |
1978 allColor := Color allColor. |
1978 allColor := Color allColor. |
1979 allBits := allColor colorId. |
1979 allBits := allColor colorId. |
1980 |
1980 |
1981 (aForm maskedPixelsAre0 |
1981 (aForm maskedPixelsAre0 |
1982 and:[depth == 1 or:[deviceForm depth == device depth]]) ifTrue:[ |
1982 and:[depth == 1 or:[deviceForm depth == device depth]]) ifTrue:[ |
2050 tmpForm := Form width:w height:h depth:device depth onDevice:device. |
2050 tmpForm := Form width:w height:h depth:device depth onDevice:device. |
2051 tmpForm isNil ifTrue:[ |
2051 tmpForm isNil ifTrue:[ |
2052 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR. |
2052 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR. |
2053 ^ self |
2053 ^ self |
2054 ]. |
2054 ]. |
2055 tmpForm initGC. |
|
2056 tmpId := tmpForm drawableId. |
2055 tmpId := tmpForm drawableId. |
2057 tmpGCId := tmpForm gcId. |
2056 tmpGCId := tmpForm initGC. |
2058 |
2057 |
2059 " |
2058 " |
2060 fill tempform with image |
2059 fill tempform with image |
2061 " |
2060 " |
2062 depth == 1 ifTrue:[ |
2061 depth == 1 ifTrue:[ |
3404 |
3403 |
3405 !DeviceGraphicsContext methodsFor:'finalization'! |
3404 !DeviceGraphicsContext methodsFor:'finalization'! |
3406 |
3405 |
3407 executor |
3406 executor |
3408 drawableType == #window ifTrue:[ |
3407 drawableType == #window ifTrue:[ |
3409 ^ DeviceWindowGCHandle basicNew |
3408 ^ DeviceWindowGCHandle basicNew |
3410 setDevice:self graphicsDevice id:self drawableId gcId:self gcId parentId:parentId. |
3409 setDevice:device id:drawableId gcId:gcId parentId:parentId. |
3411 ] ifFalse:[ |
3410 ] ifFalse:[ |
3412 ^ DevicePixmapGCHandle basicNew |
3411 ^ DevicePixmapGCHandle basicNew |
3413 setDevice:self graphicsDevice id:self drawableId gcId:self gcId. |
3412 setDevice:device id:drawableId gcId:gcId. |
3414 ]. |
3413 ]. |
3415 ! |
3414 ! |
3416 |
3415 |
3417 finalizationLobby |
3416 finalizationLobby |
3418 "answer the registry used for finalization. |
3417 "answer the registry used for finalization. |