Etoys: Morphic-kfr.98.mcz

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

Etoys: Morphic-kfr.98.mcz

commits-2
Karl Ramberg uploaded a new version of Morphic to project Etoys:
http://source.squeak.org/etoys/Morphic-kfr.98.mcz

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

Name: Morphic-kfr.98
Author: kfr
Time: 4 December 2012, 9:59:36 pm
UUID: 500d78fb-6101-e74c-b9e3-4b005d6a5c31
Ancestors: Morphic-kfr.97

Remove instance variable 'filters' and use properties instead

=============== Diff against Morphic-kfr.97 ===============

Item was changed:
  Morph subclass: #SketchMorph
+ instanceVariableNames: 'originalForm rotationStyle scalePoint framesToDwell rotatedForm'
- instanceVariableNames: 'originalForm rotationStyle scalePoint framesToDwell rotatedForm filters'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Basic'!
 
  !SketchMorph commentStamp: 'kfr. 11/7/2011 11:32' prior: 0!
  SketchMorph commentStamp: '<historical>' prior: 0!!
  The morph that results when the user draws a color bitmap using the PaintBox (SketchEditorMorph and PaintBoxMorph).
 
  forwardDirection is the angle at which the object will go forward.  When the rotationStyle is not #normal, then forwardDirection is any angle, while the rotation is highly restricted.  If flexed, this is remembered by the Transform morph.  For non-normal rotationStyle, it is rotationDegrees.
 
  setupAngle (a property) is where the user put the green arrow to indicate which direction on the picture is forward.  When #normal, draw the morph initially at (0.0 - setupAngle).  The enclosing TransformationMorph then rotates it to the true angle.
 
  rotationDegrees  In a #normal object, rotationDegrees is constant an equal to setupAngle.
  For non-normal, it is the direction the object is going.
 
  When repainting, set it back to its original state. The green arrow is set to setupAngle, and the sketch is shown as drawn originally (rotationDegrees = 0).
 
  rotationStyle = normal (turns), leftRight, upDown, fixed.
  When leftRight upDown or fixed, bit map has severe restrictions.
  !

Item was changed:
  ----- Method: SketchMorph>>filters (in category 'filters') -----
  filters
+ ^ self valueOfProperty: #filters ifAbsent:
+ [self setProperty: #filters toValue: OrderedCollection new.]!
- ^ filters
- ifNil: [filters := OrderedCollection new]!

Item was changed:
  ----- Method: SketchMorph>>filtersAdd: (in category 'filters') -----
  filtersAdd: aFilterWithValue
  self filters
  do: [:i | (i includes: aFilterWithValue first)
+ ifTrue: [self filters remove: i]].
+ self filters add: aFilterWithValue.
- ifTrue: [filters remove: i]].
- filters add: aFilterWithValue.
  self layoutChanged!

Item was changed:
  ----- Method: SketchMorph>>generateRotatedForm (in category 'drawing') -----
  generateRotatedForm
  | scalePt smoothPix pair filteredForm |
  scalePoint
  ifNil: [scalePoint := 1 @ 1].
  scalePt := scalePoint x abs @ scalePoint y abs.
  rotationStyle == #none
  ifTrue: [scalePt := 1 @ 1].
  smoothPix := 1.
  rotationStyle = #leftRight
  ifTrue: [self heading asSmallAngleDegrees < 0.0
  ifTrue: [scalePt := scalePt x negated @ scalePt y]].
  rotationStyle = #upDown
  ifTrue: [self heading asSmallAngleDegrees abs > 90.0
  ifTrue: [scalePt := scalePt x @ scalePt y negated]].
  filteredForm := originalForm copy.
+ self filters
+ ifNotNil: [self filters
- filters
- ifNotNil: [filters
  do: [:filter | filteredForm := self
  perform: filter first
  withArguments: (filter allButFirst copyWith: filteredForm)]].
  rotatedForm := (scalePt = (1 @ 1)
+ and: [self filters isNil])
- and: [filters isNil])
  ifTrue: [originalForm]
  ifFalse: [((rotationStyle == #normal
  and: [self useInterpolation])
+ and: [self filters isNil])
- and: [filters isNil])
  ifTrue: [^ self generateInterpolatedForm].
  pair := WarpBlt current
  rotate: filteredForm
  degrees: 0
  center: originalForm boundingBox center
  scaleBy: scalePt
  smoothing: smoothPix.
  pair first]!

Item was changed:
  ----- Method: SketchMorph>>removeFilters (in category 'filters') -----
  removeFilters
+ self removeProperty: #filters.
- filters := nil.
  self layoutChanged!

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev