GraphicsMedium.st
changeset 5321 714fd27c7de8
parent 4403 3342601d3fed
child 6045 0e3df803d990
equal deleted inserted replaced
5320:a222d6215ff0 5321:714fd27c7de8
    41     have a physical representation (i.e. have an extent). Dont use messages
    41     have a physical representation (i.e. have an extent). Dont use messages
    42     from here - it will vanish soon.
    42     from here - it will vanish soon.
    43 
    43 
    44     [Instance variables:]
    44     [Instance variables:]
    45 
    45 
    46         width           <SmallInteger>  the width (device dependent, usually pixels or inches)
    46 	width           <SmallInteger>  the width (device dependent, usually pixels or inches)
    47         height          <SmallInteger>  the height (device dependent, usually pixels or inches)
    47 	height          <SmallInteger>  the height (device dependent, usually pixels or inches)
    48 
    48 
    49     [author:]
    49     [author:]
    50         Claus Gittinger
    50 	Claus Gittinger
    51 "
    51 "
    52 ! !
    52 ! !
    53 
    53 
    54 !GraphicsMedium methodsFor:'Compatibility-Squeak'!
    54 !GraphicsMedium methodsFor:'Compatibility-Squeak'!
    55 
    55 
    56 copyBits:aRectangle from:aForm at:srcOrigin clippingBox:clippingBox rule:rule fillColor:fillColor
    56 copyBits:aRectangle from:aForm at:srcOrigin clippingBox:clippingBox rule:rule fillColor:fillColor
    57     |f oldClip oldFunction|
    57     |f oldClip oldFunction|
    58 
    58 
    59     (f := rule) isInteger ifTrue:[
    59     (f := rule) isInteger ifTrue:[
    60         "/ ST-80 compatibility: numeric rule
    60 	"/ ST-80 compatibility: numeric rule
    61         f := #(#clear #and #andReverse  #copy #andInverted #noop #xor #or #nor #equiv #invert #orInverted #copyInverted 
    61 	f := #(#clear #and #andReverse  #copy #andInverted #noop #xor #or #nor #equiv #invert #orInverted #copyInverted
    62                #orReverse #nand #set) at:(rule + 1).
    62 	       #orReverse #nand #set) at:(rule + 1).
    63     ].
    63     ].
    64 
    64 
    65     oldFunction := function.
    65     oldFunction := function.
    66     oldClip := clipRect.
    66     oldClip := clipRect.
    67 "/
    67 "/
    68     self clippingRectangle:clippingBox.
    68     self clippingRectangle:clippingBox.
    69     self function:f.
    69     self function:f.
    70 
    70 
    71     self 
    71     self
    72         copyFrom:aForm 
    72 	copyFrom:aForm
    73         x:srcOrigin x y:srcOrigin y 
    73 	x:srcOrigin x y:srcOrigin y
    74         toX:aRectangle left y:aRectangle top
    74 	toX:aRectangle left y:aRectangle top
    75         width:aRectangle width height:aRectangle height.
    75 	width:aRectangle width height:aRectangle height.
    76 
    76 
    77     self clippingRectangle:oldClip.
    77     self clippingRectangle:oldClip.
    78     self function:oldFunction.
    78     self function:oldFunction.
    79 
    79 
    80     "
    80     "
    81       |dst src|
    81       |dst src|
    82 
    82 
    83       dst := Form width:8 height:8 fromArray:#[
    83       dst := Form width:8 height:8 fromArray:#[
    84                                               2r00000000
    84 					      2r00000000
    85                                               2r00000000
    85 					      2r00000000
    86                                               2r00000000
    86 					      2r00000000
    87                                               2r00000000
    87 					      2r00000000
    88                                               2r11111111
    88 					      2r11111111
    89                                               2r11111111
    89 					      2r11111111
    90                                               2r11111111
    90 					      2r11111111
    91                                               2r11111111
    91 					      2r11111111
    92                                              ].
    92 					     ].
    93       src := Form width:8 height:8 fromArray:#[
    93       src := Form width:8 height:8 fromArray:#[
    94                                               2r00001111
    94 					      2r00001111
    95                                               2r00001111
    95 					      2r00001111
    96                                               2r00001111
    96 					      2r00001111
    97                                               2r00001111
    97 					      2r00001111
    98                                               2r00001111
    98 					      2r00001111
    99                                               2r00001111
    99 					      2r00001111
   100                                               2r00001111
   100 					      2r00001111
   101                                               2r00001111
   101 					      2r00001111
   102                                              ].
   102 					     ].
   103 
   103 
   104     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   104     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   105     dst inspect
   105     dst inspect
   106 
   106 
   107     "
   107     "
   152 
   152 
   153     ^ (self left) @ (self top + height - 1)
   153     ^ (self left) @ (self top + height - 1)
   154 !
   154 !
   155 
   155 
   156 boundingBox
   156 boundingBox
   157     ^ Rectangle 
   157     ^ Rectangle
   158         origin: 0 @ 0
   158 	origin: 0 @ 0
   159         corner: width @ height
   159 	corner: width @ height
   160 
   160 
   161 !
   161 !
   162 
   162 
   163 center
   163 center
   164     "return the point at the center of the receiver"
   164     "return the point at the center of the receiver"
   356 clearView
   356 clearView
   357     "clear the receiver with background"
   357     "clear the receiver with background"
   358 
   358 
   359     "currently need this kludge for form ..."
   359     "currently need this kludge for form ..."
   360     transformation isNil ifTrue:[
   360     transformation isNil ifTrue:[
   361         self clearRectangleX:0 y:0 width:width height:height
   361 	self clearRectangleX:0 y:0 width:width height:height
   362     ] ifFalse:[
   362     ] ifFalse:[
   363         self clearDeviceRectangleX:0 y:0 width:width height:height
   363 	self clearDeviceRectangleX:0 y:0 width:width height:height
   364     ]
   364     ]
   365 !
   365 !
   366 
   366 
   367 fill:something
   367 fill:something
   368     "fill the receiver with something;
   368     "fill the receiver with something;
   413 ! !
   413 ! !
   414 
   414 
   415 !GraphicsMedium class methodsFor:'documentation'!
   415 !GraphicsMedium class methodsFor:'documentation'!
   416 
   416 
   417 version
   417 version
   418     ^ '$Header: /cvs/stx/stx/libview/GraphicsMedium.st,v 1.18 2005-07-12 13:57:37 cg Exp $'
   418     ^ '$Header: /cvs/stx/stx/libview/GraphicsMedium.st,v 1.19 2009-08-07 10:52:03 sr Exp $'
   419 ! !
   419 ! !