diff -r 4f8cc0ee0e0b -r 77e4f9d30a22 DeviceGraphicsContext.st --- a/DeviceGraphicsContext.st Wed May 29 17:51:54 1996 +0200 +++ b/DeviceGraphicsContext.st Thu May 30 09:22:34 1996 +0200 @@ -1792,29 +1792,29 @@ "temporary ..." (id isNil or:[aForm graphicsDevice ~~ device]) ifTrue:[ - id := (aForm on:device) id. - id isNil ifTrue:[ - 'DEVDRAW: invalid form draw - ignored' errorPrintNL. - ^ self - ]. + id := (aForm on:device) id. + id isNil ifTrue:[ + 'DEVDRAW: invalid form draw - ignored' errorPrintNL. + ^ self + ]. ]. gcId isNil ifTrue:[ - self initGC + self initGC ]. " a deep form ignores paint/bgPaint settings " (aForm depth ~~ 1) ifTrue:[ - device - copyFromId:id - x:0 y:0 - to:drawableId - x:pX y:pY - width:w - height:h - with:gcId. - ^ self + device + copyFromId:id + x:0 y:0 + to:drawableId + x:pX y:pY + width:w + height:h + with:gcId. + ^ self ]. " @@ -1829,70 +1829,70 @@ " easy := (function == #copy). easy ifTrue:[ - paint isColor ifFalse:[ - paintDither := paint. - easy := false - ] ifTrue:[ - paintDither := paint ditherForm. - paintDither notNil ifTrue:[ - easy := false. - ] - ]. + paint isColor ifFalse:[ + paintDither := paint. + easy := false + ] ifTrue:[ + paintDither := paint ditherForm. + paintDither notNil ifTrue:[ + easy := false. + ] + ]. ]. allColor := Color allColor. allBits := allColor colorId. easy ifTrue:[ - " - paint is a real color - " - - " - if paint color is all-0 or all-1's, we can do it in one - operation ... - " - fgId := paint colorId. - - ((fgId ~~ ((1 bitShift:device depth)-1)) - and:[fgId ~~ allBits]) ifTrue:[ - " - clear fg-bits ... - " - device setForeground:0 background:allBits in:gcId. - device setFunction:#and in:gcId. - device - copyPlaneFromId:id - x:0 y:0 - to:drawableId - x:pX y:pY - width:w - height:h - with:gcId. - ]. - - fgId ~~ 0 ifTrue:[ - " - or-in fg-bits ... - " - device setForeground:fgId background:0 in:gcId. - device setFunction:#or in:gcId. - device - copyPlaneFromId:id - x:0 y:0 - to:drawableId - x:pX y:pY - width:w - height:h - with:gcId. - ]. - " - flush foreground/background cache - " - foreground := nil. - background := nil. - device setFunction:function in:gcId. - ^ self + " + paint is a real color + " + + " + if paint color is all-0 or all-1's, we can do it in one + operation ... + " + fgId := paint colorId. + + ((fgId ~~ ((1 bitShift:device depth)-1)) + and:[fgId ~~ allBits]) ifTrue:[ + " + clear fg-bits ... + " + device setForeground:0 background:allBits in:gcId. + device setFunction:#and in:gcId. + device + copyPlaneFromId:id + x:0 y:0 + to:drawableId + x:pX y:pY + width:w + height:h + with:gcId. + ]. + + fgId ~~ 0 ifTrue:[ + " + or-in fg-bits ... + " + device setForeground:fgId background:0 in:gcId. + device setFunction:#or in:gcId. + device + copyPlaneFromId:id + x:0 y:0 + to:drawableId + x:pX y:pY + width:w + height:h + with:gcId. + ]. + " + flush foreground/background cache + " + foreground := nil. + background := nil. + device setFunction:function in:gcId. + ^ self ]. @@ -1923,13 +1923,13 @@ device setForeground:0 background:allBits in:gcId. device setFunction:#and in:gcId. device - copyPlaneFromId:aForm id - x:0 y:0 - to:drawableId - x:pX y:pY - width:w - height:h - with:gcId. + copyPlaneFromId:id + x:0 y:0 + to:drawableId + x:pX y:pY + width:w + height:h + with:gcId. " or-in temp into destination " @@ -1937,19 +1937,21 @@ device setFunction:#or in:gcId. device - copyFromId:tmpForm id - x:0 y:0 - to:drawableId - x:pX y:pY - width:w - height:h - with:gcId. + copyFromId:tmpForm id + x:0 y:0 + to:drawableId + x:pX y:pY + width:w + height:h + with:gcId. " flush foreground/background cache " foreground := nil. background := nil. device setFunction:function in:gcId. + + "Modified: 30.5.1996 / 09:22:09 / cg" ! displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1 @@ -2420,11 +2422,69 @@ "/ ^ self "/ ]. + (bgId notNil and:[function == #copy]) ifTrue:[ + " + only fg is dithered; fill with bg first ... + " + device setForeground:bgId in:gcId. + device setFunction:#copy in:gcId. + self fillRectangleX:pX y:(pY - fontUsed ascent) width:w height:h. + + "/ draw dithered + (mask depth == 1) ifTrue:[ + device setBitmapMask:mask id 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 + in:drawableId with:gcId. + ^ self. +"/ +"/ " +"/ if bgPaint color is all-0 or all-1's, we can do it in one +"/ operation ... +"/ " +"/ ((bgId ~~ ((1 bitShift:deviceDepth)-1)) +"/ and:[bgId ~~ allBits]) ifTrue:[ +"/ " +"/ clear bg bits ... +"/ " +"/ device setForeground:allBits background:0 in:gcId. +"/ device setFunction:#and in:gcId. +"/ device displayOpaqueString:s +"/ from:index1 to:index2 +"/ x:pX y:pY +"/ in:drawableId with:gcId. +"/ ]. +"/ +"/ " +"/ or-in bg bits ... +"/ " +"/ bgId ~~ 0 ifTrue:[ +"/ device setForeground:0 background:bgId in:gcId. +"/ device setFunction:#or in:gcId. +"/ device displayOpaqueString:s +"/ from:index1 to:index2 +"/ x:pX y:pY +"/ in:drawableId with:gcId. +"/ ]. +"/ " +"/ flush foreground/background cache +"/ " +"/ foreground := nil. +"/ background := nil. +"/ device setFunction:function in:gcId. +"/ ^ self + ]. " hard case, both fg and bg are dithered colors/images " noColor := Color noColor. - +'hard: ' print. aString print. ' ' print. paint print. ' ' print. bgPaint printCR. " create temp-forms; " @@ -2504,7 +2564,7 @@ foreground := nil. background := nil. - "Modified: 12.5.1996 / 17:49:32 / cg" + "Modified: 30.5.1996 / 09:22:11 / cg" ! displayDeviceOpaqueString:aString from:index1 to:index2 x:x y:y @@ -3129,6 +3189,6 @@ !DeviceGraphicsContext class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.3 1996-05-28 18:57:28 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.4 1996-05-30 07:22:34 cg Exp $' ! ! DeviceGraphicsContext initialize!