The Trunk: Graphics-nice.171.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Graphics-nice.171.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.171.mcz

==================== Summary ====================

Name: Graphics-nice.171
Author: nice
Time: 29 December 2010, 5:07:15.234 pm
UUID: bf99e3d9-04f5-42bd-9090-142304bdd0fc
Ancestors: Graphics-nice.170

Add a few spaces in order to avoid Transcript warnings about @- ambiguity when recompiling.

=============== Diff against Graphics-nice.170 ===============

Item was changed:
  ----- Method: Cursor class>>initBottomLeft (in category 'class initialization') -----
  initBottomLeft
 
  BottomLeftCursor :=
+ (Cursor extent: 16 @ 16
- (Cursor extent: 16@16
  fromArray: #(
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1111111111111111
  2r1111111111111111)
+ offset: 0 @ -16).
- offset: 0@-16).
  !

Item was changed:
  ----- Method: Cursor class>>initBottomRight (in category 'class initialization') -----
  initBottomRight
 
  BottomRightCursor :=
+ (Cursor extent: 16 @ 16
- (Cursor extent: 16@16
  fromArray: #(
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r1111111111111111
  2r1111111111111111)
+ offset: -16 @ -16).
- offset: -16@-16).
  !

Item was changed:
  ----- Method: Cursor class>>initCorner (in category 'class initialization') -----
  initCorner
 
  CornerCursor :=
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r1111111111111111
  2r1111111111111111)
+ offset: -16 @ -16).
- offset: -16@-16).
  !

Item was changed:
  ----- Method: Cursor class>>initCrossHair (in category 'class initialization') -----
  initCrossHair
 
  CrossHairCursor :=  
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0000000000000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0111111111111100
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000100000000
  2r0000000000000000
  2r0)
+ offset: -7 @ -7).
- offset: -7@-7).
 
  !

Item was changed:
  ----- Method: Cursor class>>initDown (in category 'class initialization') -----
  initDown
 
  DownCursor  :=
      (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r1111110000000000
  2r111100000000000
  2r11000000000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initMarker (in category 'class initialization') -----
  initMarker
 
  MarkerCursor :=
  Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0111000000000000
  2r1111100000000000
  2r1111100000000000
  2r0111000000000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: 0 @ 0.
- offset: 0@0.
  !

Item was changed:
  ----- Method: Cursor class>>initMenu (in category 'class initialization') -----
  initMenu
 
  MenuCursor  :=
         (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1111111111100000
  2r1000000000100000
  2r1010011000100000
  2r1000000000100000
  2r1101001101100000
  2r1111111111100000
  2r1000000000100000
  2r1011001010100000
  2r1000000000100000
  2r1010110010100000
  2r1000000000100000
  2r1010010100100000
  2r1000000000100000
  2r1111111111100000
  0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initMove (in category 'class initialization') -----
  initMove
 
  MoveCursor :=
  Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1111111111111100
  2r1111111111111100
  2r1100001100001100
  2r1100001100001100
  2r1100001100001100
  2r1100001100001100
  2r1111111111111100
  2r1111111111111100
  2r1100001100001100
  2r1100001100001100
  2r1100001100001100
  2r1100001100001100
  2r1111111111111100
  2r1111111111111100
            0)
+ offset: 0 @ 0.
- offset: 0@0.
  !

Item was changed:
  ----- Method: Cursor class>>initNormal (in category 'class initialization') -----
  initNormal
 
  NormalCursor :=  
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1000000000000000
  2r1100000000000000
  2r1110000000000000
  2r1111000000000000
  2r1111100000000000
  2r1111110000000000
  2r1111111000000000
  2r1111100000000000
  2r1111100000000000
  2r1001100000000000
  2r0000110000000000
  2r0000110000000000
  2r0000011000000000
  2r0000011000000000
  2r0000001100000000
  2r0000001100000000)
+ offset: 0 @ 0).
- offset: 0@0).
 
 
  !

Item was changed:
  ----- Method: Cursor class>>initNormalWithMask (in category 'class initialization') -----
  initNormalWithMask    "Cursor initNormalWithMask.  Cursor normal show"
  "Next two lines work simply for any cursor..."
  self initNormal.
  NormalCursor := CursorWithMask derivedFrom: NormalCursor.
 
  "But for a good looking cursor, you have to tweak things..."
