diff -r 6492ac9c2494 -r be774c8a672f DeviceGraphicsContext.st --- a/DeviceGraphicsContext.st Tue Jun 04 17:57:01 1996 +0200 +++ b/DeviceGraphicsContext.st Tue Jun 04 18:01:04 1996 +0200 @@ -904,7 +904,7 @@ displayArcX:x y:y width:w height:h from:startAngle angle:angle "draw an arc; apply transformation if nonNil" - |pX pY nW nH| + |pX pY rpX rpY nW nH| gcId isNil ifTrue:[ self initGC @@ -944,7 +944,23 @@ in:drawableId with:gcId +"/ rpX := pX rounded. +"/ rpY := pY rounded. +"/ nW := (nW + (rpX - pX)) rounded. +"/ nH := (nH + (rpY - pY)) rounded. +"/ +"/ device +"/ displayArcX:rpX +"/ y:rpY +"/ width:nW +"/ height:nH +"/ from:startAngle +"/ angle:angle +"/ in:drawableId +"/ with:gcId + "Created: 8.5.1996 / 08:31:30 / cg" + "Modified: 4.6.1996 / 17:59:28 / cg" ! displayForm:formToDraw x:x y:y @@ -1451,7 +1467,7 @@ "draw a rectangle (with current paint-color). If transformation is nonNil, drawing is in logical coordinates." - |pX pY nW nH easy fgId bgId| + |pX pY rpX rpY nW nH easy fgId bgId| gcId isNil ifTrue:[ self initGC @@ -1520,11 +1536,29 @@ a rectangle using the same extents. I'm not certain if is the right thing to do ... " - device displayRectangleX:pX y:pY - width:(nW - 1) height:(nH - 1) - in:drawableId with:gcId - - "Modified: 13.4.1996 / 20:31:59 / cg" + device displayRectangleX:pX + y:pY + width:(nW - 1) + height:(nH - 1) + in:drawableId with:gcId + +"/ rpX := pX rounded. +"/ rpY := pY rounded. +"/ nW := (nW + (rpX - pX)) rounded. +"/ nH := (nH + (rpY - pY)) rounded. +"/ +"/ "I asked myself many times if we should draw w/h or (w-1)/(h-1) bits - +"/ this one seems mathematically incorrect but allows to draw and fill +"/ a rectangle using the same extents. +"/ I'm not certain if is the right thing to do ... +"/ " +"/ device displayRectangleX:rpX +"/ y:rpY +"/ width:(nW - 1) +"/ height:(nH - 1) +"/ in:drawableId with:gcId + + "Modified: 4.6.1996 / 18:00:03 / cg" ! displayString:aString from:index1 to:index2 x:x y:y @@ -2782,7 +2816,7 @@ fillArcX:x y:y width:w height:h from:startAngle angle:angle "draw a filled arc; apply transformation if nonNil" - |pX pY nW nH| + |pX pY rpX rpY nW nH| gcId isNil ifTrue:[ self initGC @@ -2822,8 +2856,23 @@ in:drawableId with:gcId +"/ rpX := pX rounded. +"/ rpY := pY rounded. +"/ nW := (nW + (rpX - pX)) rounded. +"/ nH := (nH + (rpY - pY)) rounded. +"/ +"/ device +"/ fillArcX:rpX +"/ y:rpY +"/ width:nW +"/ height:nH +"/ from:startAngle +"/ angle:angle +"/ in:drawableId +"/ with:gcId + "Created: 8.5.1996 / 08:29:45 / cg" - "Modified: 8.5.1996 / 08:38:10 / cg" + "Modified: 4.6.1996 / 17:58:21 / cg" ! fillPolygon:aPolygon @@ -2855,29 +2904,29 @@ fillRectangleX:x y:y width:w height:h "draw a filled rectangle; apply transformation if nonNil" - |pX pY nW nH| + |pX pY rpX rpY nW nH| gcId isNil ifTrue:[ - self initGC + self initGC ]. transformation notNil ifTrue:[ - pX := transformation applyToX:x. - pY := transformation applyToY:y. - nW := transformation applyScaleX:w. - nH := transformation applyScaleY:h. - nW < 0 ifTrue:[ - nW := nW abs. - pX := pX - nW. - ]. - nH < 0 ifTrue:[ - nH := nH abs. - pY := pY - nH. - ]. + pX := transformation applyToX:x. + pY := transformation applyToY:y. + nW := transformation applyScaleX:w. + nH := transformation applyScaleY:h. + nW < 0 ifTrue:[ + nW := nW abs. + pX := pX - nW. + ]. + nH < 0 ifTrue:[ + nH := nH abs. + pY := pY - nH. + ]. ] ifFalse:[ - pX := x. - pY := y. - nW := w. - nH := h. + pX := x. + pY := y. + nW := w. + nH := h. ]. pX := pX rounded. pY := pY rounded. @@ -2885,11 +2934,25 @@ nH := nH rounded. device - fillRectangleX:pX - y:pY - width:nW - height:nH - in:drawableId with:gcId + fillRectangleX:pX + y:pY + width:nW + height:nH + in:drawableId with:gcId + +"/ rpX := pX rounded. +"/ rpY := pY rounded. +"/ nW := (nW + (pX - rpX)) rounded. +"/ nH := (nH + (pY - rpY)) rounded. +"/ +"/ device +"/ fillRectangleX:rpX +"/ y:rpY +"/ width:nW +"/ height:nH +"/ in:drawableId with:gcId + + "Modified: 4.6.1996 / 17:58:49 / cg" ! ! !DeviceGraphicsContext methodsFor:'initialization'! @@ -3162,6 +3225,14 @@ ^ device horizontalPixelPerMillimeter * millis ! +resolution + "return a point consisting of pixel-per-inch horizontally and vertically." + + ^ device resolution + + "Created: 4.6.1996 / 15:23:55 / cg" +! + verticalIntegerPixelPerMillimeter "return the (rounded) number of pixels per millimeter" @@ -3189,6 +3260,6 @@ !DeviceGraphicsContext class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.4 1996-05-30 07:22:34 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.5 1996-06-04 16:01:04 cg Exp $' ! ! DeviceGraphicsContext initialize!