GraphicsContext.st
branchdelegated_gc_jv
changeset 6728 9a57ec59402c
parent 6566 949689795584
child 6729 d4608914dc99
equal deleted inserted replaced
6727:f3449322bf47 6728:9a57ec59402c
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 'From Smalltalk/X, Version:6.2.3.0 on 25-03-2014 at 11:57:17'                   !
       
    13 
       
    14 "{ Package: 'stx:libview' }"
    12 "{ Package: 'stx:libview' }"
       
    13 
       
    14 "{ NameSpace: Smalltalk }"
    15 
    15 
    16 Object subclass:#GraphicsContext
    16 Object subclass:#GraphicsContext
    17 	instanceVariableNames:'device paint bgPaint function font lineStyle lineWidth joinStyle
    17 	instanceVariableNames:'device paint bgPaint function font lineStyle lineWidth joinStyle
    18 		capStyle mask maskOrigin transformation clipRect
    18 		capStyle mask maskOrigin transformation clipRect
    19 		characterEncoding'
    19 		characterEncoding'
  1077     "Modified: 21.5.1996 / 21:16:47 / cg"
  1077     "Modified: 21.5.1996 / 21:16:47 / cg"
  1078 !
  1078 !
  1079 
  1079 
  1080 scale:aPoint
  1080 scale:aPoint
  1081     "set the scale factor of the transformation"
  1081     "set the scale factor of the transformation"
  1082 
  1082     | t |
  1083     transformation isNil ifTrue:[
  1083 
  1084 	aPoint = 1 ifTrue:[^ self].
  1084     (t := transformation) isNil ifTrue:[
  1085 	transformation := WindowingTransformation scale:aPoint translation:0
  1085         aPoint = 1 ifTrue:[^ self].
       
  1086         t := WindowingTransformation scale:aPoint translation:0.
  1086     ] ifFalse:[
  1087     ] ifFalse:[
  1087 	transformation scale:aPoint.
  1088         t scale:aPoint.
  1088     ]
  1089     ].
  1089 
  1090     self transformation: t.
  1090     "Modified: 27.4.1996 / 18:47:38 / cg"
  1091 
       
  1092     "Modified: / 27-04-1996 / 18:47:38 / cg"
       
  1093     "Modified: / 01-01-2015 / 23:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1091 !
  1094 !
  1092 
  1095 
  1093 transformation 
  1096 transformation 
  1094     "return the transformation"
  1097     "return the transformation"
  1095 
  1098 
  1102     transformation := aTransformation
  1105     transformation := aTransformation
  1103 !
  1106 !
  1104 
  1107 
  1105 translateBy:aPoint
  1108 translateBy:aPoint
  1106     "add to the translation offset of the transformation"
  1109     "add to the translation offset of the transformation"
  1107 
  1110     | t |
  1108     transformation isNil ifTrue:[
  1111 
  1109 	aPoint = 0 ifTrue:[^ self].
  1112     (t := transformation) isNil ifTrue:[
  1110 	transformation := WindowingTransformation scale:1 translation:aPoint
  1113         aPoint = 0 ifTrue:[^ self].
       
  1114         t:= WindowingTransformation scale:1 translation:aPoint.
  1111     ] ifFalse:[
  1115     ] ifFalse:[
  1112 	transformation translateBy:aPoint
  1116         t translateBy:aPoint.
  1113     ]
  1117     ].
  1114 
  1118     self transformation: t
  1115     "Created: 10.2.1997 / 13:50:22 / cg"
  1119 
       
  1120     "Created: / 10-02-1997 / 13:50:22 / cg"
       
  1121     "Modified: / 01-01-2015 / 23:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1116 !
  1122 !
  1117 
  1123 
  1118 translation
  1124 translation
  1119     "return the translation factor (as point) of the transformation"
  1125     "return the translation factor (as point) of the transformation"
  1120 
  1126 
  1124     "Created: 27.4.1996 / 18:46:41 / cg"
  1130     "Created: 27.4.1996 / 18:46:41 / cg"
  1125 !
  1131 !
  1126 
  1132 
  1127 translation:aPoint
  1133 translation:aPoint
  1128     "set the translation offset of the transformation"
  1134     "set the translation offset of the transformation"
  1129 
  1135     | t |
  1130     transformation isNil ifTrue:[
  1136 
  1131 	aPoint = 0 ifTrue:[^ self].
  1137 
  1132 	transformation := WindowingTransformation scale:1 translation:aPoint
  1138     (t := transformation) isNil ifTrue:[
       
  1139         aPoint = 0 ifTrue:[^ self].
       
  1140         t := WindowingTransformation scale:1 translation:aPoint
  1133     ] ifFalse:[
  1141     ] ifFalse:[
  1134 	transformation translation:aPoint.
  1142         t translation:aPoint.
  1135     ]
  1143     ].
  1136 
  1144     self transformation: t
  1137     "Created: 27.4.1996 / 18:47:28 / cg"
  1145 
       
  1146     "Created: / 27-04-1996 / 18:47:28 / cg"
       
  1147     "Modified: / 01-01-2015 / 23:29:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1138 ! !
  1148 ! !
  1139 
  1149 
  1140 !GraphicsContext methodsFor:'backward compatibility'!
  1150 !GraphicsContext methodsFor:'backward compatibility'!
  1141 
  1151 
  1142 withPattern:aPattern do:aBlock
  1152 withPattern:aPattern do:aBlock
  2099     self displayForm:tempImage x:xN y:yN.
  2109     self displayForm:tempImage x:xN y:yN.
  2100 
  2110 
  2101     "Modified: / 29.1.1998 / 13:23:23 / cg"
  2111     "Modified: / 29.1.1998 / 13:23:23 / cg"
  2102 ! !
  2112 ! !
  2103 
  2113 
  2104 !GraphicsContext methodsFor:'drawing in device coordinates'!
       
  2105 
       
  2106 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
       
  2107     "draw a line in device coordinates"
       
  2108 
       
  2109     |sav|
       
  2110 
       
  2111     sav := transformation.
       
  2112     transformation := nil.
       
  2113     self displayLineFromX:x1 y:y1 toX:x2 y:y2.
       
  2114     transformation := sav
       
  2115 !
       
  2116 
       
  2117 displayDeviceRectangleX:x y:y width:w height:h
       
  2118     "draw a rectangle in device coordinates"
       
  2119 
       
  2120     |sav|
       
  2121 
       
  2122     sav := transformation.
       
  2123     transformation := nil.
       
  2124     self displayRectangleX:x y:y width:w height:h.
       
  2125     transformation := sav
       
  2126 !
       
  2127 
       
  2128 fillDeviceRectangleX:x y:y width:w height:h
       
  2129     "fill a rectangle with current paint color (device coordinates)"
       
  2130 
       
  2131     |sav|
       
  2132 
       
  2133     sav := transformation.
       
  2134     transformation := nil.
       
  2135     self fillRectangleX:x y:y width:w height:h.
       
  2136     transformation := sav
       
  2137 ! !
       
  2138 
  2114 
  2139 !GraphicsContext methodsFor:'edge drawing'!
  2115 !GraphicsContext methodsFor:'edge drawing'!
  2140 
  2116 
  2141 drawEdgesForX:x y:y width:w height:h level:l
  2117 drawEdgesForX:x y:y width:w height:h level:l
  2142     "draw 3D edges into a rectangle"
  2118     "draw 3D edges into a rectangle"
  2548     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.137 2014-07-08 21:21:04 cg Exp $'
  2524     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.137 2014-07-08 21:21:04 cg Exp $'
  2549 !
  2525 !
  2550 
  2526 
  2551 version_CVS
  2527 version_CVS
  2552     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.137 2014-07-08 21:21:04 cg Exp $'
  2528     ^ '$Header: /cvs/stx/stx/libview/GraphicsContext.st,v 1.137 2014-07-08 21:21:04 cg Exp $'
       
  2529 !
       
  2530 
       
  2531 version_HG
       
  2532 
       
  2533     ^ '$Changeset: <not expanded> $'
  2553 ! !
  2534 ! !
  2554 
  2535 
  2555 
  2536 
  2556 GraphicsContext initialize!
  2537 GraphicsContext initialize!