+ NormalCursor := (CursorWithMask extent: 16 @ 16 depth: 1
- NormalCursor := (CursorWithMask extent: 16@16 depth: 1
  fromArray: #( 0 1073741824 1610612736 1879048192
  2013265920 2080374784 2113929216 2130706432
  2080374784 2080374784 1275068416 100663296
  100663296 50331648 50331648 0)
+ offset: -1 @ -1)
+ setMaskForm: (Form extent: 16 @ 16 depth: 1
- offset: -1@-1)
- setMaskForm: (Form extent: 16@16 depth: 1
  fromArray: #( 3221225472 3758096384 4026531840 4160749568
  4227858432 4261412864 4278190080 4286578688
  4278190080 4261412864 4261412864 3472883712
  251658240 125829120 125829120 50331648)
+ offset: 0 @ 0).!
- offset: 0@0).!

Item was changed:
  ----- Method: Cursor class>>initOrigin (in category 'class initialization') -----
  initOrigin
 
  OriginCursor :=  
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1111111111111111
  2r1111111111111111
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initRead (in category 'class initialization') -----
  initRead
 
  ReadCursor :=  
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0000000000000000
  2r0000000000000000
  2r0001000000001000
  2r0010100000010100
  2r0100000000100000
  2r1111101111100000
  2r1000010000100000
  2r1000010000100000
  2r1011010110100000
  2r0111101111000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initResizeLeft (in category 'class initialization') -----
  initResizeLeft
 
         ResizeLeftCursor :=
+                (Cursor extent: 16 @ 16 fromArray: #(
-                (Cursor extent: 16@16 fromArray: #(
                 2r0000000000000000
                 2r0000000000000000
                 2r0000000000000000
                 2r0000000000000000
                 2r0000100000010000
                 2r0001100000011000
                 2r0011100000011100
                 2r0111111111111110
                 2r0011100000011100
                 2r0001100000011000
                 2r0000100000010000
                 2r0000000000000000
                 2r0000000000000000
                 2r0000000000000000
                 2r0000000000000000
                 2r0000000000000000 )
+        offset: -7 @ -7 ) withMask!
-        offset: -7@-7 ) withMask!

Item was changed:
  ----- Method: Cursor class>>initResizeTop (in category 'class initialization') -----
  initResizeTop
      "Cursor initResizeTop"
         ResizeTopCursor :=
+                (Cursor extent: 16 @ 16 fromArray: #(
-                (Cursor extent: 16@16 fromArray: #(
                 2r000000100000000
                 2r000001110000000
                 2r000011111000000
                 2r000111111100000
                 2r000000100000000
                 2r000000100000000
                 2r000000100000000
                 2r000000100000000
                 2r000000100000000
                 2r000000100000000
                 2r000111111100000
                 2r000011111000000
                 2r000001110000000
                 2r000000100000000
                 2r000000000000000)
+        offset: -7 @ -7) withMask!
-        offset: -7@-7) withMask!

Item was changed:
  ----- Method: Cursor class>>initResizeTopLeft (in category 'class initialization') -----
  initResizeTopLeft
 
         ResizeTopLeftCursor :=
+                (Cursor extent: 16 @ 16 fromArray: #(
-                (Cursor extent: 16@16 fromArray: #(
                 2r0000000000000000
                 2r0111110000000000
                 2r0111100000000000
                 2r0111000000000000
                 2r0110100000000000
                 2r0100010000000000
                 2r0000001000000000
                 2r0000000100000000
                 2r0000000010000000
                 2r0000000001000100
                 2r0000000000101100
                 2r0000000000011100
                 2r0000000000111100
                 2r0000000001111100
                 2r0000000000000000
                 2r0000000000000000)
+        offset: -7 @ -7) withMask!
-        offset: -7@-7) withMask!

Item was changed:
  ----- Method: Cursor class>>initResizeTopRight (in category 'class initialization') -----
  initResizeTopRight
 
         ResizeTopRightCursor :=
