diff --git a/GMTEIcons/redo.png b/GMTEIcons/redo.png index 28d411a4..e39b6c33 100644 Binary files a/GMTEIcons/redo.png and b/GMTEIcons/redo.png differ diff --git a/GMTEIcons/undo.png b/GMTEIcons/undo.png index facd074b..7e81921b 100644 Binary files a/GMTEIcons/undo.png and b/GMTEIcons/undo.png differ diff --git a/source/GM-TE/GMTEBrush.class.st b/source/GM-TE/GMTEBrush.class.st index 95036485..ee4ac87e 100644 --- a/source/GM-TE/GMTEBrush.class.st +++ b/source/GM-TE/GMTEBrush.class.st @@ -145,6 +145,61 @@ GMTEBrush >> layer: anObject [ layer := anObject ] +{ + #category : #forms, + #'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:53' +} +GMTEBrush >> lineBrush [ + | radius collection start end deltaX deltaY stepX stepY error error2 x y offsets | + + radius := self radius - 1. + self resetOutputSet. + self flag: 'todo: method extraction'. + "Helper method to generate radius offsets" + offsets := OrderedCollection new. + (0-radius to: radius) do: [:dx | + (0-radius to: radius) do: [:dy | + (dx * dx + dy * dy <= (radius * radius)) ifTrue: [ + offsets add: dx @ dy. + ]. + ]. + ]. + + self resetOutputSet. + (self currentMatrixIndex isNil or: [self firstMatrixIndex isNil]) ifTrue: [^nil]. + + start := self firstMatrixIndex. + end := self currentMatrixIndex. + deltaX := (end x - start x) abs. + deltaY := (end y - start y) abs. + stepX := (start x < end x) ifTrue: [1] ifFalse: [-1]. + stepY := (start y < end y) ifTrue: [1] ifFalse: [-1]. + error := deltaX - deltaY. + x := start x. + y := start y. + + collection := OrderedCollection new. + + [ + | point | + point := x @ y. + offsets do: [:offset | collection add: (point + offset)]. + (x = end x and: [y = end y]) ifTrue: [ + self outputSet: collection asSet. + ^ self outputSet.]. + error2 := 2 * error. + (error2 > (0 - deltaY)) ifTrue: [ + error := error - deltaY. + x := x + stepX. + ]. + (error2 < deltaX) ifTrue: [ + error := error + deltaX. + y := y + stepY. + ]. + ] repeat. + +] + { #category : #accessing, #'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 21:18' @@ -255,6 +310,15 @@ GMTEBrush >> selectFillBrush [ self currentBrush: [self fillBrush] ] +{ + #category : #select, + #'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:27' +} +GMTEBrush >> selectLineBrush [ + + self currentBrush: [self lineBrush] +] + { #category : #select, #'squeak_changestamp' : 'TW 7/9/2024 19:18' diff --git a/source/GM-TE/GMTEEditor.class.st b/source/GM-TE/GMTEEditor.class.st index 93ef3c13..3af3f074 100644 --- a/source/GM-TE/GMTEEditor.class.st +++ b/source/GM-TE/GMTEEditor.class.st @@ -1237,7 +1237,7 @@ GMTEEditor >> initialize [ { #category : #initialization, - #'squeak_changestamp' : 'TW 7/9/2024 19:42' + #'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:40' } GMTEEditor >> initializeBrush [ "starts the tile editor" @@ -1246,7 +1246,7 @@ GMTEEditor >> initializeBrush [ brush: GMTEBrush new; selectRadiusBrush; initializeBrushButton; - setBrushRadius: 0 + setBrushRadius: 1 ] {