-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from hpi-swa-teaching/feature/71-jpg-import.b.b
Add JPEG Import
- Loading branch information
Showing
46 changed files
with
130 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ge/M2Backend.class/instance/importPNG..st → .../M2Backend.class/instance/importImage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
tool selection | ||
importPNG: aFileName | ||
importImage: aFileName | ||
| tempForm | | ||
self switchMode. | ||
tempForm := (Form fromFileNamed: aFileName). | ||
self form setExtent: (tempForm extent) depth: tempForm depth. | ||
self project: tempForm at: 0 asPoint. | ||
self form setExtent: (tempForm extent) depth: self defaultDepth. | ||
self paint: tempForm at: 0 asPoint. | ||
self | ||
formChanged; | ||
pushNewUndoLevelWithForm: self copyForm. "add an empty User Action to simulate importPNG being one" | ||
pushNewUndoLevelWithForm: self copyForm. "add an empty User Action to simulate importImage being one" | ||
self viewPort refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
packages/SketchMorph2-Core.package/M2Canvas.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
{ | ||
"class" : { | ||
"defaultCanvasSize" : " 6/28/2021 21:03:28", | ||
"newWith:ofSize:" : " 6/28/2021 21:03:28" }, | ||
"defaultCanvasSize" : "6/28/2021 21:03:28", | ||
"newWith:ofSize:" : "6/28/2021 21:03:28" }, | ||
"instance" : { | ||
"addGripMorph:" : "JP 5/19/2021 00:31", | ||
"backend" : "mk 7/27/2020 20:43", | ||
"extent:" : "wr 6/22/2020 16:26", | ||
"fastFramingOn" : "JP 5/19/2021 00:17", | ||
"gripMorph" : "CS 5/16/2021 20:20", | ||
"gripMorph:" : "CS 5/16/2021 20:21", | ||
"handlesKeyboard:" : " 6/28/2021 21:03:28", | ||
"handlesKeyboard:" : "6/28/2021 21:03:28", | ||
"handlesMouseDown:" : "mp 5/17/2020 11:53", | ||
"handlesMouseMove:" : "mp 5/17/2020 11:52", | ||
"handlesMouseOver:" : "mFr 6/11/2021 15:31", | ||
"handlesMouseOverDragging:" : "mp 5/17/2020 11:52", | ||
"handlesMouseWheel:" : " 6/28/2021 21:03:28", | ||
"handlesMouseWheel:" : "6/28/2021 21:03:28", | ||
"initialize" : "CS 6/2/2021 14:41", | ||
"isControlKeyEvent:" : " 6/28/2021 21:03:28", | ||
"isCtrlPressed" : " 6/28/2021 21:03:28", | ||
"isCtrlPressed:" : " 6/28/2021 21:03:28", | ||
"isControlKeyEvent:" : "6/28/2021 21:03:28", | ||
"isCtrlPressed" : "6/28/2021 21:03:28", | ||
"isCtrlPressed:" : "6/28/2021 21:03:28", | ||
"isMouseDown:" : "NC 5/16/2020 13:16", | ||
"keyDown:" : " 6/28/2021 21:03:28", | ||
"keyUp:" : " 6/28/2021 21:03:28", | ||
"keyDown:" : "6/28/2021 21:03:28", | ||
"keyUp:" : "6/28/2021 21:03:28", | ||
"maximumSize" : "CS 5/19/2021 19:50", | ||
"mouseDown:" : "mk 7/3/2020 18:38", | ||
"mouseEnterDragging:" : "mp 7/27/2020 16:58", | ||
"mouseLeave:" : "JP 6/26/2021 18:18", | ||
"mouseLeaveDragging:" : "mFr 6/11/2021 14:36", | ||
"mouseMove:" : "CS 6/28/2021 21:31", | ||
"mouseUp:" : "mk 7/3/2020 19:27", | ||
"mouseWheel:" : " 6/28/2021 21:03:28", | ||
"mouseWheel:" : "6/28/2021 21:03:28", | ||
"relativeMousePosition:" : "mp 5/15/2020 12:42", | ||
"setCanvasSize:" : "CS 5/19/2021 19:50", | ||
"updateExtent" : " 6/28/2021 21:03:28", | ||
"updateExtent" : "6/28/2021 21:03:28", | ||
"updateGripMorphPosition" : "CS 5/17/2021 10:50", | ||
"viewPort" : " 6/28/2021 21:03:28", | ||
"viewPort:" : " 6/28/2021 21:03:28", | ||
"zoomDefault" : " 6/28/2021 21:03:28", | ||
"zoomIn" : " 6/28/2021 21:03:28", | ||
"zoomOut" : " 6/28/2021 21:03:28" } } | ||
"viewPort" : "6/28/2021 21:03:28", | ||
"viewPort:" : "6/28/2021 21:03:28", | ||
"zoomDefault" : "6/28/2021 21:03:28", | ||
"zoomIn" : "6/28/2021 21:03:28", | ||
"zoomOut" : "6/28/2021 21:03:28" } } |
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/alphaBlend.at..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
drawing | ||
alphaBlend: aForm at: aPoint | ||
self project: aForm at: aPoint rule: Form blendAlphaScaled |
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/paint.at..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
drawing | ||
paint: aForm at: aPoint | ||
self project: aForm at: aPoint rule: Form paint |
9 changes: 0 additions & 9 deletions
9
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/project.at..st
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/project.at.rule..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
drawing | ||
project: aForm at: aPoint rule: aCombinationRule | ||
self form | ||
copyBits: (0 asPoint corner: aForm extent) | ||
from: aForm | ||
at: aPoint | ||
clippingBox: (0 asPoint corner: self form extent) | ||
rule: aCombinationRule | ||
fillColor: nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/SketchMorph2-Core.package/M2ImportImage.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
M2ImportImage is an M2IconMenuItem used to invoke the functionality to import an image. |
2 changes: 1 addition & 1 deletion
2
...M2ImportPNG.class/class/actionSelector.st → ...ImportImage.class/class/actionSelector.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
accessing | ||
actionSelector | ||
^ #importPNG | ||
^ #importImage |
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2ImportImage.class/class/label.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
label | ||
^ 'Import Image' |
4 changes: 2 additions & 2 deletions
4
...e/M2ImportPNG.class/methodProperties.json → ...M2ImportImage.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"class" : { | ||
"actionSelector" : "mFr 5/19/2021 12:32", | ||
"actionSelector" : "mFr 6/3/2021 21:16", | ||
"icon" : "mFr 5/19/2021 10:50", | ||
"isActivatable" : "mFr 5/19/2021 12:32", | ||
"label" : "mFr 5/19/2021 12:32" }, | ||
"label" : "mFr 6/3/2021 21:19" }, | ||
"instance" : { | ||
} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/SketchMorph2-Core.package/M2ImportPNG.class/class/label.st
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/MorphicMonet.class/class/allowedFileExtensions.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defaults | ||
allowedFileExtensions | ||
^ {'png' . 'jpg' . 'jpeg'} |
2 changes: 1 addition & 1 deletion
2
packages/SketchMorph2-Core.package/MorphicMonet.class/instance/getNameOfFileToImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
accessing | ||
getNameOfFileToImport | ||
^ FileChooserDialog openOn: FileDirectory default suffixList: {'png'} label: 'Import PNG' | ||
^ FileChooserDialog openOn: FileDirectory default suffixList: self class allowedFileExtensions label: 'Import Image' |
4 changes: 2 additions & 2 deletions
4
...MorphicMonet.class/instance/importPNG..st → ...rphicMonet.class/instance/importImage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../MorphicMonet.class/instance/importPNG.st → ...orphicMonet.class/instance/importImage.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
accessing | ||
importPNG | ||
importImage | ||
| fileName | | ||
fileName := self getNameOfFileToImport. | ||
fileName ifNotNil: [self importPNG: fileName] | ||
fileName ifNotNil: [self importImage: fileName] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/SketchMorph2-Core.package/MorphicMonet.class/instance/pasteClipboard.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
event handling | ||
pasteClipboard | ||
self viewPort isInEditingTextMode ifTrue: [^ self]. | ||
self importPNG: Clipboard clipboardText asString. | ||
self importImage: Clipboard clipboardText asString. | ||
self canvas changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/SketchMorph2-Tests.package/M2BackendMock.class/instance/importImage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
importImage: aString | ||
super importImage: aString. | ||
self lastCalledMethod: #importImage: |
4 changes: 0 additions & 4 deletions
4
packages/SketchMorph2-Tests.package/M2BackendMock.class/instance/importPNG..st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/SketchMorph2-Tests.package/M2DrawingComponentTests.class/class/importTestJPEG.st
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...s/SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/importTestJPEGPath.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
support | ||
importTestJPEGPath | ||
^ self fileDirectory pathName, FileDirectory slash, 'importTestJPEG.jpeg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...hMorph2-Tests.package/M2DrawingComponentTests.class/instance/testCachedFormAfterImport.st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...ph2-Tests.package/M2DrawingComponentTests.class/instance/testCachedFormAfterJPEGImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing | ||
testCachedFormAfterJPEGImport | ||
self backend importImage: self importTestJPEGPath. | ||
self compare: self backend cachedForm with: #importTestJPEG |
4 changes: 4 additions & 0 deletions
4
...rph2-Tests.package/M2DrawingComponentTests.class/instance/testCachedFormAfterPNGImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing | ||
testCachedFormAfterPNGImport | ||
self backend importImage: self importTestPNGPath. | ||
self compare: self backend cachedForm with: #importTestPNG |
4 changes: 0 additions & 4 deletions
4
...SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/testCompareImportPNG.st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...tchMorph2-Tests.package/M2DrawingComponentTests.class/instance/testFormAfterJPEGImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing | ||
testFormAfterJPEGImport | ||
self backend importImage: self importTestJPEGPath. | ||
self compareBackendFormWith: #importTestJPEG |
4 changes: 4 additions & 0 deletions
4
...etchMorph2-Tests.package/M2DrawingComponentTests.class/instance/testFormAfterPNGImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing | ||
testFormAfterPNGImport | ||
self backend importImage: self importTestPNGPath. | ||
self compareBackendFormWith: #importTestPNG |
2 changes: 1 addition & 1 deletion
2
.../SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/testUndoAfterImport.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
testing | ||
testUndoAfterImport | ||
self backend importPNG: self importTestPNGPath. | ||
self backend importImage: self importTestPNGPath. | ||
self drawFrom: 10 asPoint To: 20 asPoint. | ||
self backend undo. | ||
self compareBackendFormWith: #importTestPNG |
Oops, something went wrong.