+                (Cursor extent: 16 @ 16 fromArray: #(
-                (Cursor extent: 16@16 fromArray: #(
                 2r0000000000000000
                 2r0000000001111100
                 2r0000000000111100
                 2r0000000000011100
                 2r0000000000101100
                 2r0000000001000100
                 2r0000000010000000
                 2r0000000100000000
                 2r0000001000000000
                 2r0100010000000000
                 2r0110100000000000
                 2r0111000000000000
                 2r0111100000000000
                 2r0111110000000000
                 2r0000000000000000
                 2r0000000000000000)
+        offset: -7 @ -7) withMask!
-        offset: -7@-7) withMask!

Item was changed:
  ----- Method: Cursor class>>initRightArrow (in category 'class initialization') -----
  initRightArrow
 
  RightArrowCursor  :=
       (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r100000000000
  2r111000000000
  2r1111111110000000
  2r111000000000
  2r100000000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: 0 @ 0).
- offset: 0@0).
 
  "Cursor initRightArrow"!

Item was changed:
  ----- Method: Cursor class>>initSquare (in category 'class initialization') -----
  initSquare
 
  SquareCursor :=
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0000001111000000
  2r0000001111000000
  2r0000001111000000
  2r0000001111000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: -8 @ -8).
- offset: -8@-8).
 
  !

Item was changed:
  ----- Method: Cursor class>>initTopLeft (in category 'class initialization') -----
  initTopLeft
  TopLeftCursor :=
+ (Cursor extent: 16 @ 16
- (Cursor extent: 16@16
  fromArray: #(
  2r1111111111111111
  2r1111111111111111
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000
  2r1100000000000000)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initTopRight (in category 'class initialization') -----
  initTopRight
  TopRightCursor :=
+ (Cursor extent: 16 @ 16
- (Cursor extent: 16@16
  fromArray: #(
  2r1111111111111111
  2r1111111111111111
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011
  2r0000000000000011)
+ offset: -16 @ 0).
- offset: -16@0).
  !

Item was changed:
  ----- Method: Cursor class>>initUp (in category 'class initialization') -----
  initUp
 
  UpCursor :=
     (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r11000000000000
  2r111100000000000
  2r1111110000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r11000000000000
  2r0
  2r0
  2r0
  2r0
  2r0
  2r0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initWait (in category 'class initialization') -----
  initWait
 
  WaitCursor :=
   (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1111111111111100
  2r1000000000000100
  2r0100000000001000
  2r0010000000010000
  2r0001110011100000
  2r0000111111000000
  2r0000011110000000
  2r0000011110000000
  2r0000100101000000
  2r0001000100100000
  2r0010000110010000
  2r0100001111001000
  2r1000111111110100
  2r1111111111111100
  0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initWrite (in category 'class initialization') -----
  initWrite
 
  WriteCursor := (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r0000000000011000
  2r0000000000111100
  2r0000000001001000
  2r0000000010010000
  2r0000000100100000
  2r0000001001000100
  2r0000010010000100
  2r0000100100001100
  2r0001001000010000
  2r0010010000010000
  2r0111100000001000
  2r0101000011111000
  2r1110000110000000
  2r0111111100000000
  2r0
  2r0)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Cursor class>>initXeq (in category 'class initialization') -----
  initXeq
 
  XeqCursor :=
  (Cursor
+ extent: 16 @ 16
- extent: 16@16
  fromArray: #(
  2r1000000000010000
  2r1100000000010000
  2r1110000000111000
  2r1111000111111111
  2r1111100011000110
  2r1111110001000100
  2r1111111001111100
  2r1111000001101100
  2r1101100011000110
  2r1001100010000010
  2r0000110000000000
  2r0000110000000000
  2r0000011000000000
  2r0000011000000000
  2r0000001100000000
  2r0000001100000000)
+ offset: 0 @ 0).
- offset: 0@0).
  !

Item was changed:
  ----- Method: Form class>>toothpaste: (in category 'examples') -----
  toothpaste: diam "Display restoreAfter: [Form toothpaste: 30]"
  "Draws wormlike lines by laying down images of spheres.
  See Ken Knowlton, Computer Graphics, vol. 15 no. 4 p352.
  Draw with mouse button down; terminate by option-click."
  | facade ball filter point queue port color q colors colr colr2 |
  colors := Display depth = 1
  ifTrue: [Array with: Color black]
  ifFalse: [Color red wheel: 12].
