# HG changeset patch # User Claus Gittinger # Date 834577474 -7200 # Node ID 064890dcfabd0595157ea916a8a4f3d48d68474e # Parent ceb4e9f3226210813b84ba6fb6dd70d56466570c fixed opaque string draw with deep-dither diff -r ceb4e9f32262 -r 064890dcfabd DevGC.st --- a/DevGC.st Wed Jun 12 13:01:38 1996 +0200 +++ b/DevGC.st Wed Jun 12 13:04:34 1996 +0200 @@ -1313,9 +1313,11 @@ ^ self ]. + "/ the very hard case (fg-dither) + self displayDeviceOpaqueString:s from:index1 to:index2 in:fontUsed x:pX y:pY. - "Modified: 21.5.1996 / 21:16:08 / cg" + "Modified: 12.6.1996 / 12:36:33 / cg" ! displayOpaqueString:aString x:x y:y @@ -2479,16 +2481,17 @@ " device setForeground:bgId in:gcId. device setFunction:#copy in:gcId. + device setBitmapMask:nil in:gcId. self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h. - "/ draw dithered + "/ draw fg dithered (mask depth == 1) ifTrue:[ - device setBitmapMask:mask id in:gcId + device setBitmapMask:mask id in:gcId. + device setForeground:foreground colorId background:background colorId in:gcId. ] ifFalse:[ device setPixmapMask:mask id in:gcId ]. - device setForeground:foreground colorId background:background colorId in:gcId. device displayString:s from:index1 to:index2 x:pX y:pY @@ -2530,12 +2533,13 @@ "/ background := nil. "/ device setFunction:function in:gcId. "/ ^ self - ]. + ]. + " - hard case, both fg and bg are dithered colors/images + very hard case, both fg and bg are dithered colors/images " noColor := Color noColor. -'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. +"/ 'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. " create temp-forms; " @@ -2615,7 +2619,7 @@ foreground := nil. background := nil. - "Modified: 30.5.1996 / 09:22:11 / cg" + "Modified: 12.6.1996 / 12:50:12 / cg" ! displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y @@ -3128,6 +3132,19 @@ reinitialize 'reinit of ' errorPrint. self classNameWithArticle errorPrint. ' failed' errorPrintNL +! + +releaseGC + "destroy the associated GC - can be done to be nice to the + display if you know that you are done with a drawable." + + gcId notNil ifTrue:[ + device destroyGC:gcId. + gcId := nil. + Lobby registerChange:self. + ] + + "Created: 11.6.1996 / 22:07:30 / cg" ! ! !DeviceGraphicsContext methodsFor:'instance release'! @@ -3154,7 +3171,7 @@ setup the GC to draw in this color. A helper for paint and paint:on:" - |dither map pixelId p fg bg vOrg ditherDepth| + |dither map pixelId p fg bg vOrg ditherDepth deviceDepth| gcId notNil ifTrue:[ (p := paint) isColor ifTrue:[ @@ -3199,9 +3216,11 @@ self foreground:fg background:bg. paint := p ] ifFalse:[ - (ditherDepth ~~ device depth) ifTrue:[ + deviceDepth := device depth. + (ditherDepth ~~ deviceDepth) ifTrue:[ dither := dither asFormOn:device. - (dither isNil or:[ditherDepth ~~ device depth]) ifTrue:[ + ditherDepth := dither depth. + (dither isNil or:[ditherDepth ~~ deviceDepth]) ifTrue:[ self error:'bad dither'. ^ self ] @@ -3213,7 +3232,7 @@ ] "Created: 16.5.1996 / 15:35:51 / cg" - "Modified: 16.5.1996 / 15:37:31 / cg" + "Modified: 12.6.1996 / 12:49:07 / cg" ! ! !DeviceGraphicsContext methodsFor:'queries'! @@ -3277,6 +3296,6 @@ !DeviceGraphicsContext class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/Attic/DevGC.st,v 1.6 1996-06-04 17:04:41 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/Attic/DevGC.st,v 1.7 1996-06-12 11:04:34 cg Exp $' ! ! DeviceGraphicsContext initialize! diff -r ceb4e9f32262 -r 064890dcfabd DeviceGraphicsContext.st --- a/DeviceGraphicsContext.st Wed Jun 12 13:01:38 1996 +0200 +++ b/DeviceGraphicsContext.st Wed Jun 12 13:04:34 1996 +0200 @@ -1313,9 +1313,11 @@ ^ self ]. + "/ the very hard case (fg-dither) + self displayDeviceOpaqueString:s from:index1 to:index2 in:fontUsed x:pX y:pY. - "Modified: 21.5.1996 / 21:16:08 / cg" + "Modified: 12.6.1996 / 12:36:33 / cg" ! displayOpaqueString:aString x:x y:y @@ -2479,16 +2481,17 @@ " device setForeground:bgId in:gcId. device setFunction:#copy in:gcId. + device setBitmapMask:nil in:gcId. self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h. - "/ draw dithered + "/ draw fg dithered (mask depth == 1) ifTrue:[ - device setBitmapMask:mask id in:gcId + device setBitmapMask:mask id in:gcId. + device setForeground:foreground colorId background:background colorId in:gcId. ] ifFalse:[ device setPixmapMask:mask id in:gcId ]. - device setForeground:foreground colorId background:background colorId in:gcId. device displayString:s from:index1 to:index2 x:pX y:pY @@ -2530,12 +2533,13 @@ "/ background := nil. "/ device setFunction:function in:gcId. "/ ^ self - ]. + ]. + " - hard case, both fg and bg are dithered colors/images + very hard case, both fg and bg are dithered colors/images " noColor := Color noColor. -'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. +"/ 'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. " create temp-forms; " @@ -2615,7 +2619,7 @@ foreground := nil. background := nil. - "Modified: 30.5.1996 / 09:22:11 / cg" + "Modified: 12.6.1996 / 12:50:12 / cg" ! displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y @@ -3128,6 +3132,19 @@ reinitialize 'reinit of ' errorPrint. self classNameWithArticle errorPrint. ' failed' errorPrintNL +! + +releaseGC + "destroy the associated GC - can be done to be nice to the + display if you know that you are done with a drawable." + + gcId notNil ifTrue:[ + device destroyGC:gcId. + gcId := nil. + Lobby registerChange:self. + ] + + "Created: 11.6.1996 / 22:07:30 / cg" ! ! !DeviceGraphicsContext methodsFor:'instance release'! @@ -3154,7 +3171,7 @@ setup the GC to draw in this color. A helper for paint and paint:on:" - |dither map pixelId p fg bg vOrg ditherDepth| + |dither map pixelId p fg bg vOrg ditherDepth deviceDepth| gcId notNil ifTrue:[ (p := paint) isColor ifTrue:[ @@ -3199,9 +3216,11 @@ self foreground:fg background:bg. paint := p ] ifFalse:[ - (ditherDepth ~~ device depth) ifTrue:[ + deviceDepth := device depth. + (ditherDepth ~~ deviceDepth) ifTrue:[ dither := dither asFormOn:device. - (dither isNil or:[ditherDepth ~~ device depth]) ifTrue:[ + ditherDepth := dither depth. + (dither isNil or:[ditherDepth ~~ deviceDepth]) ifTrue:[ self error:'bad dither'. ^ self ] @@ -3213,7 +3232,7 @@ ] "Created: 16.5.1996 / 15:35:51 / cg" - "Modified: 16.5.1996 / 15:37:31 / cg" + "Modified: 12.6.1996 / 12:49:07 / cg" ! ! !DeviceGraphicsContext methodsFor:'queries'! @@ -3277,6 +3296,6 @@ !DeviceGraphicsContext class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.6 1996-06-04 17:04:41 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.7 1996-06-12 11:04:34 cg Exp $' ! ! DeviceGraphicsContext initialize!