[etoys-dev] Etoys: Morphic-kfr.97.mcz
karl ramberg
karlramberg at gmail.com
Tue Dec 4 07:48:01 EST 2012
Hi
I found a issue with the filter implementation that I'm looking for a
solution for.
Once a filter is added in a ScriptEditor it will not remove it self from
the SketchMorph before a removeFilter is sent.
So if the filter is pulled out of the ScriptEditor it is still active.
Karl
On Thu, Oct 25, 2012 at 7:35 PM, Bert Freudenberg <bert at freudenbergs.de>wrote:
> That looks nice! Thank you :)
>
> - Bert -
>
> On 25.10.2012, at 05:57, commits at source.squeak.org wrote:
>
> > Karl Ramberg uploaded a new version of Morphic to project Etoys:
> > http://source.squeak.org/etoys/Morphic-kfr.97.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Morphic-kfr.97
> > Author: kfr
> > Time: 25 October 2012, 7:56:46 am
> > UUID: 6d5a2911-44d6-824d-90f4-59b32c1c8a03
> > Ancestors: Morphic-kfr.96
> >
> > Add Etoy interfaces to ScratchPlugin picture manipulation methods
> > http://tracker.squeakland.org/browse/SQ-996
> >
> > =============== Diff against Morphic-kfr.96 ===============
> >
> > Item was changed:
> > Morph subclass: #SketchMorph
> > + instanceVariableNames: 'originalForm rotationStyle scalePoint
> framesToDwell rotatedForm filters'
> > - instanceVariableNames: 'originalForm rotationStyle scalePoint
> framesToDwell rotatedForm'
> > 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).
> > - !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.
> > - 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).
> > - 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.
> > - rotationStyle = normal (turns), leftRight, upDown, fixed.
> > When leftRight upDown or fixed, bit map has severe restrictions.
> > !
> >
> > Item was added:
> > + ----- Method: SketchMorph>>blur:form: (in category 'filters') -----
> > + blur: aWidth form: filteredForm
> > + | f fOut fWidth |
> > + aWidth = 0 ifTrue:[^ filteredForm].
> > + f := filteredForm asFormOfDepth: 32.
> > + fWidth := f width + (aWidth - 1) max: f width.
> > + fOut := f deepCopy.
> > + ScratchPlugin
> > + primBlur: f bits
> > + into: fOut bits
> > + width: fWidth.
> > + ^ fOut asFormOfDepth: 16!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>brightnessShift:form: (in category
> 'filters') -----
> > + brightnessShift: aShift form: filteredForm
> > + | f fOut shift |
> > + aShift = 0 ifTrue:[^ filteredForm].
> > + shift := aShift min: 100 max: -100.
> > + f := filteredForm asFormOfDepth: 32.
> > + fOut := f deepCopy.
> > + ScratchPlugin
> > + primShiftBrightness: f bits
> > + into: fOut bits
> > + by: shift.
> > + ^ fOut asFormOfDepth: 16!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>filters (in category 'filters') -----
> > + filters
> > + ^ filters
> > + ifNil: [filters := OrderedCollection new]!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>filtersAdd: (in category 'filters') -----
> > + filtersAdd: aFilterWithValue
> > + self filters
> > + do: [:i | (i includes: aFilterWithValue first)
> > + ifTrue: [filters remove: i]].
> > + filters add: aFilterWithValue.
> > + self layoutChanged!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>fishEye:form: (in category 'filters') -----
> > + fishEye: aPower form: aForm
> > + | f fOut power |
> > + aPower = 0 ifTrue:[^aForm].
> > + power := (100 + (aPower * 10)) max:0.
> > + f := aForm asFormOfDepth: 32.
> > + fOut := f deepCopy.
> > + ScratchPlugin primFisheye: f bits into: fOut bits width: f width
> power: power.
> > + ^fOut asFormOfDepth: 16!
> >
> > Item was changed:
> > ----- Method: SketchMorph>>generateRotatedForm (in category 'drawing')
> -----
> > generateRotatedForm
> > + | scalePt smoothPix pair filteredForm |
> > + scalePoint
> > + ifNil: [scalePoint := 1 @ 1].
> > - "Compute my rotatedForm and offsetWhenRotated."
> > -
> > - | scalePt smoothPix pair |
> > - scalePoint ifNil: [scalePoint := 1 @ 1].
> > scalePt := scalePoint x abs @ scalePoint y abs.
> > + rotationStyle == #none
> > + ifTrue: [scalePt := 1 @ 1].
> > - rotationStyle == #none ifTrue: [scalePt := 1 @ 1].
> > - "smoothPix := (scalePt x < 1.0 or: [scalePt y < 1.0])
> > - ifTrue: [2]
> > - ifFalse: [1]."
> > smoothPix := 1.
> > + rotationStyle = #leftRight
> > + ifTrue: [self heading asSmallAngleDegrees < 0.0
> > - rotationStyle = #leftRight
> > - ifTrue:
> > - [self heading asSmallAngleDegrees < 0.0
> > ifTrue: [scalePt := scalePt x negated @
> scalePt y]].
> > + rotationStyle = #upDown
> > + ifTrue: [self heading asSmallAngleDegrees abs > 90.0
> > - rotationStyle = #upDown
> > - ifTrue:
> > - [self heading asSmallAngleDegrees abs > 90.0
> > ifTrue: [scalePt := scalePt x @ scalePt y
> negated]].
> > + filteredForm := originalForm copy.
> > + filters
> > + ifNotNil: [filters
> > + do: [:filter | filteredForm := self
> > + perform:
> filter first
> > +
> withArguments: (filter allButFirst copyWith: filteredForm)]].
> > + rotatedForm := (scalePt = (1 @ 1)
> > + and: [filters isNil])
> > - rotatedForm := scalePt = (1 @ 1)
> > ifTrue: [originalForm]
> > + ifFalse: [((rotationStyle == #normal
> > + and: [self
> useInterpolation])
> > + and: [filters
> isNil])
> > + ifTrue: [^ self
> generateInterpolatedForm].
> > + pair := WarpBlt current
> > + rotate:
> filteredForm
> > - ifFalse:
> > - ["ar 11/19/2001: I am uncertain
> what happens in the case of rotationStyle ~~ normal"
> > -
> > - (rotationStyle == #normal and:
> [self useInterpolation])
> > - ifTrue: [^self
> generateInterpolatedForm].
> > - pair := WarpBlt current
> > - rotate:
> originalForm
> > degrees: 0
> > center:
> originalForm boundingBox center
> > scaleBy:
> scalePt
> > smoothing:
> smoothPix.
> > pair first]!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>hueShift:form: (in category 'filters') -----
> > + hueShift: aShift form: filteredForm
> > + | f fOut shift |
> > + aShift = 0 ifTrue:[^ filteredForm].
> > + shift := aShift min: 180 max: -180.
> > + f := filteredForm asFormOfDepth: 32.
> > + fOut := f deepCopy.
> > + ScratchPlugin
> > + primShiftHue: f bits
> > + into: fOut bits
> > + byDegrees: shift.
> > + ^ fOut asFormOfDepth: 16!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>removeFilters (in category 'filters') -----
> > + removeFilters
> > + filters := nil.
> > + self layoutChanged!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>saturationShift:form: (in category
> 'filters') -----
> > + saturationShift: aShift form: filteredForm
> > + | f fOut shift |
> > + aShift = 0 ifTrue:[^ filteredForm].
> > + shift := aShift min: 100 max: -100.
> > + f := filteredForm asFormOfDepth: 32.
> > + fOut := f deepCopy.
> > + ScratchPlugin
> > + primShiftSaturation: f bits
> > + into: fOut bits
> > + by: shift.
> > + ^ fOut asFormOfDepth: 16!
> >
> > Item was added:
> > + ----- Method: SketchMorph>>whirl:form: (in category 'filters') -----
> > + whirl: anAngle form: aForm
> > + | f fOut |
> > + anAngle = 0 ifTrue:[^aForm].
> > +
> > + f := aForm asFormOfDepth: 32.
> > + fOut := f deepCopy.
> > + ScratchPlugin primWhirl: f bits into: fOut bits width: f width
> angle: anAngle.
> > + ^fOut asFormOfDepth: 16!
> >
> > _______________________________________________
> > etoys-dev mailing list
> > etoys-dev at squeakland.org
> > http://lists.squeakland.org/mailman/listinfo/etoys-dev
>
> _______________________________________________
> etoys-dev mailing list
> etoys-dev at squeakland.org
> http://lists.squeakland.org/mailman/listinfo/etoys-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20121204/886f0c74/attachment-0001.html>
More information about the etoys-dev
mailing list