+ facade := Form extent: diam@diam offset: (diam // -2) asPoint.
- facade := Form extent: diam@diam offset: (diam//-2) asPoint.
  (Form dotOfSize: diam) displayOn: facade
+ at: (diam // 2) asPoint clippingBox: facade boundingBox
- at: (diam//2) asPoint clippingBox: facade boundingBox
  rule: Form under fillColor: Color white.
  #(1 2 3) do:
  [:x |  "simulate facade by circles of gray"
+ (Form dotOfSize: x * diam // 5) displayOn: facade
+ at: (diam * 2 // 5) asPoint clippingBox: facade boundingBox
- (Form dotOfSize: x*diam//5) displayOn: facade
- at: (diam*2//5) asPoint clippingBox: facade boundingBox
  rule: Form under
  fillColor: (Color perform:
  (#(black gray lightGray) at: x)).
  "facade displayAt: 50*x@50"].
  ball := Form dotOfSize: diam.
  color := 8.
  [ true ] whileTrue:
  [port := BitBlt current toForm: Display.
  "Expand 1-bit forms to any pixel depth"
  port colorMap: (Bitmap with: 0 with: 16rFFFFFFFF).
  queue := OrderedCollection new: 32.
+ 16 timesRepeat: [queue addLast: -20 @ -20].
- 16 timesRepeat: [queue addLast: -20@-20].
  Sensor waitButton.
  Sensor yellowButtonPressed ifTrue: [^ self].
  filter := Sensor cursorPoint.
  colr := colors atWrap: (color := color + 5).  "choose increment relatively prime to colors size"
  colr2 := colr alphaMixed: 0.3 with: Color white.
  [Sensor redButtonPressed or: [queue size > 0]] whileTrue:
+ [filter := filter * 4 + Sensor cursorPoint  //  5.
- [filter := filter * 4 + Sensor cursorPoint // 5.
  point := Sensor redButtonPressed
+ ifTrue: [filter] ifFalse: [-20 @ -20].
- ifTrue: [filter] ifFalse: [-20@-20].
  port copyForm: ball to: point rule: Form paint fillColor: colr.
  (q := queue removeFirst) == nil ifTrue: [^ self]. "exit"
  Display depth = 1
  ifTrue: [port copyForm: facade to: q rule: Form erase]
  ifFalse: [port copyForm: facade to: q rule: Form paint fillColor: colr2].
  Sensor redButtonPressed ifTrue: [queue addLast: point]]].
  !

Item was changed:
  ----- Method: Form class>>xorHack: (in category 'examples') -----
  xorHack: size  "Display restoreAfter: [Form xorHack: 256]"
  "Draw a smiley face or stick figure, and end with option-click.
  Thereafter image gets 'processed' as long as you have button down.
  If you stop at just the right time, you'll see you figure upside down,
  and at the end of a full cycle, you'll see it perfectly restored.
  Dude -- this works in color too!!"
  | rect form i bb |
+ rect := 5 @ 5 extent: size @ size.
- rect := 5@5 extent: size@size.
  Display fillWhite: rect; border: (rect expandBy: 2) width: 2.
+ Display border: (rect topRight - (0 @ 2) extent: rect extent * 2 + 4) width: 2.
- Display border: (rect topRight - (0@2) extent: rect extent*2 + 4) width: 2.
  Form exampleSketch.
  form := Form fromDisplay: rect.
  bb := form boundingBox.
  i := 0.
  [Sensor yellowButtonPressed] whileFalse:
  [[Sensor redButtonPressed] whileTrue:
  [i := i + 1.
+ (Array with: 0 @ 1 with: 0 @ -1 with: 1 @ 0 with: -1 @ 0) do:
- (Array with: 0@1 with: 0@-1 with: 1@0 with: -1@0) do:
  [:d | form copyBits: bb from: form at: d
  clippingBox: bb rule: Form reverse fillColor: nil].
  form displayAt: rect topLeft.
  i+2\\size < 4 ifTrue: [(Delay forMilliseconds: 300) wait]].
+ (form magnify: form boundingBox by: 2 @ 2) displayAt: rect topRight + (2 @ 0).
- (form magnify: form boundingBox by: 2@2) displayAt: rect topRight + (2@0).
  Sensor waitButton].!