GraphicsMedium.st
changeset 7464 694f640cee34
parent 7461 b4da8d7a1363
child 7467 b28e8bfab43d
equal deleted inserted replaced
7463:48202ec4ce92 7464:694f640cee34
   254 
   254 
   255     "Modified: 28.5.1996 / 20:22:29 / cg"
   255     "Modified: 28.5.1996 / 20:22:29 / cg"
   256 !
   256 !
   257 
   257 
   258 key
   258 key
   259     ^ self id
   259     ^ self drawableId
   260 !
   260 !
   261 
   261 
   262 phase
   262 phase
   263     "return the origin within the mask (used to draw with patterns).
   263     "return the origin within the mask (used to draw with patterns).
   264      This is an alias for ST/X's #maskOrigin"
   264      This is an alias for ST/X's #maskOrigin"
   319 
   319 
   320 copyBits:aRectangle from:aForm at:srcOrigin clippingBox:clippingBox rule:rule fillColor:fillColor
   320 copyBits:aRectangle from:aForm at:srcOrigin clippingBox:clippingBox rule:rule fillColor:fillColor
   321     |f oldClip oldFunction|
   321     |f oldClip oldFunction|
   322 
   322 
   323     (f := rule) isInteger ifTrue:[
   323     (f := rule) isInteger ifTrue:[
   324 	"/ ST-80 compatibility: numeric rule
   324         "/ ST-80 compatibility: numeric rule
   325 	f := #(clear and andReverse  copy andInverted noop xor or nor equiv invert orInverted copyInverted
   325         f := #(clear and andReverse  copy andInverted noop xor or nor equiv invert orInverted copyInverted
   326 	       orReverse nand set) at:(rule + 1).
   326                orReverse nand set) at:(rule + 1).
   327     ].
   327     ].
   328 
   328 
   329     oldFunction := gc function.
   329     oldFunction := gc function.
   330     oldClip := gc clippingRectangleOrNil.
   330     oldClip := gc clippingBoundsOrNil.
   331 
   331 
   332     gc clippingRectangle:clippingBox.
   332     gc clippingBounds:clippingBox.
   333     gc function:f.
   333     gc function:f.
   334 
   334 
   335     gc
   335     gc
   336 	copyFrom:aForm
   336         copyFrom:aForm
   337 	x:srcOrigin x y:srcOrigin y
   337         x:srcOrigin x y:srcOrigin y
   338 	toX:aRectangle left y:aRectangle top
   338         toX:aRectangle left y:aRectangle top
   339 	width:aRectangle width height:aRectangle height.
   339         width:aRectangle width height:aRectangle height.
   340 
   340 
   341     gc clippingRectangle:oldClip.
   341     gc clippingBounds:oldClip.
   342     gc function:oldFunction.
   342     gc function:oldFunction.
   343 
   343 
   344     "
   344     "
   345       |dst src|
   345       |dst src|
   346 
   346 
   347       dst := Form width:8 height:8 fromArray:#[
   347       dst := Form width:8 height:8 fromArray:#[
   348 					      2r00000000
   348                                               2r00000000
   349 					      2r00000000
   349                                               2r00000000
   350 					      2r00000000
   350                                               2r00000000
   351 					      2r00000000
   351                                               2r00000000
   352 					      2r11111111
   352                                               2r11111111
   353 					      2r11111111
   353                                               2r11111111
   354 					      2r11111111
   354                                               2r11111111
   355 					      2r11111111
   355                                               2r11111111
   356 					     ].
   356                                              ].
   357       src := Form width:8 height:8 fromArray:#[
   357       src := Form width:8 height:8 fromArray:#[
   358 					      2r00001111
   358                                               2r00001111
   359 					      2r00001111
   359                                               2r00001111
   360 					      2r00001111
   360                                               2r00001111
   361 					      2r00001111
   361                                               2r00001111
   362 					      2r00001111
   362                                               2r00001111
   363 					      2r00001111
   363                                               2r00001111
   364 					      2r00001111
   364                                               2r00001111
   365 					      2r00001111
   365                                               2r00001111
   366 					     ].
   366                                              ].
   367 
   367 
   368     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   368     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   369     dst inspect
   369     dst inspect
   370 
   370 
   371     "
   371     "
   374 
   374 
   375     "
   375     "
   376       |dst src|
   376       |dst src|
   377 
   377 
   378       dst := Form width:8 height:8 fromArray:#[
   378       dst := Form width:8 height:8 fromArray:#[
   379 					      2r00000000
   379                                               2r00000000
   380 					      2r00000000
   380                                               2r00000000
   381 					      2r00000000
   381                                               2r00000000
   382 					      2r00000000
   382                                               2r00000000
   383 					      2r11111111
   383                                               2r11111111
   384 					      2r11111111
   384                                               2r11111111
   385 					      2r11111111
   385                                               2r11111111
   386 					      2r11111111
   386                                               2r11111111
   387 					     ].
   387                                              ].
   388       src := Form width:8 height:8 fromArray:#[
   388       src := Form width:8 height:8 fromArray:#[
   389 					      2r00001111
   389                                               2r00001111
   390 					      2r00001111
   390                                               2r00001111
   391 					      2r00001111
   391                                               2r00001111
   392 					      2r00001111
   392                                               2r00001111
   393 					      2r00001111
   393                                               2r00001111
   394 					      2r00001111
   394                                               2r00001111
   395 					      2r00001111
   395                                               2r00001111
   396 					      2r00001111
   396                                               2r00001111
   397 					     ].
   397                                              ].
   398 
   398 
   399     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   399     dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
   400     dst inspect
   400     dst inspect
   401 
   401 
   402     "
   402     "
   765 
   765 
   766 deviceClippingRectangle:aRectangleOrNil
   766 deviceClippingRectangle:aRectangleOrNil
   767     "set the clipping rectangle for drawing (in device coordinates);
   767     "set the clipping rectangle for drawing (in device coordinates);
   768      a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
   768      a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
   769 
   769 
   770     gc deviceClippingRectangle:aRectangleOrNil
   770     gc deviceClippingBounds:aRectangleOrNil
   771 !
   771 !
   772 
   772 
   773 drawableId
   773 drawableId
   774     "return the id of the drawable on the device"
   774     "return the id of the drawable on the device"
   775 
   775 
  1172 foreground:fgColor background:bgColor function:fun
  1172 foreground:fgColor background:bgColor function:fun
  1173     <resource: #obsolete>
  1173     <resource: #obsolete>
  1174     "set foreground, background colors and function.
  1174     "set foreground, background colors and function.
  1175      OBSOLETE: this method will vanish; use #paint: / #paint:on:"
  1175      OBSOLETE: this method will vanish; use #paint: / #paint:on:"
  1176 
  1176 
  1177     self foreground:fgColor background:bgColor.
  1177     gc foreground:fgColor background:bgColor.
  1178     self function:fun
  1178     gc function:fun
  1179 
  1179 
  1180     "Modified: 12.5.1996 / 22:28:34 / cg"
  1180     "Modified: 12.5.1996 / 22:28:34 / cg"
  1181 !
  1181 !
  1182 
  1182 
  1183 foreground:aColor function:fun
  1183 foreground:aColor function:fun