ImageEditView.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Feb 2017 17:49:18 +0100
changeset 5491 a78da5678d29
parent 5485 fa049861df83
child 5492 f3e1ee8eaf5a
permissions -rw-r--r--
#REFACTORING by cg class: ImageEditView class definition added: #askForSpecialOperation #cropSubImageAt: #performSpecialOperation:on:withColor: #specialOperation:on:withColor: removed: #performSpecialOperationOn:withColor: changed: #initialize #specialOperationAt:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
636
d53428252193 revised version
tz
parents: 633
diff changeset
     1
"
704
01140e14c065 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 694
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
     3
	      All Rights Reserved
636
d53428252193 revised version
tz
parents: 633
diff changeset
     4
d53428252193 revised version
tz
parents: 633
diff changeset
     5
 This software is furnished under a license and may be used
d53428252193 revised version
tz
parents: 633
diff changeset
     6
 only in accordance with the terms of that license and with the
d53428252193 revised version
tz
parents: 633
diff changeset
     7
 inclusion of the above copyright notice. This software may not
d53428252193 revised version
tz
parents: 633
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d53428252193 revised version
tz
parents: 633
diff changeset
     9
 other person. No title to or ownership of the software is
d53428252193 revised version
tz
parents: 633
diff changeset
    10
 hereby transferred.
d53428252193 revised version
tz
parents: 633
diff changeset
    11
"
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
    13
4714
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
    14
"{ NameSpace: Smalltalk }"
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
    15
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    16
ImageView subclass:#ImageEditView
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
    17
	instanceVariableNames:'readOnly magnification imageReaderClass resourceClass
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
    18
		resourceSelector mouseKeyColorMode undoImages modifiedHolder
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
    19
		editMode lastPastePoint imageInfoHolder activityInfoHolder
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
    20
		pickedColorHolder drawingColors drawingPixels drawingColorHolders
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
    21
		drawingPixelHolders clickInfoCallBack penWidth sprayProcess
5483
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
    22
		sprayPosition spraySpot drawingAlpha floodFillMaxHueError
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
    23
		floodFillMaxLightError userAllowedToChangeDrawingColor'
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
    24
	classVariableNames:'Clipboard ClipboardMagnified LastMagnification
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    25
		GridMagnificationLimit MaxUndos LastSaveDirectory LastSaveClass
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    26
		EditModePoint EditModeBox EditModeFilledBox EditModeFill
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    27
		EditModeCopy EditModePasteUnder EditModePaste
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
    28
		EditModePasteWithMask EditModeSpecialOperation EditModeSpray
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    29
		EditModeCircle EditModeSmooth EditModeFilledCircle
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    30
		EditModeSpecialOperationCropSubImage EditModeMaskOutsideRect
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    31
		EditModeMaskOutsideCircle'
1035
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    32
	poolDictionaries:''
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    33
	category:'Views-Misc'
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    34
!
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    35
636
d53428252193 revised version
tz
parents: 633
diff changeset
    36
!ImageEditView class methodsFor:'documentation'!
d53428252193 revised version
tz
parents: 633
diff changeset
    37
d53428252193 revised version
tz
parents: 633
diff changeset
    38
copyright
d53428252193 revised version
tz
parents: 633
diff changeset
    39
"
704
01140e14c065 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 694
diff changeset
    40
 COPYRIGHT (c) 1997 by eXept Software AG
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
    41
	      All Rights Reserved
636
d53428252193 revised version
tz
parents: 633
diff changeset
    42
d53428252193 revised version
tz
parents: 633
diff changeset
    43
 This software is furnished under a license and may be used
d53428252193 revised version
tz
parents: 633
diff changeset
    44
 only in accordance with the terms of that license and with the
d53428252193 revised version
tz
parents: 633
diff changeset
    45
 inclusion of the above copyright notice. This software may not
d53428252193 revised version
tz
parents: 633
diff changeset
    46
 be provided or otherwise made available to, or used by, any
d53428252193 revised version
tz
parents: 633
diff changeset
    47
 other person. No title to or ownership of the software is
d53428252193 revised version
tz
parents: 633
diff changeset
    48
 hereby transferred.
d53428252193 revised version
tz
parents: 633
diff changeset
    49
"
d53428252193 revised version
tz
parents: 633
diff changeset
    50
!
d53428252193 revised version
tz
parents: 633
diff changeset
    51
d53428252193 revised version
tz
parents: 633
diff changeset
    52
documentation
d53428252193 revised version
tz
parents: 633
diff changeset
    53
"
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
    54
    An ImageEditView is a view which can be used by applications
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
    55
    like the Image Editor for editing or inspecting (bitmap-) images.
636
d53428252193 revised version
tz
parents: 633
diff changeset
    56
d53428252193 revised version
tz
parents: 633
diff changeset
    57
    [see also:]
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
    58
        ImageEditor Image
636
d53428252193 revised version
tz
parents: 633
diff changeset
    59
d53428252193 revised version
tz
parents: 633
diff changeset
    60
    [author:]
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
    61
        Thomas Zwick
636
d53428252193 revised version
tz
parents: 633
diff changeset
    62
"
d53428252193 revised version
tz
parents: 633
diff changeset
    63
! !
353
0442fc169b82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    64
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    65
!ImageEditView class methodsFor:'initialization'!
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    66
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    67
initialize
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
    68
    MaxUndos := 10.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
    69
    GridMagnificationLimit := 6 @ 6.
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    70
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    71
    EditModePoint := #point.
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    72
    EditModeBox := #box.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
    73
    EditModeCircle := #circle.
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    74
    EditModePaste := #paste.
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    75
    EditModePasteUnder := #pasteUnder.
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    76
    EditModePasteWithMask := #pasteWithMask.
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    77
    EditModeFilledBox := #filledBox.
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    78
    EditModeFilledCircle := #filledCircle.
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    79
    EditModeFill := #fill.
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    80
    EditModeCopy := #copy.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
    81
    EditModeSpray := #spray.
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
    82
    EditModeSmooth := #smooth.
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    83
    EditModeMaskOutsideRect := #maskOutsideRect. 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    84
    EditModeMaskOutsideCircle := #maskOutsideCircle. 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    85
    EditModeSpecialOperation := #specialOperation.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    86
    EditModeSpecialOperationCropSubImage := #specialOperationCropSubImage.
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    87
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    88
    "
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    89
     self initialize
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    90
    "
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    91
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
    92
    "Modified: / 20-02-2017 / 16:54:11 / cg"
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    93
! !
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    94
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    95
!ImageEditView class methodsFor:'accessing'!
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    96
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    97
editModeBox
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    98
    ^ EditModeBox
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
    99
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   100
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   101
editModeCopy
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   102
    ^ EditModeCopy
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   103
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   104
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   105
editModeFill
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   106
    ^ EditModeFill
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   107
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   108
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   109
editModeFilledBox
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   110
    ^ EditModeFilledBox
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   111
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   112
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   113
editModePaste
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   114
    ^ EditModePaste
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   115
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   116
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   117
editModePasteUnder
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   118
    ^ EditModePasteUnder
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   119
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   120
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   121
editModePasteWithMask
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   122
    ^ EditModePasteWithMask
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   123
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   124
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   125
editModePoint
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   126
    ^ EditModePoint
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   127
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   128
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   129
editModeSmooth
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   130
    ^ EditModeSmooth
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   131
!
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   132
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   133
editModeSpecialOperation
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   134
    ^ EditModeSpecialOperation
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   135
!
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   136
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   137
gridMagnificationLimit
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   138
    ^ GridMagnificationLimit
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   139
!
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   140
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   141
gridMagnificationLimit:anInteger
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   142
    GridMagnificationLimit := anInteger
3980
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   143
!
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   144
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   145
lastSaveDirectory
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   146
    ^ LastSaveDirectory
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   147
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   148
    "Created: / 14-12-2010 / 14:49:01 / cg"
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   149
!
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   150
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   151
lastSaveDirectory:aStringOrFilename
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   152
    LastSaveDirectory := aStringOrFilename
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   153
Claus Gittinger <cg@exept.de>
parents: 3972
diff changeset
   154
    "Created: / 14-12-2010 / 14:49:18 / cg"
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   155
! !
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   156
2480
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   157
!ImageEditView class methodsFor:'helpers'!
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   158
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   159
copyImageToClipboard:copiedImage
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   160
    ClipboardMagnified := nil.
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   161
    Clipboard := copiedImage.
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   162
! !
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
   163
2634
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   164
!ImageEditView class methodsFor:'resources'!
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   165
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   166
classResources
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   167
    ^ ImageEditor classResources
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   168
! !
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
   169
7
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
   170
!ImageEditView methodsFor:'accessing'!
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
   171
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   172
activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   173
    "return the value of the instance variable 'activityInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   174
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   175
    ^ activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   176
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   177
    "Created: / 29.7.1998 / 18:49:39 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   178
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   179
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   180
activityInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   181
    "set the value of the instance variable 'activityInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   182
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   183
    activityInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   184
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   185
    "Created: / 29.7.1998 / 18:49:39 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   186
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   187
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   188
clearModified
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   189
    self modified:false
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   190
!
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   191
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   192
clickInfoCallBack:aTwoArgBlock
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   193
     clickInfoCallBack := aTwoArgBlock
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   194
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   195
    "Created: / 10.2.2000 / 23:07:14 / cg"
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   196
!
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   197
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   198
clipBoard
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   199
    |clipboardObject|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   200
    
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   201
    clipboardObject := self getClipboardObject.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   202
    clipboardObject isImage ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   203
        ^ clipboardObject
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   204
    ].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   205
    ^ Clipboard.
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   206
!
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   207
3610
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   208
drawingColorHolders
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   209
    ^ drawingColorHolders
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   210
!
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   211
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   212
drawingColors
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   213
    ^ drawingColorHolders collect:[:each | each value].
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   214
!
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
   215
2009
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   216
drawingColors:anArrayTwoColors
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   217
    (drawingColorHolders at:1) value:(anArrayTwoColors at:1).
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   218
    (drawingColorHolders at:2) value:(anArrayTwoColors at:2).
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   219
!
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
   220
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   221
editMode
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   222
    "is one of the edit modes:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   223
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   224
        EditModePoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   225
        EditModeBox
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   226
        EditModePaste
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   227
        EditModePasteUnder
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   228
        EditModePasteWithMask 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   229
        EditModeFilledBox
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   230
        EditModeFill 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   231
        EditModeCopy 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   232
        EditModeSpecialOperation 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   233
        EditModeSpray 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   234
        EditModeCircle 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   235
        EditModeSmooth 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   236
    "
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   237
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   238
    ^editMode
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   239
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   240
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   241
editMode: anEditModeSymbol
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   242
    "must be one of the edit modes:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   243
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   244
        EditModePoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   245
        EditModeBox
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   246
        EditModePaste
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   247
        EditModePasteUnder
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   248
        EditModePasteWithMask 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   249
        EditModeFilledBox
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   250
        EditModeFill 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   251
        EditModeCopy 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   252
        EditModeSpecialOperation 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   253
        EditModeSpray 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   254
        EditModeCircle 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   255
        EditModeSmooth 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   256
    "
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   257
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   258
    editMode := anEditModeSymbol
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   259
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   260
5483
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   261
floodFillMaxHueError:aFraction
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   262
    floodFillMaxHueError := aFraction.
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   263
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   264
    "Modified (format): / 17-02-2017 / 15:26:59 / cg"
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   265
!
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   266
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   267
floodFillMaxLightError:aFraction
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   268
    floodFillMaxLightError := aFraction.
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   269
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   270
    "Modified (format): / 17-02-2017 / 15:27:03 / cg"
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   271
!
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   272
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   273
image:anImage scroll:doScroll
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   274
    self image:anImage scroll:doScroll invalidate:true
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   275
!
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   276
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   277
image:anImage scroll:doScroll invalidate:doInvalidate
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   278
    |retVal fileName|
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   279
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   280
    anImage isImage ifTrue:[           
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   281
        true "(image isNil or: [self checkModified])" ifTrue: [
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   282
            image notNil ifTrue: [
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   283
                fileName := image fileName.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   284
                anImage fileName isNil ifTrue: [anImage fileName: fileName].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   285
            ].
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   286
            super image:anImage scroll:doScroll invalidate:doInvalidate.
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   287
            retVal := self.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   288
        ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   289
    ] ifFalse: [
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   290
        super image:nil scroll:true invalidate:doInvalidate.
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   291
    ].
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   292
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   293
    "/ self changed:#image.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   294
    image isNil ifTrue:[
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   295
        self clearModified.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   296
    ] ifFalse:[
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   297
        self setModified.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   298
    ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   299
    self updateImageInfo: self imageInfoString. 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   300
    ^ retVal
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   301
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   302
    "Modified: / 10.2.2000 / 23:33:12 / cg"
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   303
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   304
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   305
imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   306
    ^ imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   307
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   308
    "Created: / 29.7.1998 / 18:29:50 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   309
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   310
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   311
imageInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   312
    imageInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   313
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   314
    "Created: / 29.7.1998 / 18:29:50 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   315
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   316
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   317
magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   318
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   319
    ^magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   320
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   321
!
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   322
636
d53428252193 revised version
tz
parents: 633
diff changeset
   323
magnification: aPoint
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   324
    |oldOrg|
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   325
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   326
    magnification ~= aPoint
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   327
    ifTrue:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   328
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   329
	oldOrg := self viewOrigin / magnification.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   330
	magnification := aPoint asPoint.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   331
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   332
	self scrollTo:(oldOrg * magnification) rounded redraw:false.        
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   333
"/        self scrollToTopLeft.
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   334
	self contentsChanged.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   335
	self invalidate.
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   336
	ClipboardMagnified := nil.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   337
    ]
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   338
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   339
    "Modified: / 31.7.1998 / 02:38:47 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   340
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   341
2913
7e07bb5586e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2910
diff changeset
   342
modified
7e07bb5586e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2910
diff changeset
   343
    ^ modifiedHolder value
7e07bb5586e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2910
diff changeset
   344
!
7e07bb5586e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2910
diff changeset
   345
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   346
modified:aBoolean
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   347
    modifiedHolder value:aBoolean
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   348
!
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   349
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   350
modifiedHolder
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   351
    ^ modifiedHolder
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   352
!
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   353
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   354
mouseKeyColorMode
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   355
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   356
    ^mouseKeyColorMode printString
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   357
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   358
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   359
mouseKeyColorMode:aMode
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   360
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   361
    mouseKeyColorMode := aMode
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   362
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   363
3265
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   364
penWidth
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   365
    ^ penWidth ? 1
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   366
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   367
    "Created: / 01-11-2007 / 23:34:49 / cg"
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   368
!
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   369
5405
50dd27514854 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5364
diff changeset
   370
penWidth:anInteger
50dd27514854 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5364
diff changeset
   371
    penWidth := anInteger
3265
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   372
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   373
    "Created: / 01-11-2007 / 23:34:56 / cg"
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   374
!
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   375
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   376
readOnly
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   377
    ^ readOnly
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   378
!
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   379
5405
50dd27514854 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5364
diff changeset
   380
readOnly:aBoolean
50dd27514854 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5364
diff changeset
   381
    readOnly := aBoolean.
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   382
!
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   383
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   384
removelastUndo
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   385
    undoImages removeLast
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   386
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   387
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   388
resourceClass
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   389
    ^ resourceClass
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   390
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   391
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   392
resourceClass: aClassOrClassNameString
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   393
    "support for names will vanish - obsolete left over from tz"
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   394
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   395
    resourceClass := aClassOrClassNameString.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   396
    resourceClass notNil ifTrue:[
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   397
        resourceClass isBehavior ifFalse: [ 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   398
            resourceClass := Smalltalk classNamed:aClassOrClassNameString 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   399
        ]
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   400
    ]
2908
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   401
!
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   402
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   403
resourceClassName
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   404
    resourceClass isNil ifTrue:[^ ''].
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   405
    ^ resourceClass name
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   406
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   407
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   408
resourceMessage
2909
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   409
    (resourceClass isNil or:[resourceSelector isNil]) ifTrue:[^ ''].
2908
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
   410
    ^ resourceClass name, ' ', resourceSelector
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   411
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   412
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   413
resourceSelector
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   414
    ^ resourceSelector
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   415
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   416
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   417
resourceSelector: aStringOrSymbol
2909
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   418
    aStringOrSymbol isNil ifTrue:[
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   419
        resourceSelector := nil
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   420
    ] ifFalse:[
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   421
        resourceSelector := aStringOrSymbol asSymbol
7d6f5d4ba273 some code cleanup
Claus Gittinger <cg@exept.de>
parents: 2908
diff changeset
   422
    ]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   423
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   424
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   425
selectMaskForDrawing
5483
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   426
    image mask isNil ifTrue:[ 
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   427
        Logger warning:'image has no mask'.
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   428
        ^ self.    
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
   429
    ].
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   430
    "/ self selectedColorIndex:1.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   431
    self selectedColor:(Color noColor).
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   432
    self selectedColorIndex:nil.
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   433
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   434
    "Created: / 16-02-2017 / 09:57:40 / cg"
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   435
    "Modified: / 17-02-2017 / 16:30:50 / cg"
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   436
!
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   437
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   438
selectedColor
3730
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   439
    |clr|
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   440
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   441
    clr := (drawingColorHolders at:mouseKeyColorMode) value.
3931
d2a15871d837 changed: #selectedColor
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   442
    clr isNil ifTrue:[ clr := Color black ].
3730
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   443
    image hasAlphaChannel ifTrue:[
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   444
        ^ (TranslucentColor 
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   445
                scaledRed:clr scaledRed
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   446
                scaledGreen:clr scaledGreen
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   447
                scaledBlue:clr scaledBlue)
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   448
                alpha:(drawingAlpha ? 1.0)
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   449
    ].
3f07e7082aff preps for aloha channel
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   450
    ^ clr
3931
d2a15871d837 changed: #selectedColor
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   451
d2a15871d837 changed: #selectedColor
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   452
    "Modified: / 20-09-2010 / 11:34:07 / cg"
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   453
!
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   454
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   455
selectedColor: aColor
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   456
    (drawingColorHolders at:(mouseKeyColorMode min:drawingColorHolders size)) value:aColor
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   457
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   458
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   459
selectedColorIndex
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   460
    ^ (drawingPixelHolders at:mouseKeyColorMode) value
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   461
!
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   462
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   463
selectedColorIndex: aPixelIndex
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   464
    (drawingPixelHolders at:(mouseKeyColorMode min:drawingPixelHolders size)) value: aPixelIndex
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   465
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   466
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   467
setModified
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   468
    self modified:true
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   469
!
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
   470
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   471
spraySpot
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   472
    ^ spraySpot
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   473
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   474
    "Created: / 15-02-2012 / 22:38:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   475
!
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   476
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   477
spraySpot:something
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   478
    spraySpot := something.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   479
!
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   480
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   481
undoImages
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
   482
    ^ undoImages
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   483
!
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   485
userAllowedToChangeDrawingColor:aBoolean
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   486
    "for special applications, whre user is only allowed to draw
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   487
     in the predefined color (eg. expecco)"
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   488
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   489
    userAllowedToChangeDrawingColor := aBoolean
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   490
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   491
    "Created: / 17-02-2017 / 16:24:37 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   492
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   493
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   494
!ImageEditView methodsFor:'drawing'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   495
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   496
drawFrame
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   497
    "draws a black frame around the image's bounds"
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   498
    
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   499
    gc paint:self blackColor.
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   500
    gc lineWidth: (magnification x//3 min: 3).
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   501
    gc displayRectangle: ((0@0) extent:(image extent * magnification) + margin).
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   502
    gc lineWidth:1.
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   503
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   504
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   505
drawFramesIn: aRectangle
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   506
    "draws the pixel frame grid"
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   507
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   508
    |origin lineStartingPoint lineEndingPoint oldColor mX mY|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   509
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   510
    magnification >= GridMagnificationLimit ifTrue: [
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   511
        mX := magnification x.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   512
        mY := magnification y.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   513
        
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   514
        origin := aRectangle origin - 1.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   515
        lineStartingPoint := origin + (0 @ mY).
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   516
        lineEndingPoint   := lineStartingPoint + (aRectangle width@0).
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   517
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   518
        oldColor := gc paint.
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   519
        gc xoring:[
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   520
            gc displayLineFrom: lineStartingPoint to: lineEndingPoint.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   521
            lineStartingPoint x to: lineStartingPoint x + aRectangle width - mX by: mX 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   522
            do:[:x|   
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   523
                gc displayLineFrom: x@(origin y) to: x@(origin y + mY)
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   524
            ].
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   525
        ].
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   526
        gc paint: oldColor.
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   527
    ]
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   528
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   529
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   530
drawPasteRectangleAt: aPoint
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   531
    |currentPoint gridCorrection extent|
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   532
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   533
    magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   534
    currentPoint := aPoint // magnification*magnification + margin. 
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   535
2085
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
   536
    self repairDamage.
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
   537
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   538
    currentPoint ~= lastPastePoint ifTrue:[              
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   539
        ClipboardMagnified isNil ifTrue:[
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
   540
            ClipboardMagnified := (Clipboard magnifiedBy: magnification) onDevice:device
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   541
        ].   
3278
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   542
        extent := ClipboardMagnified extent.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   543
1967
1b4524f3105f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
   544
        "/ currentPoint := currentPoint - self viewOrigin.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   545
2085
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
   546
        self redraw: (((lastPastePoint ? currentPoint)"-self viewOrigin") extent: extent).
3267
ee55a3b2f6fc changed #pointAt:
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
   547
        "/ self repairDamage.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   548
2085
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
   549
false "        (extent x > 400 or: [extent y > 400])" ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   550
            self xoring: [
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   551
                self fillRectangle: (currentPoint extent: extent)
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   552
            ]   
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   553
        ] ifFalse:[
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   554
            ClipboardMagnified notNil ifTrue:[
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   555
                self displayDeviceForm: ClipboardMagnified 
2089
8c0aed9152c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   556
                                     x: currentPoint x - self viewOrigin x 
8c0aed9152c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   557
                                     y: currentPoint y - self viewOrigin y.
8c0aed9152c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   558
            ].
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   559
            editMode == EditModePastUnder ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   560
                self redrawImageX:currentPoint x y:currentPoint y width:extent x height:extent y unmaskedOnly:true
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   561
            ]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   562
        ]  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   563
    ]. 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   564
    lastPastePoint := currentPoint.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   565
3278
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   566
    "Modified: / 20-11-2007 / 17:17:14 / cg"
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   567
!
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   568
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   569
fillFramedRectangle: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   570
61b7601829ea with modal support
tz
parents: 636
diff changeset
   571
    self fillRectangle: aRectangle.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   572
    self drawFramesIn: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   573
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   574
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   575
redraw:aRectangle
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
   576
    self 
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
   577
        invalidate:(aRectangle origin "+ self viewOrigin" extent:aRectangle extent)
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
   578
        repairNow:true. 
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   579
2053
5c19fe5b2db3 invalidate rather than redraw
Claus Gittinger <cg@exept.de>
parents: 2034
diff changeset
   580
    "Modified: / 15.11.2001 / 16:43:53 / cg"
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   581
!
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   582
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   583
redrawImageX:x y:y width:w height:h
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   584
    self redrawImageX:x y:y width:w height:h unmaskedOnly:false
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   585
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   586
    "Modified: / 18.5.1999 / 20:14:03 / cg"
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   587
!
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   588
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   589
redrawImageX:x y:y width:w height:h unmaskedOnly:unmaskedOnly
3319
ae7f91c67895 comment
Claus Gittinger <cg@exept.de>
parents: 3278
diff changeset
   590
    "redraw the magnified (editing) view of the image"
636
d53428252193 revised version
tz
parents: 633
diff changeset
   591
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   592
    self 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   593
        redrawImageX:x y:y width:w height:h 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   594
        unmaskedOnly:unmaskedOnly processColorsWith:[:colorIn | colorIn].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   595
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   596
    "Created: / 18.5.1999 / 20:13:39 / cg"
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   597
    "Modified: / 18.5.1999 / 20:36:20 / cg"
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   598
!
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   599
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   600
redrawImageX:x y:y width:w height:h unmaskedOnly:unmaskedOnly processColorsWith:aColorBlock
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   601
    "redraw the magnified (editing) view of the image"
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   602
4233
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   603
    |ih iw magX magY minX maxX minY maxY lastColor lastY runW x0 maskColor mask
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   604
     sizeOfMaskPoint useNearestColor origin isRGBA|
1180
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   605
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
   606
    useNearestColor := device visualType == #PseudoColor.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   607
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   608
    mask := image mask.
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   609
    isRGBA := image photometric == #rgba.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   610
    ih := image height.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   611
    iw := image width.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   612
    magX := magnification x.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   613
    magY := magnification y.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   614
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   615
    minX := (x // magX - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   616
    minX >= iw ifTrue:[minX := (iw - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   617
    minY := (y // magY - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   618
    minY >= ih ifTrue:[minY := (ih - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   619
    maxX := (x + w) // magX + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   620
    maxX > iw ifTrue:[maxX := iw].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   621
    maxY := (y + h) // magY + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   622
    maxY > ih ifTrue:[maxY := ih].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   623
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   624
    lastY := -1.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   625
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   626
    x0 := minX.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   627
    runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   628
    maskColor := false.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   629
    sizeOfMaskPoint := magnification//3.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   630
    image 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   631
        colorsFromX:minX y:minY toX:maxX-1 y:maxY-1 
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   632
        do:[:xx :yy :colorIn|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   633
            |color|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   634
            
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   635
            color := aColorBlock value:colorIn.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   636
            
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   637
            shown ifFalse:[^ self].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   638
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   639
            yy ~~ lastY ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   640
                runW ~~ 0 ifTrue:[
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   641
                    origin := (x0 * magX + margin) @ (lastY * magY + margin).
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   642
                    (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   643
                        self fillFramedRectangle: (origin extent: (runW@magY)).                    
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   644
                        maskColor ifTrue:[
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   645
                            gc xoring: [gc fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   646
                        ]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   647
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   648
                    runW := 0.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   649
                ]. 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   650
                x0 := xx.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   651
                lastY := yy.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   652
            ]. 
1160
5d89296c4b04 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1158
diff changeset
   653
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   654
            color ~= lastColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   655
                runW ~~ 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   656
                    origin := (x0 * magX + margin)@(yy * magY + margin).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   657
                    (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   658
                        self fillFramedRectangle: (origin extent: (runW@magY)).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   659
                        maskColor ifTrue:[
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   660
                            gc xoring: [gc fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   661
                        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   662
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   663
                    runW := 0.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   664
                ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   665
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   666
                lastColor := color.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   667
                useNearestColor ifTrue:[
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
   668
                    lastColor := lastColor nearestOn:device
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   669
                ].
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   670
                gc paint:lastColor.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   671
                mask notNil ifTrue:[  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   672
                    maskColor := false.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   673
                    (mask pixelAtX:xx y:yy) == 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   674
                        unmaskedOnly ifFalse:[
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   675
                            gc paint: (lastColor := self viewBackground).
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   676
                        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   677
                        maskColor := true.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   678
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   679
                    lastColor := nil.
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   680
                ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   681
                    isRGBA ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   682
                        maskColor := false.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   683
                        colorIn alphaByte == 0 ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   684
                            unmaskedOnly ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   685
                                gc paint: (lastColor := self viewBackground).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   686
                            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   687
                            maskColor := true.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   688
                        ] ifFalse:[  
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   689
                        ].    
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   690
                        lastColor := nil.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   691
                    ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   692
                ].    
1160
5d89296c4b04 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1158
diff changeset
   693
                runW := 0.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   694
                x0 := xx.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   695
            ].  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   696
            runW := runW + magX
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   697
        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   698
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   699
    runW ~~ 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   700
        origin := (x0 * magX + margin)@(lastY * magY + margin).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   701
        (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   702
            self fillFramedRectangle: (origin extent: runW@magY).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   703
            maskColor ifTrue:[
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   704
                gc xoring:[
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
   705
                    gc fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   706
                ]
1180
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   707
            ].
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   708
        ]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   709
    ].
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   710
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   711
    "Created: / 18-05-1999 / 20:13:39 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
   712
    "Modified: / 17-02-2017 / 17:19:59 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   713
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   714
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   715
redrawX:x y:y width:w height:h
636
d53428252193 revised version
tz
parents: 633
diff changeset
   716
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   717
    |xI yI devImage imgWidth imgHeight mX mY magnifiedWidth magnifiedHeight|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   718
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   719
    image isNil ifTrue:[^self].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   720
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   721
    magnification = (1@1) ifTrue: [
4212
4b84444912b5 exception access
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
   722
        Error handle:[:ex |
2092
36ef3048dbf4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
   723
            Transcript showCR:'cannot convert image: ', ex description.
1510
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   724
        ] do:[
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
   725
            devImage := image onDevice:device.
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   726
            devImage ~~ image ifTrue:[
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   727
                image := devImage.
1764
3dd553f8d9f0 oops - leftover halts
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
   728
                self changed:#image.
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   729
            ].
1510
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   730
        ].
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
   731
        image device == device ifTrue:[
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   732
            super redrawX:x y:y width:w height:h.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   733
            self drawFrame.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   734
            ^ self.
1510
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   735
        ].
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   736
    ].
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   737
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   738
    "/ self clippingRectangle: (x@y extent:w@h).
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   739
    "/ draw the image itself
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   740
    self redrawImageX:x y:y width:w height:h.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   741
4233
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   742
    imgWidth := image width.
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   743
    imgHeight := image height.
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   744
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   745
    "/ beyond of image ?
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   746
    adjust == #center ifTrue:[
4233
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   747
        xI := (width - imgWidth) // 2 - margin.
06183a48f783 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4231
diff changeset
   748
        yI := (height - imgHeight) // 2 - margin.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   749
    ] ifFalse:[
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   750
        xI := yI := margin
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   751
    ].
1967
1b4524f3105f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
   752
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   753
    mX := magnification x.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   754
    mY := magnification y.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   755
    magnifiedWidth := mX * imgWidth.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   756
    magnifiedHeight := mY * imgHeight.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   757
    
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   758
    "/ draw the rest to the right and at the bottom
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   759
    (x + w - 1) > (xI + magnifiedWidth) ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   760
        self 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   761
            clearRectangleX:(xI + magnifiedWidth) y:y
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   762
            width:(x + w - magnifiedWidth - xI) height:h
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   763
    ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   764
    (y + h - 1) > (yI + magnifiedHeight) ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   765
        self 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   766
            clearRectangleX:margin y:(yI + magnifiedHeight)
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   767
            width:w height:(y + h - magnifiedHeight - yI)  
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   768
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   769
    self drawFrame.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   770
    self clippingBounds: nil.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   771
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   772
    "Modified: / 31.7.1998 / 02:22:45 / cg"
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   773
!
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   774
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   775
startSpray
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   776
    spraySpot isNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   777
        spraySpot := 8
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   778
    ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   779
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   780
    sprayProcess isNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   781
        sprayProcess := [
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   782
                |p rnd norm sprayPoint dly angle x y dist|
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   783
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   784
                rnd := Random new.
3477
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   785
                Distributions::NormalDistribution notNil ifTrue:[
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   786
                    norm := Distributions::NormalDistribution mean:0 deviation:0.5.
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   787
                ].
3487
5cc0a5d3e1f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3477
diff changeset
   788
                dly := Delay forMilliseconds:20.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   789
                [true] whileTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   790
                    10 timesRepeat:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   791
                        p := sprayPosition.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   792
                        p notNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   793
                            angle := rnd next * 359.999.    "/ the angle is uniformly ditributed
3477
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   794
                            norm notNil ifTrue:[
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   795
                                dist := norm next * spraySpot.  "/ the distance is a normalDistribution
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   796
                            ] ifFalse:[
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   797
                                dist := (rnd nextBetween:-1 and:1) * spraySpot. 
00d7bac0b2c4 changed #startSpray
Claus Gittinger <cg@exept.de>
parents: 3476
diff changeset
   798
                            ].
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   799
                            sprayPoint := (Point r:dist degrees:angle)*magnification.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   800
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   801
                            x := p x + sprayPoint x truncated.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   802
                            y := p y + sprayPoint y truncated.
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   803
                            self pointAt:(x@y) width:1.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   804
                        ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   805
                    ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   806
                    dly wait.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   807
                ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   808
        ] fork.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   809
    ]
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   810
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
   811
    "Modified: / 15-02-2012 / 22:44:54 / cg"
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   812
!
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   813
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   814
stopSpray
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   815
    sprayProcess notNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   816
        sprayProcess terminate.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   817
        sprayProcess := nil
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   818
    ].
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   819
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   820
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   821
!ImageEditView methodsFor:'event handling'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   822
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   823
buttonMotion:state x:x y:y
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   824
    |p|
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   825
2072
abd4e246f393 care for negative pos in buttonMotion (win32 klusge)
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   826
    (x < 0 or:[y < 0]) ifTrue:[
abd4e246f393 care for negative pos in buttonMotion (win32 klusge)
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   827
        ^ self
abd4e246f393 care for negative pos in buttonMotion (win32 klusge)
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   828
    ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   829
    "/ readOnly ifTrue:[^ self].
2072
abd4e246f393 care for negative pos in buttonMotion (win32 klusge)
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   830
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   831
    p := x@y.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   832
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   833
    state ~~ 0 ifTrue:[
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   834
        "/ button down
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   835
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   836
        "/ self selectedColor notNil ifTrue:[ 
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   837
        (self imageContainsPoint:p) ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   838
            (editMode == EditModePoint) ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   839
                self pointAt:p.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   840
                ^ self
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   841
            ].
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   842
            (editMode == EditModeSmooth) ifTrue:[
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   843
                self smoothAt:p.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   844
                ^ self
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
   845
            ].
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   846
            sprayProcess notNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   847
                sprayPosition := p.
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   848
                ^ self
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   849
            ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   850
        ].
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   851
        self drawCursorAt:p.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   852
        ^ self
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   853
    ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   854
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   855
    "/ button is up (care for paste-mode, dragging the pasted image)
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   856
    self drawCursorAt:p.
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   857
    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   858
    "/ if in pastemode, highlight the affected rectangle (image to be pasted is in ClipBoard)
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   859
    self inPasteMode ifTrue: [
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   860
        "/ with shift, paste is offset by pasted image's size
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   861
        "/ (i.e. click-point will be corner of pasted rectangle)
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   862
        self sensor shiftDown ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   863
            p := p - Clipboard extent
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   864
        ].
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   865
        (self imageContainsPastePoint:p) ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   866
            (self sensor hasButtonMotionEventFor:self) ifFalse:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   867
                self drawPasteRectangleAt:p
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   868
            ]
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   869
        ] ifFalse: [
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   870
            self cursor:Cursor stop. 
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   871
            self releasePasteDrawing
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   872
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   873
    ]
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   874
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   875
    "Modified (format): / 16-02-2017 / 16:59:13 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   876
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   877
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   878
buttonPress:button x:x y:y
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   879
    |p clr masked|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   880
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   881
    p := x@y.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   882
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   883
    "/ with shift, paste is offset by pasted image's size
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   884
    "/ (i.e. click-point will be corner of pasted rectangle)
3278
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   885
    self inPasteMode ifTrue:[
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   886
        self sensor shiftDown ifTrue:[
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   887
            p := p - Clipboard extent
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   888
        ]
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   889
    ].
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   890
    
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   891
    self drawCursorAt:p.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   892
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   893
    (self imageContainsPoint:p) ifTrue:[  
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   894
        "/ shift click: select the pixel-color  
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   895
        (self inPasteMode not and:[self sensor shiftDown]) ifTrue:[
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   896
            userAllowedToChangeDrawingColor ifTrue:[
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   897
                (image maskAt:(p // magnification)) == 0 ifTrue:[
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   898
                    masked := true.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   899
                ] ifFalse:[
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   900
                    masked := false.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   901
                    clr := image colorAt:(p // magnification).
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   902
                ].
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   903
                pickedColorHolder notNil ifTrue:[
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   904
                    pickedColorHolder value:clr.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   905
                ].
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   906
                self selectedColor:clr.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   907
                masked ifTrue:[self selectedColorIndex:nil].
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   908
                self changed:#selectedColor with:clr.
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   909
            ].    
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   910
        ] ifFalse:[
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   911
            "/ normal click: 
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   912
            (readOnly not 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   913
              or:[editMode == EditModeCopy
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   914
              or:[editMode == EditModeSpecialOperation]]
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
   915
            ) ifTrue:[
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   916
                (button between:1 and:2) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   917
                    mouseKeyColorMode := button.
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   918
                    self makeUndo.
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   919
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   920
                    clickInfoCallBack notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   921
                        "/ still a kludge, but less ugly ...
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   922
                        clickInfoCallBack value:button value:p
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   923
                    ].
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   924
                    "/ editMode is something like #point, #rectangle etc.
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
   925
                    "/ so we call pointAt: / rectAt: / filledBoxAt: etc. here
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   926
                    [
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   927
                        self perform: (editMode, 'At:') asSymbol with:p
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   928
                    ] on:Error do:[:ex | 
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   929
                        (Dialog confirm:('Error during operation: ', ex description,'\\Debug ?') withCRs )
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   930
                        ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   931
                            ex reject
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   932
                        ].
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   933
                    ].
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   934
                ].
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   935
            ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   936
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   937
    ]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   938
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
   939
    "Modified: / 17-02-2017 / 16:25:29 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   940
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   941
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   942
buttonRelease:button x:x y:y
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   943
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   944
    self drawCursorAt: x@y.
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
   945
    readOnly ifTrue:[^ self].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   946
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   947
    (self imageContainsPoint: x@y) ifTrue: [
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   948
        sprayProcess notNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   949
            self stopSpray
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   950
        ].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
   951
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   952
        image release.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   953
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   954
        "/        "/ cg: what a kludge - please change to use a valueHolder,
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   955
        "/        "/ which gets the information ...
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   956
        "/        masterApplication imagePreView invalidate.
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   957
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   958
        "/ cg: still a kludge - but less ugly
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   959
        self changed:#subImageIn with:(image bounds).
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   960
    ]
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   961
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
   962
    "Modified: / 16-02-2017 / 16:57:24 / cg"
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   963
!
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   964
2508
ffb079bfe8b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2507
diff changeset
   965
inPasteMode
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
   966
    ^ (editMode notNil and:[editMode startsWith:#paste])
2508
ffb079bfe8b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2507
diff changeset
   967
!
ffb079bfe8b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2507
diff changeset
   968
5277
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   969
keyboardZoom:larger
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   970
    larger ifTrue:[
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   971
        self magnification: ((magnification + 1) min:63)
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   972
    ] ifFalse:[
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   973
        self magnification: ((magnification - 1) max:1)
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   974
    ].    
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   975
!
4d6ef5c2aa64 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5266
diff changeset
   976
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   977
pointerLeave:state
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   978
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
   979
    super pointerLeave: state.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   980
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   981
    self updateImageInfo: self imageInfoString.
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   982
    self cursor:Cursor normal.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   983
2508
ffb079bfe8b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2507
diff changeset
   984
    self inPasteMode ifTrue: [
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   985
        self releasePasteDrawing
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   986
    ]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   987
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   988
    "Modified: / 29.7.1998 / 18:27:42 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   989
! !
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   990
636
d53428252193 revised version
tz
parents: 633
diff changeset
   991
!ImageEditView methodsFor:'image editing'!
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   992
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   993
askForSpecialOperation
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   994
    "let user ask for which special operation to apply to the selected imageBox,
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   995
     then perform it."    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   996
    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   997
    |listOfOpNames listOfOpSelectors operation|
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   998
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
   999
    listOfOpNames := OrderedCollection new.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1000
    listOfOpSelectors := OrderedCollection new. 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1001
    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1002
    listOfOpNames addAll:
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1003
        (resources array:#(
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1004
           'edit separately'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1005
           'extract subimage'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1006
        )).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1007
    listOfOpSelectors addAll:
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1008
        #(
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1009
            #edit
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1010
            #editSubImage
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1011
        ).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1012
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1013
    self readOnly ifFalse:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1014
        listOfOpNames addAll:
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1015
            (resources array:#(
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1016
               '-'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1017
               'flip vertical'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1018
               'flip horizontal'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1019
               '-'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1020
               'slightly brightened'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1021
               'slightly darkened'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1022
               'brightened'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1023
               'darkened'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1024
               '-'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1025
               'make grey'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1026
               'greyed'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1027
               'grey pattern'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1028
               'grey pattern (unmasked)'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1029
               '-'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1030
               'reversed'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1031
               '-'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1032
               'change hue'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1033
               'colorize'
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1034
             )).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1035
                 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1036
        listOfOpSelectors addAll:
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1037
            #(nil
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1038
              flipVertical flipHorizontal nil
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1039
              slightlyBrightened slightlyDarkened brightened darkened nil 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1040
              makeGrey greyed greyPattern unmaskedGreyPattern nil 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1041
              reversed nil 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1042
              changeHue colorize
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1043
            ).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1044
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1045
    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1046
    operation := Dialog 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1047
           choose:(resources string:'Which Operation:')
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1048
           fromList:listOfOpNames
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1049
           values:listOfOpSelectors
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1050
           lines:10
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1051
           cancel:nil.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1052
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1053
    ^ operation
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1054
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1055
    "Created: / 20-02-2017 / 17:37:23 / cg"
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1056
!
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1057
2480
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  1058
copyImageToClipboard
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  1059
    self class copyImageToClipboard:image.
4264
6e31e342f38c class: ImageEditView
Stefan Vogel <sv@exept.de>
parents: 4249
diff changeset
  1060
    self setClipboardObject:image.
2480
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  1061
!
6b82ad413d70 added copyToClipboard
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  1062
1228
0aae4f7389ca renamed - crob -> crop
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1063
cropLeft:doLeft right:doRight top:doTop bottom:doBottom
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1064
    |yMinNew yMaxNew xMinNew xMaxNew
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1065
     pix stillCropping xMax yMax|
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1066
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1067
    xMax := image width - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1068
    yMax := image height - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1069
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1070
    xMinNew := 0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1071
    doLeft ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1072
        pix := image pixelAtX:xMinNew y:0.
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1073
        stillCropping := true.
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1074
        [stillCropping] whileTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1075
            0 to:yMax do:[:y |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1076
                (image pixelAtX:xMinNew y:y) ~~ pix ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1077
                    stillCropping := false
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1078
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1079
            ].
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1080
            stillCropping ifTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1081
                xMinNew := xMinNew + 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1082
                xMinNew >= image width ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1083
                    self warn:(resources string:'Image is all the same color - no crop.').
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1084
                    ^ self
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1085
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1086
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1087
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1088
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1089
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1090
    xMaxNew := xMax.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1091
    doRight ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1092
        stillCropping := true.
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1093
        pix := image pixelAtX:xMaxNew y:0.
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1094
        [stillCropping] whileTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1095
            0 to:yMax do:[:y |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1096
                (image pixelAtX:xMaxNew y:y) ~~ pix ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1097
                    stillCropping := false
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1098
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1099
            ].
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1100
            stillCropping ifTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1101
                xMaxNew := xMaxNew - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1102
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1103
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1104
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1105
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1106
    yMinNew := 0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1107
    doTop ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1108
        pix := image pixelAtX:xMinNew y:yMinNew.
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1109
        stillCropping := true.
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1110
        [stillCropping] whileTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1111
            xMinNew to:xMaxNew do:[:x |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1112
                (image pixelAtX:x y:yMinNew) ~~ pix ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1113
                    stillCropping := false
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1114
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1115
            ].
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1116
            stillCropping ifTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1117
                yMinNew := yMinNew + 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1118
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1119
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1120
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1122
    yMaxNew := yMax.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1123
    doRight ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1124
        stillCropping := true.
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1125
        pix := image pixelAtX:xMaxNew y:yMaxNew.
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1126
        [stillCropping] whileTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1127
            xMinNew to:xMaxNew do:[:x |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1128
                (image pixelAtX:x y:yMaxNew) ~~ pix ifTrue:[
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1129
                    stillCropping := false
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1130
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1131
            ].
5093
a70ea1df6754 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 5061
diff changeset
  1132
            stillCropping ifTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1133
                yMaxNew := yMaxNew - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1134
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1135
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1136
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1137
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1138
    (xMinNew == 0
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1139
    and:[xMaxNew == (image width - 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1140
    and:[yMinNew == 0
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1141
    and:[yMaxNew == (image height - 1)]]]) ifTrue:[
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1142
        self warn:(resources string:'No border found - no crob.').
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1143
        ^ self
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1144
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1145
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1146
"/    self warn:'extract subImage ' 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1147
"/              , (xMinNew @ yMinNew) printString
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1148
"/              , ' -> '
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1149
"/              , (xMaxNew @ yMaxNew) printString.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1150
2006
99e13c98314c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1994
diff changeset
  1151
    self makeUndo.
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1152
    self 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1153
        makeSubImageX:xMinNew y:yMinNew 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1154
        width:(xMaxNew - xMinNew + 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1155
        height:(yMaxNew - yMinNew + 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1156
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1157
    "Created: / 7.9.1998 / 14:25:52 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1158
    "Modified: / 7.9.1998 / 16:35:35 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1159
!
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1160
5435
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1161
drawingColorOrNil
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1162
    |cmap|
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1163
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1164
    cmap := image colorMap.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1165
    (cmap isNil or:[cmap isFixedPalette or:[cmap isMappedPalette]]) ifTrue:[
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1166
        ^ self selectedColor.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1167
    ].
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1168
    ^ nil
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1169
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1170
    "Created: / 03-02-2017 / 21:58:01 / cg"
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1171
!
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1172
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1173
drawingPixelOrNil
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1174
    |cmap|
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1175
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1176
    cmap := image colorMap.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1177
    (cmap isNil or:[cmap isFixedPalette or:[cmap isMappedPalette]]) ifTrue:[
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1178
        ^ nil.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1179
    ].
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1180
    ^ self selectedColorIndex.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1181
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1182
    "Created: / 03-02-2017 / 21:58:28 / cg"
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1183
!
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1184
4032
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1185
flipSubImage:how in:imageBox
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1186
    "/ now, do it
4624
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1187
    "/ caveat: this should go into image class
4032
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1188
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1189
    |x0 y0 x1 y1 image t|
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1190
4623
efe94f736058 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
  1191
    self makeUndo.
efe94f736058 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
  1192
4032
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1193
    x0 := imageBox left.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1194
    y0 := imageBox top.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1195
    x1 := imageBox right-1.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1196
    y1 := imageBox bottom-1.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1197
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1198
    image := self image.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1199
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1200
    how == #vertical ifTrue:[
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1201
        0 to:((y1-y0)//2) do:[:dy |
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1202
            x0 to:x1 do:[:x |
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1203
                t := image pixelAtX:x y:(y0+dy).
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1204
                image pixelAtX:x y:(y0+dy) put:(image pixelAtX:x y:(y1-dy)).
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1205
                image pixelAtX:x y:(y1-dy) put:t.
4624
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1206
                image mask notNil ifTrue:[
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1207
                    t := image maskAtX:x y:(y0+dy).
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1208
                    image maskAtX:x y:(y0+dy) put:(image maskAtX:x y:(y1-dy)).
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1209
                    image maskAtX:x y:(y1-dy) put:t.
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1210
                ].
4032
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1211
            ].
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1212
        ]
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1213
    ] ifFalse:[
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1214
        0 to:((x1-x0)//2) do:[:dx |
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1215
            y0 to:y1 do:[:y |
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1216
                t := image pixelAtX:(x0+dx) y:y.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1217
                image pixelAtX:(x0+dx) y:y put:(image pixelAtX:(x1-dx) y:y).
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1218
                image pixelAtX:(x1-dx) y:y put:t.
4623
efe94f736058 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4506
diff changeset
  1219
4624
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1220
                image mask notNil ifTrue:[
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1221
                    t := image maskAtX:(x0+dx) y:y.
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1222
                    image maskAtX:(x0+dx) y:y put:(image maskAtX:(x1-dx) y:y).
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1223
                    image maskAtX:(x1-dx) y:y put:t.
bc987849ea84 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
  1224
                ].
4032
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1225
            ].
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1226
        ]
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1227
    ].
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1228
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1229
    self setModified.
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1230
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1231
    "Created: / 07-04-2011 / 09:34:23 / cg"
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1232
!
f293d37675b5 added: #flipSubImage:in:
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
  1233
4723
c5f32ebfec14 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1234
magnifyAntiAliasedImageTo:newSize
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1235
    self newImageWithUndo: (image hardAntiAliasedMagnifiedBy: newSize/image extent).
4723
c5f32ebfec14 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1236
!
c5f32ebfec14 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1237
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1238
magnifyImageTo:newSize
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1239
    self newImageWithUndo: (image magnifiedBy: newSize/image extent).
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1240
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1241
2168
d531fe16bae2 more colormap operations
Claus Gittinger <cg@exept.de>
parents: 2149
diff changeset
  1242
makeNewColorMapByMapping:functionOfColor
2566
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1243
    |xMax yMax map revMap anyChange
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1244
     newColors newColorArray newImage pixelAction|
2168
d531fe16bae2 more colormap operations
Claus Gittinger <cg@exept.de>
parents: 2149
diff changeset
  1245
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1246
    anyChange := false.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1247
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1248
    xMax := image width - 1.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1249
    yMax := image height - 1.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1250
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1251
    newImage := image class width:image width height:image height depth:image depth.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1252
    newImage photometric:image photometric.
2489
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1253
    "/ newImage colorMap:(image colorMap copy).
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1254
    newImage bits:(ByteArray new:(image bits size)).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1255
    newImage mask:(image mask copy).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1256
2566
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1257
    image colorMap notNil ifTrue:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1258
        newColors := Set new.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1259
        newColorArray := OrderedCollection new.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1260
        map := Array new:256.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1261
        revMap := OrderedCollection new.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1262
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1263
        pixelAction := 
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1264
            [:x :y |
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1265
                |pix n_pix clr n_clr|
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1266
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1267
                pix := image pixelAtX:x y:y.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1268
                (n_pix := map at:pix+1) isNil ifTrue:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1269
                    clr := image colorAtX:x y:y.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1270
                    n_clr := functionOfColor value:clr.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1271
                    (newColors includes:n_clr) ifFalse:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1272
                        newColors add:n_clr.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1273
                        newColorArray add:n_clr.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1274
                        revMap add:pix.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1275
                        map at:pix+1 put:(n_pix := revMap size - 1).
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1276
                    ] ifTrue:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1277
                        "/ mhmh - multiple pixels mapped to the same color
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1278
                        n_pix := (newColorArray indexOf:n_clr) - 1.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1279
                        map at:pix+1 put:n_pix.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1280
                    ]
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1281
                ].
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1282
                newImage pixelAtX:x y:y put:n_pix.
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1283
            ].
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1284
    ] ifFalse:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1285
        pixelAction := 
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1286
            [:x :y |
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1287
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1288
                |clr n_clr|
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1289
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1290
                clr := image colorAtX:x y:y.
2168
d531fe16bae2 more colormap operations
Claus Gittinger <cg@exept.de>
parents: 2149
diff changeset
  1291
                n_clr := functionOfColor value:clr.
2566
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1292
                newImage colorAtX:x y:y put:n_clr.
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1293
            ].
2566
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1294
    ].
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1295
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1296
    0 to:yMax do:[:y |
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1297
        0 to:xMax do:[:x |
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1298
            pixelAction value:x value:y
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1299
        ]
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1300
    ].
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1301
2566
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1302
    image colorMap notNil ifTrue:[
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1303
        newImage colorMap:(MappedPalette withColors:newColorArray).
d0894c5f6d4d allow image processing of trueColor images
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
  1304
    ].
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1305
    self newImageWithUndo:newImage.
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1306
    ^ true
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1307
!
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1308
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1309
makeSubImageX:oldX y:oldY width:newWidth height:newHeight
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1310
    |oldWidth oldHeight newImage newMaskImage needRedraw redrawRect1 redrawRect2 |
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1311
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1312
    oldWidth := image width.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1313
    oldHeight := image height.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1314
    self assert:(newWidth <= oldWidth).
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1315
    self assert:(newHeight <= oldHeight).
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1316
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1317
    newImage := image class width:newWidth height:newHeight depth:image depth.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1318
    newImage photometric:image photometric.
5468
2ca6776b4271 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5435
diff changeset
  1319
    image photometric == #palette ifTrue:[
2ca6776b4271 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5435
diff changeset
  1320
        newImage colorMap:image colorMap copy.
2ca6776b4271 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5435
diff changeset
  1321
    ].
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1322
    newImage bits:(ByteArray new:(newImage bytesPerRow * newHeight)).
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1323
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1324
    image mask notNil ifTrue:[
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1325
        newMaskImage := Depth1Image width:newWidth height:newHeight.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1326
        newMaskImage photometric: image mask photometric.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1327
        newMaskImage colorMap: image mask colorMap copy.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1328
        newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newHeight).
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1329
        newImage mask: newMaskImage
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1330
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1331
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1332
    newImage copyFrom:image x:oldX y:oldY toX:0 y:0 width:newWidth height:newHeight.
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1333
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1334
    needRedraw := true.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1335
    (oldX == 0 and:[oldY == 0]) ifTrue:[
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1336
        needRedraw := false.
5332
32b9a3b4abdb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5314
diff changeset
  1337
        redrawRect1 := ((newWidth@0) * magnification) corner:(((oldWidth@oldHeight)+1) * magnification).
32b9a3b4abdb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5314
diff changeset
  1338
        redrawRect2 := ((0@newHeight) * magnification) corner:(((oldWidth@oldHeight)+1) * magnification).
3706
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1339
    ].
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1340
    self image:newImage scroll:false invalidate:needRedraw.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1341
    redrawRect1 notNil ifTrue:[
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1342
        self invalidateRectangle:redrawRect1 repairNow:false.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1343
    ].
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1344
    redrawRect2 notNil ifTrue:[
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1345
        self invalidateRectangle:redrawRect2 repairNow:false.
e95e7f0e4f82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  1346
    ].
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  1347
    self setModified.
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1348
5332
32b9a3b4abdb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5314
diff changeset
  1349
    "Created: / 07-09-1998 / 13:00:16 / cg"
5468
2ca6776b4271 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5435
diff changeset
  1350
    "Modified: / 13-02-2017 / 14:48:46 / cg"
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1351
!
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1352
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1353
makeUndo
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1354
    image notNil ifTrue:[       
3278
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
  1355
        [undoImages size >= MaxUndos] whileTrue:[
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1356
            undoImages removeFirst.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1357
        ].
3610
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  1358
        undoImages add:image copy
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1359
    ]
3278
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
  1360
c42700648b31 shift-paste
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
  1361
    "Modified: / 20-11-2007 / 17:26:50 / cg"
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1362
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  1363
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1364
pasteAt: aPoint mode:modeSymbol
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1365
    "called from button-press/button motion while in paste mode:
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1366
     paste the image in the clipboard at aPoint"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1367
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  1368
    |answer anyColorMissing choosenBox imagePoint imgX imgY copiedImage imageBox newColorMap
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1369
     existingColors newColors allColors currentColorMap newColormap anyColorAdded oldColorMap|
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1370
4203
a257aa6878ac class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4149
diff changeset
  1371
    Error handle:[:ex|
a257aa6878ac class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4149
diff changeset
  1372
        ex creator == Image unrepresentableColorSignal ifFalse:[
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1373
            ex reject
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1374
        ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1375
        self undo.
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1376
        self warn:(resources stringWithCRs:'Paste failed !!\Increasing the images depth might help.'). 
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1377
    ] do: [   
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1378
        windowGroup withExecuteCursorDo:[
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  1379
            choosenBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  1380
            choosenBox isNil ifTrue:[ ^ self ].
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  1381
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  1382
            imagePoint := choosenBox origin//magnification.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1383
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1384
            copiedImage := Clipboard copy.
5417
054dfa979ced #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5415
diff changeset
  1385
            copiedImage isNil ifTrue:[^ self].
054dfa979ced #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5415
diff changeset
  1386
            
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1387
            true "/ image photometric == #palette 
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1388
            ifTrue:[
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1389
                "/ for all colors in the pasted image,
5472
f87d19419651 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5468
diff changeset
  1390
                "/ check, if it's in the colormap of the
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1391
                "/ target image.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1392
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1393
                anyColorMissing := anyColorAdded := false.
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1394
                oldColorMap := image colorMap.
5434
29822bceb67d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5432
diff changeset
  1395
                (oldColorMap notNil and:[image photometric == #palette]) ifTrue:[
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1396
                    newColorMap := oldColorMap asOrderedCollection.
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1397
                    copiedImage usedValues do:[:pixel |
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1398
                        |pastedColor |
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1399
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1400
                        pastedColor := copiedImage colorFromValue:pixel.
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1401
3762
1baf6a044dd2 changed: #pasteAt:mode:
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
  1402
                        (newColorMap includes:pastedColor) ifFalse:[
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1403
                            newColorMap size < (1 bitShift:image depth) ifTrue:[
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1404
                                "/ add to colormap
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1405
                                newColorMap add:pastedColor.
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1406
                                anyColorAdded := true.
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1407
        "/                        Transcript showCR:'adding color:' , pastedColor displayString , ' to targets colorMap'.
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1408
                            ] ifFalse:[
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1409
        "/                        Transcript showCR:'color:' , pastedColor displayString , ' not found in targets colorMap'.
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1410
"/                                copiedImage colorMap notNil ifTrue:[
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1411
"/                                    copiedImage colorMap at: pixel+1 put: Color black.
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1412
"/                                ].
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1413
                                anyColorMissing := true.
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1414
                            ]
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1415
                        ]
1957
9a4347986d96 paste with non-colormap image (i.e. truecolor).
Claus Gittinger <cg@exept.de>
parents: 1903
diff changeset
  1416
                    ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1417
                ].
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1418
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1419
                anyColorMissing ifTrue:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1420
                    answer := Dialog
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1421
                                confirmWithCancel:(resources stringWithCRs:'Some color(s) cannot be represented (colorMap full).\Use nearest or compute colorMap ?') 
2172
737d8733fb01 brightemed, darkened, reverse etc. added to operations.
Claus Gittinger <cg@exept.de>
parents: 2168
diff changeset
  1422
                                labels:#( 'Cancel' 'New ColorMap' 'Use Nearest' )
737d8733fb01 brightemed, darkened, reverse etc. added to operations.
Claus Gittinger <cg@exept.de>
parents: 2168
diff changeset
  1423
                                values:#(  nil new nearest)
737d8733fb01 brightemed, darkened, reverse etc. added to operations.
Claus Gittinger <cg@exept.de>
parents: 2168
diff changeset
  1424
                                default:3.
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1425
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1426
                    answer isNil ifTrue:[^ self].
1986
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1427
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1428
                    currentColorMap := image colorMap.
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1429
                    imgX := imagePoint x.
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1430
                    imgY := imagePoint y.
1986
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1431
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1432
                    answer == #nearest ifTrue:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1433
                        0 to:copiedImage height-1 do:[:y |
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1434
                            0 to:copiedImage width-1 do:[:x |
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1435
                                |clr n_clr|
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1436
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1437
                                (copiedImage maskAtX:x y:y) == 0 ifTrue:[
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1438
                                    image mask isNil ifTrue:[
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1439
                                        image createMask.
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1440
                                    ].
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1441
                                    image maskAtX:imgX+x y:imgY+y put:0.
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1442
                                ] ifFalse:[
2582
5f9a25414195 atX:y: changed to #colorAtX :y:
penk
parents: 2566
diff changeset
  1443
                                    clr := copiedImage colorAtX:x y:y.
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1444
                                    n_clr := clr nearestIn:currentColorMap.
2582
5f9a25414195 atX:y: changed to #colorAtX :y:
penk
parents: 2566
diff changeset
  1445
                                    image colorAtX:imgX+x y:imgY+y put:n_clr
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1446
                                ]
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1447
                            ]
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1448
                        ].
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1449
                        image restored.
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1450
                        self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1).
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  1451
                        self setModified.
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1452
                        ^ self.
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1453
                    ].
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1454
                    answer == #new ifTrue:[
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1455
                        existingColors := image usedValues asIdentitySet.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1456
                        newColors := copiedImage usedValues.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1457
                        allColors := existingColors addAll:newColors.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1458
                        allColors size > (1 bitShift:image depth) ifTrue:[
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1459
                            self warn:(resources string:'Sorry: too many colors - unimplemented function').
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1460
                            self undo.
1986
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1461
                            ^ self.
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1462
                        ].
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1463
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1464
                        newColormap := OrderedCollection new.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1465
                        newColormap addAll:image usedColors.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1466
                        newColormap addAll:copiedImage usedColors.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1467
                        "/ translate image to use new colorMap...
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1468
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1469
                        "/ translate image to use new colors ...
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1470
                        0 to:image height-1 do:[:y |
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1471
                            0 to:image width-1 do:[:x |
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1472
                                |clr n_idx|
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1473
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1474
                                (image maskAtX:x y:y) == 1 ifTrue:[
2582
5f9a25414195 atX:y: changed to #colorAtX :y:
penk
parents: 2566
diff changeset
  1475
                                    clr := image colorAtX:x y:y.
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1476
                                    n_idx := newColormap indexOf:clr.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1477
                                    image pixelAtX:x y:y put:n_idx-1.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1478
                                ]
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1479
                            ]
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1480
                        ].
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1481
                        image colorMap:newColormap.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1482
                        currentColorMap := newColormap.    
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1483
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1484
                        "/ paste new image...    
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1485
                        0 to:copiedImage height-1 do:[:y |
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1486
                            0 to:copiedImage width-1 do:[:x |
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1487
                                |clr idx|
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1488
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1489
                                (copiedImage maskAtX:x y:y) == 1
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1490
                                ifTrue:[
2582
5f9a25414195 atX:y: changed to #colorAtX :y:
penk
parents: 2566
diff changeset
  1491
                                    clr := copiedImage colorAtX:x y:y.
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1492
                                    idx := currentColorMap indexOf:clr.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1493
                                    idx == 0 ifTrue:[
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1494
                                        currentColorMap add:clr.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1495
                                        idx := currentColorMap size.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1496
                                        idx > (1 bitShift:image depth) ifTrue:[
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1497
                                            self warn:(resources string:'Sorry: too many colors').
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1498
                                            self undo.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1499
                                            ^ self.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1500
                                        ].
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1501
                                    ].
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1502
                                    image pixelAtX:imgX+x y:imgY+y put:idx-1.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1503
                                    image maskAtX:imgX+x y:imgY+y put:1.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1504
                                ]
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1505
                            ]
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1506
                        ].
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1507
                        image restored.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1508
                        self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1).
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  1509
                        self setModified.
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1510
                        ^ self.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1511
                    ].
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  1512
                    self warn:(resources string:'Sorry: unimplemented function').
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1513
                    self undo.
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1514
                    ^ self.
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1515
                ].
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1516
                anyColorAdded ifTrue:[
2490
62230519175a slowly getting rid of the Colormap class
Claus Gittinger <cg@exept.de>
parents: 2489
diff changeset
  1517
                    image colorMap:(MappedPalette withColors:newColorMap).
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1518
                ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1519
            ].
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1520
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1521
            copiedImage := image class fromImage: copiedImage.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1522
            (newColorMap isNil 
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1523
            and:[modeSymbol isNil
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1524
            and:[copiedImage mask isNil] ]) ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1525
                "/ use images copy functionality
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1526
                "/ however, this copies the mask as well,
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1527
                "/ which is not useful here
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1528
                image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1529
            ] ifFalse:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1530
                imgX := imagePoint x.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1531
                imgY := imagePoint y.
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1532
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1533
                0 to:copiedImage height-1 do:[:y |
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1534
                    0 to:copiedImage width-1 do:[:x |
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1535
                        |wasMasked newMasked dstX dstY oldColor|
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1536
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1537
                        dstX := imgX + x.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1538
                        dstY := imgY + y.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1539
                        wasMasked := (image maskAtX:dstX y:dstY) == 0.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1540
                        newMasked := (copiedImage maskAtX:x y:y) == 0.
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
  1541
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1542
                        "/ with modeUnder, 
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1543
                        "/ only replace, if its either unmasked,
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1544
                        "/ or the current drawing color.
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1545
                        (modeSymbol isNil
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1546
                        or:[wasMasked
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1547
                        or:[modeSymbol == #withMask]])
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1548
                        ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1549
                            newMasked ifFalse:[
2764
3302aab746d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  1550
                                image colorAtX:dstX y:dstY put:(copiedImage colorAtX:x y:y).
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1551
                                wasMasked ifTrue:[
1986
630db3277f10 support pasing 24bit rgb image into an 8-bit palette image
Claus Gittinger <cg@exept.de>
parents: 1980
diff changeset
  1552
                                    image maskAtX:dstX y:dstY put:1
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1553
                                ].
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1554
                            ] ifTrue:[
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1555
                                wasMasked ifFalse:[
2135
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1556
                                    modeSymbol == #withMask ifTrue:[
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1557
                                        image maskAtX:dstX y:dstY put:0
09782f280a97 added "paste with mask"
Claus Gittinger <cg@exept.de>
parents: 2092
diff changeset
  1558
                                    ]
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1559
                                ]
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1560
                            ].
1987
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1561
                        ].
eb9f2f7f1450 paste image
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1562
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1563
                    ]
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1564
                ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1565
            ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1566
            image restored.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1567
            self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1).
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1568
"/            masterApplication imagePreView redraw: (imageBox expandedBy: 1).
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  1569
            self setModified.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1570
        ]
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1571
   ]
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1572
5434
29822bceb67d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5432
diff changeset
  1573
    "Modified: / 03-02-2017 / 17:10:05 / cg"
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1574
    "Modified (comment): / 16-02-2017 / 11:13:59 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1575
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1576
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1577
pointAt:aPoint width:pw
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1578
    "called from button-press/button motion while in point-drawing mode:
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1579
     draw a single pixel (or dot of width pw) with the currently selected color"
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1580
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1581
    |draw imagePoint clr pix|
796
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1582
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1583
    imagePoint := aPoint // magnification.
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1584
    (imagePoint x between:0 and:image width-1) ifFalse:[^ self].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1585
    (imagePoint y between:0 and:image height-1) ifFalse:[^ self].
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1586
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1587
    draw := 
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1588
        [:point |
5435
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1589
            (clr := self drawingColorOrNil) notNil ifTrue:[
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1590
                image atImageAndMask:point put:clr.
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1591
            ] ifFalse:[
5435
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1592
                (pix := self drawingPixelOrNil) notNil ifTrue:[
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1593
                    image atImageAndMask:point putValue:pix.
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1594
                ].             
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1595
            ].             
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1596
            self invalidate:((point * magnification extent: magnification) expandedBy:1).
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1597
        ].
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  1598
3265
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
  1599
    draw value:imagePoint.
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
  1600
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  1601
    pw > 1 ifTrue:[
3610
11e215de80a0 color selection when undoing
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  1602
        "/ draw with a wide pen
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1603
        (pw//2) negated to:(pw-(pw//2)-1) do:[:xOffs |
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1604
            (pw//2) negated to:(pw-(pw//2)-1) do:[:yOffs |
3267
ee55a3b2f6fc changed #pointAt:
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1605
                imagePoint x + xOffs >= 0 ifTrue:[
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1606
                    imagePoint y + yOffs >= 0 ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1607
                        draw value:(imagePoint + (xOffs@yOffs)).
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  1608
                    ].
3267
ee55a3b2f6fc changed #pointAt:
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1609
                ].
3266
7b8c5b21fca3 changed #pointAt:
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1610
            ].
3265
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
  1611
        ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1612
    ].
2823
201bf0929edb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  1613
    self setModified.
3265
f22de2c4383d pen width
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
  1614
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  1615
    "Created: / 15-02-2012 / 22:47:08 / cg"
5435
3707d107eb24 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5434
diff changeset
  1616
    "Modified: / 03-02-2017 / 21:59:41 / cg"
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  1617
    "Modified (comment): / 16-02-2017 / 11:12:52 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1618
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1619
2086
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1620
shiftImageHorizontal:shiftH vertical:shiftV
2489
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1621
    self shiftImageHorizontal:shiftH vertical:shiftV wrap:false
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1622
!
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1623
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1624
shiftImageHorizontal:shiftH vertical:shiftV wrap:doWrap
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1625
    "shift the pixels; 
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1626
     shift<0 is left-shift/up-shift; shift>0 is right-shift/down-shift;
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1627
     doWrap controls if shifted-out pixels are to be shifted in at the opposite side.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1628
     i.e.:
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1629
        0123456789 -> 3456789789 (shift: -3)    0123456789 -> 0120123456 (shift:3)
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1630
     or, with wrap:
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1631
        0123456789 -> 3456789012 (shift: -3)    0123456789 -> 7890123456 (shift:3)
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1632
    "
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1633
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1634
    |newImage|
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1635
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1636
    newImage := self shifted:image horizontal:shiftH vertical:shiftV wrap:doWrap.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1637
    self image:newImage.
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  1638
    self setModified.
2489
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1639
!
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1640
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1641
shifted:image horizontal:shiftH vertical:shiftV wrap:doWrap
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1642
    "shift the pixels; 
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1643
     shift<0 is left-shift/up-shift; shift>0 is right-shift/down-shift;
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1644
     doWrap controls if shifted-out pixels are to be shifted in at the opposite side.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1645
     i.e.:
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1646
        0123456789 -> 3456789789 (shift: -3)    0123456789 -> 0120123456 (shift:3)
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1647
     or, with wrap:
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1648
        0123456789 -> 3456789012 (shift: -3)    0123456789 -> 7890123456 (shift:3)
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1649
    "
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1650
2086
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1651
    |w h srcX srcY dstX dstY newImage|
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1652
2489
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1653
    doWrap ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1654
        "/ if wrapping, split into two operations to make wrap-code below simpler.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1655
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1656
        shiftH ~~ 0 ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1657
            shiftV ~~ 0 ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1658
                newImage := self shifted:image    horizontal:shiftH vertical:0 wrap:doWrap.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1659
                newImage := self shifted:newImage horizontal:0      vertical:shiftV wrap:doWrap.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1660
                ^ newImage
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1661
            ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1662
        ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1663
    ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1664
    (shiftV == 0 and:[shiftH == 0]) ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1665
        ^ image
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1666
    ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1667
2086
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1668
    w := image width.
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1669
    h := image height.
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1670
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1671
    newImage := image copy.
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1672
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1673
    srcX := srcY := dstX := dstY := 0.
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1674
    shiftH < 0 ifTrue:[
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1675
        srcX := shiftH negated
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1676
    ] ifFalse:[
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1677
        dstX := shiftH
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1678
    ].
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1679
    shiftV < 0 ifTrue:[
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1680
        srcY := shiftV negated
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1681
    ] ifFalse:[
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1682
        dstY := shiftV
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1683
    ].
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1684
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1685
    newImage copyFrom:image x:srcX y:srcY toX:dstX y:dstY width:w-shiftH abs height:h-shiftV abs.
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1686
2489
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1687
    doWrap ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1688
        srcX := srcY := dstX := dstY := 0.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1689
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1690
        "/ already simplified - see above
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1691
        shiftH ~~ 0 ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1692
            "/ shiftV known to be 0
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1693
            shiftH < 0 ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1694
                dstX := w-1-shiftH negated
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1695
            ] ifFalse:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1696
                srcX := w-1-shiftH
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1697
            ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1698
            w := shiftH abs.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1699
        ] ifFalse:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1700
            "/ shiftH known to be 0
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1701
            shiftV < 0 ifTrue:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1702
                dstY := h-1-shiftV negated
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1703
            ] ifFalse:[
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1704
                srcY := h-1-shiftV
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1705
            ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1706
            h := shiftV abs.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1707
        ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1708
        newImage copyFrom:image x:srcX y:srcY toX:dstX y:dstY width:w height:h.
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1709
        ^ newImage
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1710
    ].
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1711
f5654b8104f4 shift + wrap
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  1712
    ^ newImage.
2086
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1713
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1714
    "Created: / 7.9.1998 / 13:00:16 / cg"
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1715
    "Modified: / 7.9.1998 / 14:15:32 / cg"
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1716
!
3e32adf8adab added shift operation
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1717
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1718
specialOperation:operation on:imageBox withColor:clr
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1719
    "perform one of the special operations on the previously selected imageBox;
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1720
     then redraw as required"    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1721
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1722
    self invalidate.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1723
    self windowGroup processExposeEvents.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1724
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1725
    operation isNil ifTrue:[^ false].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1726
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1727
    (self performSpecialOperation:operation on:imageBox withColor:self selectedColor) ifFalse:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1728
        ^ false
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1729
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1730
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1731
    image restored.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1732
    self invalidate. "/ : (choosedBox expandedBy: 1).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1733
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1734
    "/ self redraw: (choosedBox expandedBy: 1).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1735
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1736
    "/        "/ cg: what a kludge - please change to use a valueHolder,
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1737
    "/        "/ which gets the information ...
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1738
    "/        masterApplication imagePreView redraw: (imageBox expandedBy: 1).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1739
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1740
    "/ cg: still a kludge - but less ugly
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1741
    self changed:#subImageIn with:(imageBox expandedBy: 1).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1742
    self setModified.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1743
    ^ true
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1744
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1745
    "Created: / 20-02-2017 / 17:35:33 / cg"
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1746
!
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1747
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1748
text:aString at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1749
    "draw a character"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1750
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1751
    |tempForm|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1752
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1753
    tempForm := Form extent:(image extent) depth:1 onDevice:device.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1754
    tempForm clear.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1755
    tempForm paint:(Color colorId:1).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1756
    tempForm displayString:aString at:aPoint.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1757
    0 to:image extent x - 1 do:[:x |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1758
        0 to:image extent y - 1 do:[:y |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1759
            (tempForm valueAt:(x@y)) == 1 ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1760
                self pointAt:(x@y) width:1
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1761
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1762
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1763
    ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1764
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1765
    "Modified: / 15-02-2012 / 22:47:44 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1766
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1767
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1768
undo
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1769
    undoImages notEmpty ifTrue:[           
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1770
        windowGroup withExecuteCursorDo:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1771
            |oldImage newImage|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1772
            
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1773
            oldImage := self image.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1774
            newImage := undoImages removeLast.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1775
            self clearModified.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1776
            self image:newImage scroll:(newImage extent ~= oldImage extent) "false".
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1777
            "/ self changed:#image.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1778
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1779
    ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1780
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1781
    "Modified: / 10.2.2000 / 23:21:24 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1782
! !
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1783
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1784
!ImageEditView methodsFor:'image editing-editmode button actions'!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1785
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1786
boxAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1787
    "called from button-press/button motion while in box-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1788
     drag a rectangular outline, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1789
     when released, draw a rectangle with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1790
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1791
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1792
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1793
            colorOrPixel isColor notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1794
                image drawRectangle:box withColor:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1795
            ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1796
                image drawRectangle:box withValue:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1797
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1798
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1799
        at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1800
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1801
    "Modified: / 16-02-2017 / 11:22:11 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1802
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1803
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1804
circleAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1805
    "called from button-press/button motion while in circle-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1806
     drag an ellipse, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1807
     when released, draw an ellipse with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1808
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1809
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1810
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1811
            colorOrPixel isColor notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1812
                image drawEllipse:box withColor:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1813
            ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1814
                image drawEllipse:box withValue:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1815
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1816
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1817
        at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1818
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1819
    "Modified: / 16-02-2017 / 11:22:37 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1820
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1821
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1822
commonBoxOperation:action at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1823
    "common code for filling/drawing."
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1824
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1825
    |choosenBox imageBox clr pix|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1826
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1827
    (clr := self selectedColor) notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1828
        choosenBox := self dragRectangleStartingAt: aPoint emphasis: #box.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1829
        choosenBox notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1830
            imageBox := choosenBox origin//magnification extent: (choosenBox extent//magnification).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1831
            (clr := self drawingColorOrNil) notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1832
                action value:imageBox value:clr.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1833
            ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1834
                (pix := self drawingPixelOrNil) notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1835
                    action value:imageBox value:pix.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1836
                ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1837
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1838
            image restored.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1839
            self redraw: (choosenBox expandedBy: 1).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1840
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1841
            "/ cg: still a kludge - but less ugly
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1842
            self changed:#subImageIn with:(imageBox expandedBy: 1).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1843
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1844
            self setModified.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1845
        ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1846
    ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1847
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1848
    "Created: / 16-02-2017 / 11:20:49 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1849
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1850
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1851
copyAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1852
    "called from button-press/button motion while in copy-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1853
     drag a filled box, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1854
     when released, copy the selected rectangle to the clipboard"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1855
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1856
    |choosenBox box copiedImage|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1857
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1858
    choosenBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1859
    choosenBox notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1860
        box := choosenBox origin // magnification extent: (choosenBox extent // magnification).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1861
        copiedImage := image subImageIn: box.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1862
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1863
        self class copyImageToClipboard:copiedImage.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1864
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1865
        self redraw:(choosenBox expandedBy:1)
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1866
    ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1867
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1868
    "Modified: / 21-08-1998 / 20:16:41 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1869
    "Modified (comment): / 16-02-2017 / 11:15:09 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1870
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1871
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1872
cropSubImageAt: aPoint
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1873
    "called from button-press/button motion while in crop-subImage mode:
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1874
     drag a filled box, 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1875
     when released, change the image to the new bounds"
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1876
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1877
    |choosenBox imageBox|
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1878
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1879
    choosenBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1880
    choosenBox notNil ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1881
        imageBox := choosenBox origin//magnification extent: (choosenBox extent//magnification).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1882
        self specialOperation:#editSubImage on:imageBox withColor:nil.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1883
    ]
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1884
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1885
    "Created: / 20-02-2017 / 17:27:50 / cg"
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1886
!
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  1887
5485
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1888
fillAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1889
    "called from button-press motion while in floo-fill drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1890
     perform a flood-fill with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1891
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1892
    windowGroup withExecuteCursorDo:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1893
        |filledPoints clr|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1894
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1895
        (clr := self selectedColor) notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1896
            self updateActivity:'Flood filling - press CTRL-y to abort ...'.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1897
            [
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1898
                |pix|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1899
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1900
                (clr := self drawingColorOrNil) notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1901
                    pix := image valueFromColor:clr.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1902
                ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1903
                    pix := self drawingPixelOrNil.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1904
                ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1905
                image floodFillAt:aPoint//magnification withValue:pix 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1906
                      maxDeviationInLight:floodFillMaxLightError 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1907
                      maxDeviationInHue:floodFillMaxHueError.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1908
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1909
                image restored.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1910
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1911
                self invalidate.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1912
                self changed:#subImageIn with:(image bounds).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1913
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1914
                self setModified.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1915
            ] ifCurtailed:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1916
                self updateActivity:'Flood fill aborted.'
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1917
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1918
        ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1919
        self updateActivity:''
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1920
    ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1921
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1922
    "Modified: / 17-02-2017 / 15:30:38 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1923
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1924
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1925
filledBoxAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1926
    "called from button-press/button motion while in filled rectangle-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1927
     drag a filled box, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1928
     when released, fill a rectangular area with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1929
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1930
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1931
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1932
            colorOrPixel isColor notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1933
                image fillRectangle:box withColor:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1934
            ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1935
                image fillRectangle:box withValue:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1936
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1937
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1938
        at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1939
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1940
    "Modified: / 16-02-2017 / 12:08:46 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1941
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1942
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1943
filledCircleAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1944
    "called from button-press/button motion while in filled circle-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1945
     drag a filled ellipse, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1946
     when released, fill an ellipse with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1947
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1948
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1949
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1950
            colorOrPixel isColor notNil ifTrue:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1951
                image fillEllipse:box withColor:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1952
            ] ifFalse:[
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1953
                image fillEllipse:box withValue:colorOrPixel.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1954
            ].
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1955
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1956
        at:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1957
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1958
    "Created: / 16-02-2017 / 11:10:17 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1959
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1960
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1961
maskOutsideCircleAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1962
    "called from button-press/button motion while in filled rectangle-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1963
     drag a box, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1964
     when released, mask everything outside the rectangular area"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1965
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1966
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1967
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1968
            |newForm oldForm|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1969
            
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1970
            newForm := Form extent:image extent depth:1 onDevice:Screen current.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1971
            newForm paint:(Color colorId:0).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1972
            newForm fillRectangle:(newForm bounds).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1973
            newForm paint:(Color colorId:1).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1974
            newForm fillCircleIn:box.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1975
            oldForm := image mask asFormOn:Screen current.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1976
            newForm function:#and.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1977
            newForm paint:(Color colorId:1) on:(Color colorId:0).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1978
            newForm copyFrom:oldForm x:0 y:0 toX:0 y:0 width:image width height:image height.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1979
            image mask:(ImageMask fromForm:newForm).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1980
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1981
            "/ wrong: does not preserve already masked pixels...
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1982
            "/ image mask fillRectangle:(image bounds) withValue:0.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1983
            "/ image mask fillEllipse:box withValue:1.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1984
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1985
        at:aPoint.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1986
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1987
    image restored.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1988
    self invalidate.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1989
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1990
    "Created: / 16-02-2017 / 12:33:25 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1991
    "Modified: / 17-02-2017 / 16:47:47 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1992
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1993
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1994
maskOutsideRectAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1995
    "called from button-press/button motion while in filled rectangle-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1996
     drag a box, 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1997
     when released, mask everything outside the rectangular area"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1998
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  1999
    self 
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2000
        commonBoxOperation:[:box :colorOrPixel |
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2001
            |newForm oldForm|
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2002
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2003
            newForm := Form extent:image extent depth:1 onDevice:Screen current.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2004
            newForm paint:(Color colorId:0).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2005
            newForm fillRectangle:(newForm bounds).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2006
            newForm paint:(Color colorId:1).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2007
            newForm fillRectangle:box.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2008
            oldForm := image mask asFormOn:Screen current.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2009
            newForm function:#and.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2010
            newForm paint:(Color colorId:1) on:(Color colorId:0).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2011
            newForm copyFrom:oldForm x:0 y:0 toX:0 y:0 width:image width height:image height.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2012
            image mask:(ImageMask fromForm:newForm).
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2013
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2014
            "/ wrong: does not preserve already masked pixels...
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2015
            "/image mask fillRectangle:(image bounds) withValue:0.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2016
            "/image mask fillRectangle:box withValue:1.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2017
        ]
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2018
        at:aPoint.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2019
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2020
    image restored.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2021
    self invalidate.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2022
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2023
    "Created: / 16-02-2017 / 12:33:06 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2024
    "Modified: / 17-02-2017 / 17:23:57 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2025
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2026
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2027
pasteAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2028
    "called from button-press/button motion while in paste mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2029
     paste the image in the clipboard at aPoint"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2030
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2031
    self pasteAt:aPoint mode:nil.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2032
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2033
    "Modified (comment): / 16-02-2017 / 11:13:54 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2034
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2035
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2036
pasteUnderAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2037
    "called from button-press/button motion while in paste mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2038
     pasteUnder the image in the clipboard at aPoint.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2039
     In this mode, only pixels which are not equal to
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2040
     the current color or masked are pasted."
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2041
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2042
    self pasteAt:aPoint mode:#under.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2043
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2044
    "Modified (comment): / 16-02-2017 / 11:14:04 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2045
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2046
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2047
pasteWithMaskAt: aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2048
    "called from button-press/button motion while in paste mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2049
     paste the image in the clipboard at aPoint.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2050
     In this mode, both the mask and the image pixel are pasted"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2051
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2052
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2053
    self pasteAt:aPoint mode:#withMask.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2054
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2055
    "Modified (comment): / 16-02-2017 / 11:14:08 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2056
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2057
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2058
pointAt:aPoint
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2059
    "called from button-press/button motion while in point-drawing mode:
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2060
     draw a single pixel with the currently selected color"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2061
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2062
    self pointAt:aPoint width:self penWidth.
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2063
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2064
    "Modified: / 15-02-2012 / 22:47:30 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2065
    "Modified (comment): / 16-02-2017 / 11:13:06 / cg"
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2066
!
fa049861df83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2067
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2068
smoothAt:aPoint
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2069
    "called from button-press/button motion while in smoothing mode:
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2070
     smoth (average) a single pixel with pixels around"
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2071
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2072
    |draw imagePoint x y w h|
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2073
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2074
    imagePoint := aPoint // magnification.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2075
    w := image width.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2076
    h := image height.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2077
    ((x := imagePoint x) between:0 and:w-1) ifFalse:[^ self].
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2078
    ((y := imagePoint y) between:0 and:h-1) ifFalse:[^ self].
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2079
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2080
    draw := 
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2081
        [:point |
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2082
            |sumRed sumGreen sumBlue newClr|
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2083
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2084
            sumRed := sumGreen := sumBlue := 0.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2085
            -1 to:1 do:[:dx |
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2086
                -1 to:1 do:[:dy |
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2087
                    |clr|
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2088
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2089
                    ((x + dx) between:0 and:w-1) ifTrue:[
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2090
                        ((y + dy) between:0 and:h-1) ifTrue:[   
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2091
                            clr := image colorAtX:(x + dx) y:(y + dy).
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2092
                            sumRed := sumRed + clr redByte.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2093
                            sumGreen := sumGreen + clr greenByte.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2094
                            sumBlue := sumBlue + clr blueByte.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2095
                        ]
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2096
                    ].
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2097
                ]
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2098
            ].
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2099
            newClr := Color 
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2100
                        redByte:(sumRed / 9) rounded
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2101
                        greenByte:(sumGreen / 9) rounded 
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2102
                        blueByte:(sumBlue / 9) rounded. 
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2103
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2104
            image colorMap isNil ifTrue:[
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2105
                "/ Transcript 
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2106
                "/     show:(image colorAt:point);
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2107
                "/     show:' -> ';
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2108
                "/     showCR:newClr.
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2109
                image atImageAndMask:point put:newClr.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2110
            ] ifFalse:[
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2111
                image atImageAndMask:point put:(image colorMap colorNearestTo:newClr).
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2112
            ].             
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2113
            self invalidate:((point * magnification extent: magnification) expandedBy:1).
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2114
        ].
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2115
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2116
    draw value:imagePoint.
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2117
    self setModified.
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2118
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2119
    "Modified: / 16-02-2017 / 12:34:41 / cg"
4715
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2120
!
c851a10dd606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4714
diff changeset
  2121
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2122
specialOperationAt: aPoint
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2123
    "special operation on a rectangular area"
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2124
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2125
    |choosenBox operation imageBox|
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2126
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2127
    choosenBox := self dragRectangleStartingAt: aPoint emphasis:#inverseFilledBox.
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2128
    choosenBox isNil ifTrue:[ ^ self ].
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2129
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2130
    operation := self askForSpecialOperation.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2131
    operation isNil ifTrue:[^ self].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2132
    
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2133
    imageBox := choosenBox origin//magnification extent: (choosenBox extent//magnification).
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2134
    self specialOperation:operation on:imageBox withColor:self selectedColor.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2135
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2136
    "Modified: / 20-02-2017 / 17:38:32 / cg"
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2137
!
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2138
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2139
sprayAt: aPoint
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2140
    "called from button-press/button motion while in spray mode:
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2141
     start spraying with the currently selected color"
3476
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2142
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2143
    |clr|
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2144
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2145
    (clr := self selectedColor) notNil ifTrue:[
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2146
        sprayPosition := aPoint.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2147
        self startSpray.
4b4dce2bd87b +spray and circle
Claus Gittinger <cg@exept.de>
parents: 3435
diff changeset
  2148
    ].
5480
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2149
4333dad478a5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  2150
    "Modified (comment): / 16-02-2017 / 11:12:28 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  2151
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  2152
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2153
!ImageEditView methodsFor:'image manipulation'!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2154
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2155
brightenImage
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2156
    self newImageWithUndo: (image copy lightened).
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2157
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2158
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2159
darkenImage
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2160
    self newImageWithUndo: (image copy darkened).
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2161
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2162
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2163
flipHorizontal
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2164
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2165
    self newImageWithUndo: image copy flipHorizontal.
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2166
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2167
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2168
flipVertical
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2169
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2170
    self makeUndo.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2171
    self image: image copy flipVertical.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2172
    self setModified.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2173
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2174
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2175
makeBorderedImageX:newX y:newY width:newWidth height:newHeight
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2176
    |newImage oldWidth oldHeight|
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2177
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2178
    oldWidth := image width.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2179
    oldHeight := image height.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2180
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2181
    newImage := image class width:newWidth height:newHeight depth:image depth.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2182
    newImage photometric:image photometric.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2183
    newImage colorMap:image colorMap copy.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2184
    newImage bits:(ByteArray new:(newImage bytesPerRow * newHeight)).
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2185
2842
fe13fb01edd3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2841
diff changeset
  2186
    image mask notNil ifTrue:[
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2187
        |newMaskImage|
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2188
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2189
        newMaskImage := Depth1Image width:newWidth height:newHeight.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2190
        newMaskImage photometric: image mask photometric.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2191
        newMaskImage colorMap: image mask colorMap copy.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2192
        newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newHeight).
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2193
        newImage mask: newMaskImage
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2194
    ].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2195
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2196
    newImage copyFrom:image x:0 y:0 toX:newX y:newY width:oldWidth height:oldHeight.
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2197
    self newImageWithUndo:newImage.
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2198
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2199
    "Created: / 7.9.1998 / 13:00:16 / cg"
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2200
    "Modified: / 7.9.1998 / 14:15:32 / cg"
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2201
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2202
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2203
makeBrighter
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2204
    ^ self makeNewColorMapByMapping:[:clr | clr lightened].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2205
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2206
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2207
makeDarker
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2208
    ^ self makeNewColorMapByMapping:[:clr | clr darkened].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2209
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2210
2841
0f0750749f34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2839
diff changeset
  2211
makeGrayScaleImage
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2212
    ^ self makeNewColorMapByMapping:
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2213
        [:clr | Color brightness:(clr brightness)].
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2214
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2215
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2216
makeInverse
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2217
    ^ self makeNewColorMapByMapping:
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2218
        [:clr | 
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2219
            Color red:(100-clr red) green:(100-clr green) blue:(100-clr blue)
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2220
        ].
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2221
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2222
3971
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2223
makeSlightlyBrighter
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2224
    ^ self makeNewColorMapByMapping:
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2225
        [:clr | 
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2226
            clr brightness > Color lightGray brightness
5163
955f893d03f2 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5093
diff changeset
  2227
                ifTrue:[ clr blendWith:self whiteColor ] 
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2228
                ifFalse:[ clr blendWith:Color lightGray ]
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2229
        ].
3971
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2230
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2231
    "Created: / 24-11-2010 / 11:08:18 / cg"
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2232
!
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2233
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2234
makeSlightlyDarker
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2235
    ^ self makeNewColorMapByMapping:
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2236
        [:clr | 
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2237
            clr brightness < Color darkGray brightness
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2238
                ifTrue:[ clr blendWith:Color black ] 
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2239
                ifFalse:[ clr blendWith:Color darkGray ]
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2240
        ].
3971
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2241
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2242
    "Created: / 24-11-2010 / 11:08:08 / cg"
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2243
!
Claus Gittinger <cg@exept.de>
parents: 3931
diff changeset
  2244
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2245
negativeImage
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2246
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2247
    self newImageWithUndo: (image copy bits:(image bits invert)).
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2248
!
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2249
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2250
newImageWithUndo:newImage
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2251
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2252
    self makeUndo.
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2253
    self image: newImage.
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2254
    self setModified.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2255
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2256
5491
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2257
performSpecialOperation:operation on:imageBox withColor:clr
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2258
    "actually perform one of the special operations on the previously selected imageBox"    
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2259
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2260
    |x0 y0 x1 y1 pixelAction requiredColors missingColors answer hue|
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2261
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2262
    x0 := imageBox left.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2263
    y0 := imageBox top.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2264
    x1 := imageBox right - 1.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2265
    y1 := imageBox bottom -1 .
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2266
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2267
    operation == #edit ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2268
        (self image subImageIn:imageBox) edit.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2269
        ^ false.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2270
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2271
    operation == #editSubImage ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2272
        self makeUndo.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2273
        self image:(self image subImageIn:imageBox).
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2274
        ^ false.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2275
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2276
    operation == #flipVertical ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2277
        self flipSubImage:#vertical in:imageBox.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2278
        ^ true.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2279
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2280
    operation == #flipHorizontal ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2281
        self flipSubImage:#horizontal in:imageBox.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2282
        ^ true.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2283
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2284
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2285
    operation == #slightlyBrightened ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2286
        pixelAction := [:x :y :clr | clr slightlyLightened].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2287
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2288
    operation == #slightlyDarkened ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2289
        pixelAction := [:x :y :clr | clr slightlyDarkened].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2290
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2291
    operation == #brightened ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2292
        pixelAction := [:x :y :clr | clr lightened].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2293
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2294
    operation == #darkened ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2295
        pixelAction := [:x :y :clr | clr darkened].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2296
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2297
    operation == #reversed ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2298
        pixelAction := [:x :y :clr | Color red:(100-clr red) green:(100-clr green) blue:(100-clr blue) ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2299
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2300
    operation == #makeGrey ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2301
        pixelAction := [:x :y :clr | Color grey:(clr greyIntensity)].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2302
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2303
    operation == #greyed ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2304
        pixelAction := [:x :y :clr | clr blendWith:Color gray].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2305
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2306
    operation == #greyPattern ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2307
        pixelAction := [:x :y :clr | x odd == y even 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2308
                                        ifTrue:[Color gray] 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2309
                                        ifFalse:[clr]].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2310
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2311
    operation == #unmaskedGreyPattern ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2312
        pixelAction := [:x :y :clr | x odd == y even 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2313
                                        ifTrue:[self image maskAtX:x y:y put:1. Color gray] 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2314
                                        ifFalse:[clr]].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2315
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2316
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2317
    operation == #changeHue ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2318
        hue := Dialog request:'Hue (0..360)\red->yellow->green->blue->red' withCRs.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2319
        hue := Number readFrom:hue onError:nil.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2320
        hue isNil ifTrue:[^ false].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2321
        pixelAction := [:x :y :clr | Color hue:(hue+(clr hue?0)) light:clr light saturation:clr saturation].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2322
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2323
    operation == #colorize ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2324
        hue := Dialog request:'Hue (0..360)\red->yellow->green->blue->red' withCRs.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2325
        hue := Number readFrom:hue onError:nil.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2326
        hue isNil ifTrue:[^ false].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2327
        pixelAction := [:x :y :clr | Color hue:hue light:clr light saturation:100]
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2328
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2329
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2330
    pixelAction isNil ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2331
        self halt:(resources string:'no pixelAction'). 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2332
        ^ false
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2333
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2334
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2335
    image colorMap notNil ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2336
        "/ compute required colors ...
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2337
        requiredColors := Set new.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2338
        self image 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2339
            colorsFromX:x0 y:y0 toX:x1 y:y1 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2340
            do:[:x :y :clr | 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2341
                requiredColors add:(pixelAction value:x value:y value:clr)
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2342
            ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2343
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2344
        missingColors := requiredColors reject:[:clr | (image colorMap includes:clr)].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2345
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2346
        missingColors notEmpty ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2347
            answer := Dialog
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2348
                        confirmWithCancel:(resources stringWithCRs:'Some color(s) cannot be represented in the images colorMap.\Use nearest or compute colorMap ?')
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2349
                        labels:#( 'Cancel' 'Add to ColorMap'  'Use Nearest')
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2350
                        values:#( nil add nearest)
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2351
                        default:3.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2352
            answer isNil ifTrue:[^ false].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2353
            answer == #add ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2354
                missingColors size + image colorMap size > (2 raisedTo:image depth) ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2355
                    self warn:(resources string:'Missing colors cannot be added to images colormap.').
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2356
                    ^ false
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2357
                ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2358
                missingColors do:[:eachColor |
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2359
                    image colorMap add:eachColor
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2360
                ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2361
                answer := #nearest.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2362
            ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2363
        ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2364
    ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2365
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2366
    "/ now, do it
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2367
    self image 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2368
        colorsFromX:x0 y:y0 toX:x1 y:y1 
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2369
        do:[:x :y :clr |
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2370
            |newClr|
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2371
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2372
            newClr := pixelAction value:x value:y value:clr.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2373
            answer == #nearest ifTrue:[
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2374
                newClr := newClr nearestIn:image colorMap
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2375
            ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2376
            self image colorAtX:x y:y put:newClr
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2377
        ].
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2378
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2379
    self setModified.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2380
    ^ true.
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2381
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2382
    "Created: / 20-02-2017 / 17:30:00 / cg"
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2383
!
a78da5678d29 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  2384
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2385
reduceColorResolutionBy:numBits
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2386
    |newImage|
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2387
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2388
    numBits > 7 ifTrue:[
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  2389
        self warn:(resources string:'Max. number of bits to strip off is 7.').
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2390
        ^ false
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2391
    ].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2392
    newImage := image withColorResolutionReducedBy:numBits.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2393
    newImage isNil ifTrue:[
5061
f8346c455a4b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5029
diff changeset
  2394
        self warn:(resources string:'Could not reduce color resolution.').
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2395
        ^ false.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2396
    ].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2397
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2398
    self newImageWithUndo:newImage.
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2399
    ^ true
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2400
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2401
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2402
resizeImageTo:newSize
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2403
    self newImageWithUndo: (self resizedImage:image to:newSize).
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2404
!
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2405
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2406
resizedImage:image to:newSize
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2407
    "helper for image resize and mask resize.
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2408
     return a resized version of image"
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2409
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2410
    |newImage newMaskImage|
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2411
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2412
    newImage := image class width: newSize x height: newSize y depth: image depth.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2413
    newImage photometric:image photometric.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2414
    newImage colorMap:image colorMap copy.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2415
    newImage bits: (ByteArray new: newImage bytesPerRow * newSize y).
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2416
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2417
    image mask notNil ifTrue:[
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2418
        newMaskImage := Depth1Image width: newSize x height: newSize y.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2419
        newMaskImage photometric: image mask photometric.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2420
        newMaskImage colorMap: image mask colorMap copy.
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2421
        newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newSize y).
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2422
        newImage mask: newMaskImage
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2423
    ].
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2424
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2425
    newImage copyFrom:image x:0 y:0 toX:0 y:0 width: (image width min:newSize x) height: (image height min:newSize y).
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2426
    ^ newImage.
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2427
!
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2428
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2429
rotateImageBy:rotation
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2430
    "rotate by (degrees)"
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2431
4212
4b84444912b5 exception access
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2432
    Error handle:[:ex|
3435
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2433
        self warn: 'Image rotation failed!!\' withCRs, 'Increasing the image depth could help.'
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2434
    ] do:[   
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2435
        self newImageWithUndo: (image hardRotated: rotation).
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2436
    ]
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2437
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2438
    "Modified: / 29.7.1998 / 18:21:14 / cg"
3435
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2439
!
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2440
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2441
threeDProjection:dx1 and:dx2
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2442
    "3D projection"
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2443
4212
4b84444912b5 exception access
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2444
    Error handle:[:ex|
3435
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2445
        self warn: 'Image projection failed!!\' withCRs, 'Increasing the image depth could help.'
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2446
    ] do:[   
4730
bcf8e15b7606 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  2447
        self newImageWithUndo:(image threeDProjected:dx1 and:dx2)
3435
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2448
    ]
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2449
400079196849 3D perspecitve (first attempt)
Claus Gittinger <cg@exept.de>
parents: 3319
diff changeset
  2450
    "Modified: / 29.7.1998 / 18:21:14 / cg"
2839
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2451
! !
312c7d2616bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  2452
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2453
!ImageEditView methodsFor:'image-dragging & info'!
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2454
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2455
dragRectangleStartingAt:aPointIn emphasis:emphasis
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2456
    "draw a drag rectangle (filled or unfilled, depending on the emphasis arg).
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2457
     This is called by operation like 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2458
     rectangle, filledRectangle, copy etc. 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2459
     (i.e. any operation which operates on a box).
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2460
     emphasis is one of:
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2461
        box              - a frame is drawn
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2462
        inverseFilledBox - the dragged box is filled by the inverse color
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2463
        filledBox        - the dragged box is filled with black
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2464
        grayedBox        - the dragged box is drawn with a gray shadow
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2465
    "
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2466
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2467
    |currentPoint currentExtent firstPoint lastCurrentPoint gridCorrection 
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2468
     mp lastMp p whichQuarter scrollX scrollY aPoint sensor|
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2469
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2470
    aPoint := aPointIn.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2471
    firstPoint := currentPoint := lastCurrentPoint :=  aPoint//magnification*magnification.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2472
    magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2473
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2474
    sensor := self sensor.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2475
    [sensor anyButtonPressed] whileTrue: [                                                  
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2476
        (sensor hasKeyEventFor:nil) ifTrue:[
2838
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2477
            self invalidate.
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2478
            ^ nil.
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2479
        ].
8525a35121d2 changeHLS fixed dfor depth24-images;
Claus Gittinger <cg@exept.de>
parents: 2824
diff changeset
  2480
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2481
        mp := sensor mousePoint.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2482
        mp = lastMp ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2483
            Delay waitForSeconds:0.05
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2484
        ] ifFalse:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2485
            lastMp := mp.
4999
e0111330133e device access
Claus Gittinger <cg@exept.de>
parents: 4967
diff changeset
  2486
            mp := device translatePoint:mp fromView:nil toView:self.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2487
            "/ mp is a device coordinate here ...
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2488
            scrollX := 0.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2489
            mp x > width ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2490
                scrollX := mp x - width.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2491
            ] ifFalse:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2492
                mp x < 0 ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2493
                    scrollX := mp x.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2494
                ]
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2495
            ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2496
            scrollY := 0.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2497
            mp y > height ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2498
                scrollY := mp y - height.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2499
            ] ifFalse:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2500
                mp y < 0 ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2501
                    scrollY := mp y.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2502
                ]
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2503
            ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2504
            (scrollX + scrollY) ~~ 0 ifTrue:[
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2505
                self scrollTo:(self viewOrigin + (scrollX @ scrollY)).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2506
                lastMp := nil.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2507
            ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2508
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2509
            mp := mp + self viewOrigin.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2510
            "/ mp is now a logical coordinate.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2512
            currentPoint := (0@0) max: (image extent * magnification min: (p := mp)).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2513
            currentPoint := currentPoint//magnification*magnification.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2514
            currentExtent := (firstPoint - currentPoint) abs.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2515
            whichQuarter := (firstPoint x - currentPoint x) > 0 
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2516
                 ifTrue:  [(firstPoint y - currentPoint y) > 0 ifTrue: ["4"1@1] ifFalse: ["3"1@0]]
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2517
                 ifFalse: [(firstPoint y - currentPoint y) > 0 ifTrue: ["1"0@1] ifFalse: ["2"0@0]].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2518
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2519
            self showCursorAt: p andInformation: 
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2520
                ((firstPoint//magnification - whichQuarter + 1) printString, 
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2521
                ' to: ', 
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2522
                (currentPoint//magnification + whichQuarter) printString),
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2523
                ' (extent: ',
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2524
                (currentExtent//magnification) printString, ')'.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2525
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2526
            currentPoint ~= lastCurrentPoint ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2527
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2528
                emphasis == #grayedBox ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2529
                    "/ does not yet work                
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2530
                    |org ext|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2531
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2532
                    "/ org := (firstPoint min: lastCurrentPoint) - 1.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2533
                    "/ ext := (firstPoint - lastCurrentPoint) abs + 2.
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2534
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2535
                    (lastCurrentPoint x > currentPoint x
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2536
                      or:[ (lastCurrentPoint y > currentPoint y) ]
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2537
                    ) ifTrue:[
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2538
                        self 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2539
                            redrawImageX:firstPoint x"-1" y:firstPoint y"-1" 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2540
                            width:(lastCurrentPoint x-firstPoint x"+2") height:(lastCurrentPoint y-firstPoint y"+2")
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2541
                            unmaskedOnly:false processColorsWith:[:clr | clr ].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2542
                        "/ self drawFramesIn:(firstPoint corner:lastCurrentPoint).   
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2543
                    ].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2544
                    
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2545
                    self 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2546
                        redrawImageX:firstPoint x"-1" y:firstPoint y"-1 "
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2547
                        width:(currentPoint x-firstPoint x"+2") height:(currentPoint y-firstPoint y"+2") 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2548
                        unmaskedOnly:true processColorsWith:[:clr | Color gray: clr grayIntensity / 2 ].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2549
                ].
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2550
                
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2551
                emphasis == #inverseFilledBox ifTrue: [
5414
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2552
                    |union invertOutside|
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2553
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2554
                    invertOutside := false.
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2555
"/                    union := (firstPoint corner:currentPoint) merge:(firstPoint corner:lastCurrentPoint).
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2556
"/                    ((lastCurrentPoint x > currentPoint x)
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2557
"/                    and:[ lastCurrentPoint y > currentPoint y ]) ifTrue:[
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2558
"/                        "/ a real shrink
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2559
"/                        invertOutside := true.
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2560
"/                        self xoring: [ 
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2561
"/                            union areasOutside:(firstPoint corner:lastCurrentPoint) do:[:r |
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2562
"/                                self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection) 
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2563
"/                            ]
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2564
"/                        ]
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2565
"/                    ] ifFalse:[    
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2566
"/                        ((currentPoint x > lastCurrentPoint x)
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2567
"/                        and:[ currentPoint y > lastCurrentPoint y ]) ifTrue:[
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2568
"/                            "/ a real grow
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2569
"/                            invertOutside := true.
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2570
"/                            self xoring: [ 
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2571
"/                                union areasOutside:(firstPoint corner:currentPoint) do:[:r |
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2572
"/                                    self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection) 
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2573
"/                                ]
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2574
"/                            ]
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2575
"/                        ].     
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2576
"/                    ].
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2577
                    invertOutside ifFalse:[    
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2578
                        self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2579
                        gc xoring: [ 
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2580
                            gc fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection) 
5414
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2581
                        ]
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2582
                    ].
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2583
                ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2584
                
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2585
                emphasis == #box ifTrue:[
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2586
                    |origin extent lineWidthY lineWidthX|
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2587
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2588
                    origin := (firstPoint min: lastCurrentPoint) - 1.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2589
                    extent := (firstPoint - lastCurrentPoint) abs + 2.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2590
                    lineWidthY := extent y min: (magnification y + 2).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2591
                    lineWidthX := extent x min: (magnification x + 2).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2592
                    self redraw: (origin extent: (extent x@lineWidthY)).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2593
                    self redraw: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2594
                    self redraw: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2595
                    self redraw: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2596
                    (self selectedColor ~= Color noColor)
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2597
                        ifTrue: [gc paint: self selectedColor]
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2598
                        ifFalse: [gc paint: self viewBackground]. 
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2599
                    origin := (firstPoint min: currentPoint) + margin.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2600
                    extent := currentExtent - gridCorrection.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2601
                    lineWidthY := extent y min: magnification y.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2602
                    lineWidthX := extent x min: magnification x.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2603
                    (lineWidthY > 0 and: [lineWidthX > 0]) ifTrue:[
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2604
                        gc fillRectangle: (origin extent: (extent x@lineWidthY)).
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2605
                        gc fillRectangle: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2606
                        gc fillRectangle: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2607
                        gc fillRectangle: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2608
                    ]
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2609
                ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2610
                
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2611
                emphasis == #filledBox ifTrue:[
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2612
                    self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2613
                    (self selectedColor ~= Color noColor)
5432
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2614
                        ifTrue: [gc paint: self selectedColor]
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2615
                        ifFalse: [gc paint: self viewBackground].
6f103b797668 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2616
                    gc fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection).
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2617
                ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2618
            ]. 
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2619
            lastCurrentPoint := currentPoint.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2620
        ].                  
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2621
    ].                  
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2622
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2623
    ^((0@0) max: (firstPoint min: currentPoint)) extent: (firstPoint - currentPoint) abs
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2624
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2625
    "Created: / 21.8.1998 / 20:17:07 / cg"
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2626
    "Modified: / 10.10.2001 / 14:13:08 / cg"
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2627
!
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2628
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2629
drawCursorAt:aPoint
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2630
    "the mouse was moved to aPoint (in the image).
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2631
     Update the info (showing rgb + other info) in the lower info bar.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2632
     Also changes the cursor to a stop-cursor, if outside the image"
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2633
     
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2634
    |imgPoint shownCursor|
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2635
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2636
    readOnly ifTrue:[^ self].
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2637
    image isNil ifTrue: [
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2638
        self updateImageInfo:(self imageInfoString). 
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2639
        self cursor:Cursor stop.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2640
        ^ self
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2641
    ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2642
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2643
    imgPoint := aPoint // magnification.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2644
    ((imgPoint x between:0 and:(image width-1)) 
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2645
      and:[imgPoint y between:0 and: (image height-1)]
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2646
    ) ifFalse:[
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2647
        self updateImageInfo:(self imageInfoString). 
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2648
        shownCursor := Cursor stop.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2649
    ] ifTrue: [
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2650
        self updateImageInfoFor:imgPoint.
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2651
        shownCursor := Cursor crossHair
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2652
    ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2653
    self cursor:shownCursor.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2654
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2655
    "Modified: / 03-05-2011 / 12:27:52 / cg"
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2656
    "Modified (format): / 16-02-2017 / 17:09:13 / cg"
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2657
!
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2658
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2659
imageInfoString
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2660
    image isNil ifTrue: [^ 'No image loaded.'].
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2661
    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2662
    ^ String streamContents:[:s |
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2663
        |d|
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2664
        
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2665
        s print:image width.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2666
        s print:'x'.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2667
        s print:image height.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2668
        s print:' | '.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2669
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2670
        s print:(image depth).
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2671
        s print:'bit'.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2672
        image mask notNil ifTrue: [s print:'+mask'].
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2673
        
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2674
        d := image depth min:24.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2675
        ' [%1/%2 colors]' expandPlaceholdersWith:{image nColorsUsed. (2 raisedTo:d)} on:s.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2676
    ].
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2677
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2678
    "Modified: / 16-02-2017 / 17:26:19 / cg"
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2679
!
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2680
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2681
showCursorAt: aPoint andInformation: aLabel
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2682
    |shownCursor|
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2683
    
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2684
    readOnly ifTrue:[^ self].
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2685
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2686
    ((0@0 extent: image extent * magnification) containsPoint: aPoint)
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2687
         ifTrue: [ shownCursor := Cursor crossHair ]
5414
641d2f0d748c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5413
diff changeset
  2688
         ifFalse:[ shownCursor := Cursor stop ].
5413
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2689
    self cursor:shownCursor. 
6211fc3b725a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5405
diff changeset
  2690
    self updateImageInfo: aLabel.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2691
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2692
    "Modified: / 03-05-2011 / 12:28:15 / cg"
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2693
!
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2694
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2695
updateActivity: something
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2696
    |msg|
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2697
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2698
    msg := something printString.
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2699
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2700
    activityInfoHolder notNil ifTrue:[
3847
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2701
        activityInfoHolder value:msg.
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2702
    ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2703
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2704
    "Modified: / 29.7.1998 / 18:41:47 / cg"
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2705
!
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2706
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2707
updateImageInfo:something
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2708
    "show something in the lower info area"
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2709
    
3847
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2710
    |msg|
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2711
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2712
    imageInfoHolder notNil ifTrue:[
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2713
        msg := something printString.
3847
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2714
        msg ~= imageInfoHolder value ifTrue:[
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2715
            imageInfoHolder value:msg.
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2716
        ].
c09d45071125 comment/format in: #updateImageInfo:
Claus Gittinger <cg@exept.de>
parents: 3840
diff changeset
  2717
        ^ self
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2718
    ].
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2719
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2720
    "Modified: / 16-02-2017 / 17:10:00 / cg"
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2721
!
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2722
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2723
updateImageInfoFor:aPoint
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2724
    "show info about the pixel at aPoint in the lower info area"
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2725
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2726
    |clr pixel r g b a m|
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2727
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2728
    clr := image colorAt:aPoint.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2729
    pixel := image pixelAt:aPoint.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2730
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2731
    r := clr redByte.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2732
    g := clr greenByte.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2733
    b := clr blueByte.
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2734
    image hasAlphaChannel ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2735
        "/ a := clr alphaByte.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2736
        a := (pixel bitShift:(image alphaShiftForPixelValue)) bitAnd:(image alphaMaskForPixelValue).
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2737
    ] ifFalse:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2738
        image mask notNil ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2739
            m := image mask pixelAt:aPoint.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2740
        ].    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2741
    ].
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2742
    
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2743
    self updateImageInfo:
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2744
        (String streamContents:[:s |
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2745
            s print:aPoint.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2746
            s print:' (r:'; print:r.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2747
            s print:' g:'; print:g.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2748
            s print:' b:'; print:b.
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2749
            a notNil ifTrue:[
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2750
                s print:' a:'; print:a.
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2751
            ] ifFalse:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2752
                m notNil ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2753
                    s print:' m:'; print:m.
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2754
                ].    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2755
            ].    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2756
            s print:(' #%1.%2.%3' bindWith:(r hexPrintString:2) with:(g hexPrintString:2) with:(b hexPrintString:2)).
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2757
            a notNil ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2758
                s print:'.'; print:(a hexPrintString:2)
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2759
            ].    
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2760
            image photometric == #palette ifTrue:[
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2761
                s print:' pixel (index):'; print:pixel.
3729
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2762
            ].
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2763
            s print:')'.
6f6cfc8bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3706
diff changeset
  2764
        ])
5481
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2765
3ed986b5812d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  2766
    "Modified: / 16-02-2017 / 17:24:02 / cg"
2511
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2767
! !
10537dc4e961 category change
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2768
2818
d255fb7d54fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  2769
!ImageEditView methodsFor:'initialization & release'!
1327
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2770
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2771
destroy
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  2772
    ClipboardMagnified := Clipboard := nil.
1327
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2773
    LastMagnification      := magnification.
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2774
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2775
    super destroy
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  2776
!
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  2777
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  2778
initialize
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  2779
    super initialize.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  2780
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2781
    readOnly := false.
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2782
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  2783
    self enableMotionEvents.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  2784
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  2785
    undoImages        := List new: MaxUndos.
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2786
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  2787
    magnification     := LastMagnification ? (8@8).
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  2788
    modifiedHolder    := false asValue.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  2789
    mouseKeyColorMode := 1.
2908
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
  2790
    resourceClass     := resourceSelector := nil.
2009
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  2791
    drawingColorHolders := Array with:(nil asValue) with:(nil asValue).   "/ left/right mouse colors
4f556ff9fec5 pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  2792
    drawingPixelHolders := Array with:(nil asValue) with:(nil asValue).   "/ left/right mouse colors
4111
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  2793
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  2794
    spraySpot := 8.
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  2795
    penWidth := 1.
5483
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
  2796
    floodFillMaxHueError := floodFillMaxLightError := 0.
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  2797
    userAllowedToChangeDrawingColor := true.
5483
87e33f13ffe2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
  2798
    
2889
69423b4e0cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2843
diff changeset
  2799
    self editMode:EditModePoint.
4041
2d635ff57406 class definition
Claus Gittinger <cg@exept.de>
parents: 4032
diff changeset
  2800
5484
6b12e0653062 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  2801
    "Modified: / 17-02-2017 / 16:24:04 / cg"
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  2802
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  2803
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2804
!ImageEditView methodsFor:'loading & saving'!
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  2805
1994
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2806
askForFileNameToSave:msg
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2807
    "ask for a fileName"
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2808
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2809
    |lastFn fn filters|
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2810
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2811
    filters := FileSelectionBrowser saveImageFileNameFilters.
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2812
    lastFn := self image fileName.
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2813
    lastFn isNil ifTrue:[
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2814
        fn := FileSelectionBrowser
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2815
                request: msg
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2816
                inDirectory: LastSaveDirectory
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2817
                withFileFilters: filters
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2818
    ] ifFalse:[
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2819
        fn := FileSelectionBrowser
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2820
                request: msg
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2821
                fileName: lastFn
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2822
                withFileFilters: filters
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2823
    ].
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2824
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2825
    ^ fn
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2826
!
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2827
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
  2828
loadFromClass
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2829
    |classAndSelector|
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2830
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2831
    classAndSelector := ResourceSelectionBrowser
1184
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2832
            request: 'Load Image From Class'
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2833
            onSuperclass: nil
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2834
            andClass: self resourceClass
1184
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2835
            andSelector: self resourceSelector
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2836
            withResourceTypes: #(image fileImage programImage).
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2837
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2838
    classAndSelector notNil ifTrue:[
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2839
        self loadFromClass:(classAndSelector methodClass) andSelector:(classAndSelector methodSelector) 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2840
    ].
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  2841
!
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  2842
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2843
loadFromClass:aClassOrClassName andSelector: aStringOrSymbol
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2844
    "support for names will vanish - obsolete left over from tz"
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2845
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2846
    imageReaderClass := nil.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2847
    self resourceClass: aClassOrClassName.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2848
    self resourceSelector: aStringOrSymbol.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2849
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2850
    resourceClass isBehavior ifFalse:[^ nil].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2851
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2852
    (resourceClass respondsTo:resourceSelector) ifTrue:[ 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2853
        image := resourceClass perform:resourceSelector.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2854
    ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2855
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2856
    image isNil ifTrue:[^ nil].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2857
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2858
    image := image copy.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2859
    self releaseUndos.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2860
    self image:image.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2861
    self clearModified.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2862
    ^ image
2556
fc4dd338dee5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2555
diff changeset
  2863
!
fc4dd338dee5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2555
diff changeset
  2864
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2865
loadFromFile: aFileName
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2866
    |imageFromFile|
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2867
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2868
    aFileName isNil ifTrue: [^nil].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2869
5029
5f1d1837cbdf #DOCUMENTATION by mawalch
mawalch
parents: 4999
diff changeset
  2870
    Error handle:[:exception|
5f1d1837cbdf #DOCUMENTATION by mawalch
mawalch
parents: 4999
diff changeset
  2871
        self warn: exception errorString.
4351
858c0249bb5a class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4264
diff changeset
  2872
        ^ nil
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2873
    ] do:[ 
4351
858c0249bb5a class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4264
diff changeset
  2874
        (imageFromFile := Image fromFile: aFileName) isNil ifTrue:[
858c0249bb5a class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4264
diff changeset
  2875
            imageFromFile := JPEGReader fromFile:aFileName
858c0249bb5a class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4264
diff changeset
  2876
        ].
858c0249bb5a class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4264
diff changeset
  2877
        imageFromFile notNil ifTrue:[
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2878
            self releaseUndos.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2879
            self image: imageFromFile. 
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2880
            self clearModified.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2881
"/            imageReaderClass := ImageReader allSubclasses
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2882
"/                detect: [:cls| cls isValidImageFile: aFileName asFilename pathName]
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2883
"/                ifNone: [self error: 'Unknown image file format!!']
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2884
        ] ifFalse:[
4965
0f28ee36ec03 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
  2885
            aFileName asFilename isReadable ifTrue:[
0f28ee36ec03 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
  2886
                self error: 'Not an image file (or unrecognized format)'
0f28ee36ec03 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
  2887
            ] ifFalse:[  
0f28ee36ec03 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
  2888
                self error: 'File does not exist or is unreadable'
0f28ee36ec03 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
  2889
            ]
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2890
        ]
2555
43af374dfd5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2544
diff changeset
  2891
    ].
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2892
    ^ imageFromFile
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2893
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2894
    "Modified: / 29.7.1998 / 18:09:13 / cg"
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2895
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2896
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2897
loadFromMessage:classAndSelector
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2898
    "switch to the class and selector specified by classAndSelector."
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2899
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2900
    ^ self loadFromClass:(classAndSelector methodClass) andSelector:(classAndSelector methodSelector)
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2901
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2902
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2903
loadfromClass:aClassOrSymbol andSelector: aStringOrSymbol
3643
b38da5f45af6 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3610
diff changeset
  2904
    <resource: #obsolete>
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2905
    self obsoleteMethodWarning.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  2906
    ^ self loadFromClass:aClassOrSymbol andSelector: aStringOrSymbol
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  2907
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  2908
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  2909
save
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  2910
    self saveImageOrMask: #image.
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  2911
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  2912
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2913
save:image imageOrMask:what
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2914
    "save the image or the mask only (if what == #mask)"
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  2915
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2916
    image isNil ifTrue:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  2917
        Dialog warn:(resources string:'No image to save!!').
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2918
        ^ self.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2919
    ].
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2920
    self save:image imageOrMask:what as:image fileName.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  2921
!
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  2922
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2923
save:image imageOrMask:what as:fileNameArg
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2924
    "save the image or the mask only (if what == #mask)"
628
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  2925
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2926
    |fileName fileNameString|
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2927
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2928
    fileName := fileNameArg asFilename.
2783
ca5705f5c258 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
  2929
    LastSaveDirectory := fileName directoryName.
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  2930
4203
a257aa6878ac class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4149
diff changeset
  2931
    Error handle:[:ex|
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2932
        |msg|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2933
4203
a257aa6878ac class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4149
diff changeset
  2934
        ex creator == Image fileCreationErrorSignal ifTrue:[
1896
0f430b35c451 asText allBold -> allBold
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2935
            msg := resources string:'Cannot create file: ''%1''' with:fileName asFilename pathName allBold
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2936
        ] ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2937
            msg := ex errorString.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2938
        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2939
        Dialog warn:msg.
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2940
    ] do:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2941
        Image informationLostQuerySignal handle:[:ex|
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2942
            "/ should make those warnings visible ...
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2943
            (self confirm:(ex errorString , '\\Save anyway ?') withCRs) ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2944
                ex proceed.
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2945
            ]
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2946
        ] do:[   
4137
1a5fdfd6cd4f withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4129
diff changeset
  2947
            windowGroup withWriteCursorDo:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2948
                |suff fn|
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2949
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2950
                image isNil ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2951
                    ^ self error: 'No image to save!!'
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2952
                ].
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  2953
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2954
                what = #mask ifTrue:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2955
                    image mask isNil ifTrue: [^self error: 'No image mask to save!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2956
                ].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2957
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2958
                fileName name size = 0 ifTrue: [^self error: 'No file name detected!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2959
                suff := fileName suffix asLowercase.
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2960
                imageReaderClass := nil.
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2961
                imageReaderClass := MIMETypes imageReaderForSuffix:suff.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2962
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2963
                imageReaderClass isNil ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2964
                    imageReaderClass := XPMReader. 
2589
10827ba87692 obsolete method calls cleaned up
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
  2965
                    fileNameString := fileName name , '.xpm'.
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2966
                    fileName := fileNameString asFilename.
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2967
                    image fileName:fileNameString.
5314
ecbb23555428 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5286
diff changeset
  2968
                    Dialog warn:(('Don''t know how to write ''.' , suff , '''-files\\Saving in xpm format as ''%1''.') 
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2969
                                withCRs bindWith:fileNameString allBold).
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2970
                ].
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2971
                (imageReaderClass canRepresent:image) ifFalse:[
1991
fff8dc641cff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  2972
                    imageReaderClass == XPMReader ifTrue:[
fff8dc641cff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  2973
                        Dialog warn:('Saving in ''.' , suff , '''-format is not supported (or image cannot be represented in this format).\\Please try another format.') withCRs.
fff8dc641cff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  2974
                        ^ self.
fff8dc641cff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  2975
                    ].
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2976
                    imageReaderClass := XPMReader. 
2589
10827ba87692 obsolete method calls cleaned up
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
  2977
                    fileNameString := fileName name , '.xpm'.
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2978
                    fileName := fileNameString asFilename.
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2979
                    image fileName:fileNameString.
2690
53bc9dc52ce4 allow cancel when saving in wrong format
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
  2980
                    (Dialog confirm:(('Saving in ''.' , suff , '''-format is not supported (or image cannot be represented in this format).\\Saving in xpm format as ''%1''.') 
53bc9dc52ce4 allow cancel when saving in wrong format
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
  2981
                                withCRs bindWith:fileNameString allBold)) ifFalse:[
53bc9dc52ce4 allow cancel when saving in wrong format
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
  2982
                        ^ self.
53bc9dc52ce4 allow cancel when saving in wrong format
Claus Gittinger <cg@exept.de>
parents: 2680
diff changeset
  2983
                    ].
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2984
                ].
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2985
                Transcript showCR:('saving as:' , fileName pathName).
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2986
2824
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2987
                what = #image ifTrue: [ 
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2988
                    image saveOn:fileName using: imageReaderClass. self clearModified.
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2989
                    image fileName:fileNameString.
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2990
                ].
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2991
                what = #mask ifTrue: [
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2992
                    image mask saveOn:fileName using: imageReaderClass
dcff817ccd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  2993
                ].
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2994
2240
2e9ad39f11c8 checkin from browser
ca
parents: 2239
diff changeset
  2995
                fileName exists ifFalse:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2996
                    Dialog warn:'Oops image save failed.'
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  2997
                ]
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2998
            ]   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2999
        ]
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3000
    ]
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3001
4137
1a5fdfd6cd4f withWriteCursorDo
Claus Gittinger <cg@exept.de>
parents: 4129
diff changeset
  3002
    "Modified: / 27-07-2012 / 09:45:49 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  3003
!
594edef86630 revised version
tz
parents: 632
diff changeset
  3004
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3005
saveAs
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3006
    self saveImageFileAs
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3007
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3008
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3009
saveButtonImageToFileAs
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3010
    |fn|
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3011
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3012
    fn := self askForFileNameToSave:'Save Button Image to File'.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3013
    self saveButtonImageToFileAs:fn
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3014
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3015
    "Modified: / 30.9.1998 / 23:04:11 / cg"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3016
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3017
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3018
saveButtonImageToFileAs: aFileName
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3019
    "save the image as if in a button in aFileName"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3020
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3021
    |button grabbedImage|
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3022
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3023
    aFileName isNil ifTrue: [^nil].
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3024
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3025
    image isNil ifTrue:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  3026
        self warn:(resources string:'No image or image mask to save!!').
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3027
        ^ self.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3028
    ].
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3029
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3030
    button := Button label:image.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3031
    button openAt:5@5.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3032
    button waitUntilVisible.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3033
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3034
    grabbedImage := Image fromView:button.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3035
    button destroy.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3036
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3037
    self save:grabbedImage imageOrMask:#image as:aFileName
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3038
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3039
    "/ self saveImageOrMask: #mask
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3040
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3041
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3042
saveImageFileAs
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3043
    "ask for a fileName and save the image"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3044
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3045
    |fn|
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3046
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3047
    fn := self askForFileNameToSave:'Save Image To File'.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3048
    self saveImageFileAs:fn
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3049
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3050
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3051
saveImageFileAs: aFileName
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3052
    "save the image in aFileName"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3053
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3054
    aFileName isNil ifTrue: [^nil].
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3055
    image notNil ifTrue:[
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3056
        self save:image imageOrMask:#image as:aFileName.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3057
    ] ifFalse:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  3058
        self warn:(resources string:'No image for saving!!')
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3059
    ]
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3060
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3061
    "Modified: / 30.9.1998 / 23:04:55 / cg"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3062
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3063
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3064
saveImageMaskFileAs
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3065
    "ask for a fileName and save the mask only"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3066
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3067
    |fn|
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3068
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3069
    fn := self askForFileNameToSave:'Save Image Mask To File'.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3070
    self saveImageMaskFileAs:fn
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3071
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3072
    "Modified: / 30.9.1998 / 23:04:11 / cg"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3073
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3074
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3075
saveImageMaskFileAs: aFileName
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3076
    "save the mask only in aFileName"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3077
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3078
    aFileName isNil ifTrue: [^nil].
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3079
    (image notNil and:[image mask notNil]) ifTrue:[
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3080
        self save:image imageOrMask:#mask as:aFileName.
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3081
    ] ifFalse:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  3082
        self warn:(resources string:'No image or image mask to save!!')
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3083
    ]
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3084
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3085
    "Modified: / 30.9.1998 / 23:06:24 / cg"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3086
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3087
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3088
saveImageOrMask:what
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3089
    "save the image or the mask only (if what == #mask)"
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3090
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3091
    self save:image imageOrMask: what
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3092
!
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3093
633
594edef86630 revised version
tz
parents: 632
diff changeset
  3094
saveMethod
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3095
    "save the image as a resource method.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3096
     Return true if ok; false if not"
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3097
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3098
    (resourceSelector trimBlanks notEmptyOrNil and:[ resourceClass isBehavior ]) ifFalse: [
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3099
        ^ self saveMethodAs.
2914
fdf78bbdbd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  3100
    ].
fdf78bbdbd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  3101
fdf78bbdbd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  3102
    windowGroup withExecuteCursorDo:[
3859
56eadb83df83 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
  3103
        Error handle:[:ex|
56eadb83df83 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
  3104
            (self confirm:(ex errorString,'\\Debug?' withCRs)) ifTrue:[ ex reject ].
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3105
            ^ false                                 
2914
fdf78bbdbd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  3106
        ] do: [   
5286
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3107
            |img imageSaved depth bestDepth colorsUsed numColorsUsed category imageStoreStream sel mthd imageKey|
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3108
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3109
            img := self image.
4714
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3110
            depth := bestDepth := img depth.
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3111
            colorsUsed := (img usedColorsMax:256).
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3112
            colorsUsed notNil ifTrue:[
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3113
                numColorsUsed := colorsUsed size.
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3114
                #(8 4 2 1) do:[:d |
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3115
                    depth > d ifTrue:[
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3116
                        numColorsUsed <= (1 << d) ifTrue:[
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3117
                            bestDepth := d
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3118
                        ]
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3119
                    ]
4714
69df9f744066 class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  3120
                ].
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3121
            ].
5286
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3122
            imageSaved := img.
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3123
            bestDepth < depth ifTrue:[
5286
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3124
                |answer|
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3125
                
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3126
                answer := Dialog 
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3127
                    confirmWithCancel:(resources stringWithCRs:'Hint:\\You can save some code space, by converting the image from a depth-%1 to a depth-%2 image first.\(only %3 colors used)\\Convert before saving?'
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3128
                                 with:depth with:bestDepth with:numColorsUsed).
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3129
                answer isNil ifTrue:[
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3130
                    "/ cancelled
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3131
                    ^ false
5286
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3132
                ].
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3133
                answer == true ifTrue:[
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3134
                    imageSaved := (Image implementorForDepth:bestDepth) fromImage:imageSaved 
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3135
                ].    
4149
758a4573b5e4 changed: #saveMethod
Claus Gittinger <cg@exept.de>
parents: 4137
diff changeset
  3136
            ].
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  3137
4000
21106540ffb5 CodeGeneratorTool->SmalltalkCodeGeneratorTool
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
  3138
            SmalltalkCodeGeneratorTool
5286
23ec6e6fd179 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5277
diff changeset
  3139
                createImageSpecMethodFor:imageSaved
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  3140
                comment:(ResourceSpecEditor codeGenerationCommentForClass: ImageEditor) 
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3141
                in:resourceClass class
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3142
                selector:resourceSelector.
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  3143
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3144
            "/ flush cached images in the Icon class (kludge)
1901
b4b286ec221f flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
  3145
            Icon flushCachedIcons.
2590
b811d560e00a modified flag after edit operations
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  3146
            self clearModified.
1901
b4b286ec221f flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
  3147
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3148
            LastSaveClass := resourceClass.
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  3149
        ]
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3150
    ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3151
    ^ true
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3152
4000
21106540ffb5 CodeGeneratorTool->SmalltalkCodeGeneratorTool
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
  3153
    "Modified: / 31-01-2011 / 18:28:06 / cg"
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3154
    "Modified (comment): / 25-11-2016 / 08:48:44 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  3155
!
594edef86630 revised version
tz
parents: 632
diff changeset
  3156
594edef86630 revised version
tz
parents: 632
diff changeset
  3157
saveMethodAs
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3158
    "ask for method/selector; save the image there.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3159
     Return true if saved, false if not"
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3160
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3161
    |className classAndSelector
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3162
     previousClass previousCategory previousSelector
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3163
     previousMethod newMethod ok|
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3164
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3165
    previousSelector := self resourceSelector.
2908
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
  3166
    className := self resourceClassName.
a759fa87d598 some code cleanup (resourceClass was actually its name)
Claus Gittinger <cg@exept.de>
parents: 2889
diff changeset
  3167
    className isEmptyOrNil ifTrue:[
2177
340ce04ccc78 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2172
diff changeset
  3168
        className := LastSaveClass
1994
d2d9228d38ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  3169
    ].
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3170
    (className notEmptyOrNil and:[previousSelector notNil]) ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3171
        previousClass := Smalltalk classNamed:className.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3172
        previousClass notNil ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3173
            previousMethod := previousClass class compiledMethodAt:previousSelector.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3174
            previousMethod notNil ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3175
                previousCategory := previousMethod category.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3176
            ]
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3177
        ]
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3178
    ].
633
594edef86630 revised version
tz
parents: 632
diff changeset
  3179
3840
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3180
    self withWaitCursorDo:[
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3181
        classAndSelector := ResourceSelectionBrowser
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3182
                request: 'Save Image In Class'
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3183
                onSuperclass: #Object
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3184
                andClass: className
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3185
                andSelector: self resourceSelector
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3186
                withResourceTypes: #(image fileImage programImage).
1ec52651a398 changed: #saveMethodAs
Claus Gittinger <cg@exept.de>
parents: 3762
diff changeset
  3187
    ].
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3188
    classAndSelector isNil ifTrue:[^ false].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3189
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3190
    resourceClass := classAndSelector methodClass.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3191
    resourceSelector := classAndSelector methodSelector.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3192
5364
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3193
    ok := self saveMethod.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3194
    ok ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3195
        previousCategory notNil ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3196
            newMethod := resourceClass class compiledMethodAt:resourceSelector asSymbol.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3197
            newMethod notNil ifTrue:[
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3198
                newMethod category:previousCategory.
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3199
            ]
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3200
        ]
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3201
    ].
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3202
    ^ ok
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3203
bd510ef455fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5332
diff changeset
  3204
    "Modified: / 25-11-2016 / 09:17:22 / cg"
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3205
! !
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3206
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3207
!ImageEditView methodsFor:'printing'!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3208
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3209
print
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3210
    self printWithMagnification:1
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3211
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3212
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3213
printMagnified
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3214
    self printWithMagnification:magnification
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3215
!
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3216
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3217
printWithMagnification:magnification
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3218
    |stream|
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3219
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3220
    image isNil ifTrue:[^ self].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3221
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3222
    Printer supportsPostscript ifFalse:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  3223
        ^ self warn:(resources string:'No postscript printer configured !!')
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3224
    ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3225
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3226
    stream := Printer newNative.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3227
    stream isNil ifTrue:[
4249
fc26253d9d4b class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
  3228
        ^ self warn:(resources string:'Cannot open printer stream !!')
2915
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3229
    ].
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3230
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3231
    self withWaitCursorDo:[
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3232
        |psgc|
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3233
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3234
        psgc := PSGraphicsContext on:stream.  
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3235
        psgc displayForm: (image magnifiedBy: magnification) x:0 y:0.
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3236
        psgc close
6f4e171a1092 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 2914
diff changeset
  3237
    ]
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  3238
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  3239
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3240
!ImageEditView methodsFor:'queries'!
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3241
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3242
heightOfContents
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3243
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  3244
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  3245
    ^(image height * magnification y) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3246
!
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3247
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3248
imageContainsPastePoint: aPoint
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3249
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3250
    ^image notNil and: 
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  3251
	[Clipboard notNil and:
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  3252
	[((0@0 corner:(image extent) "- 1" - Clipboard extent) containsPoint: (((aPoint - margin + 1) / magnification) floor))]]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3253
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3254
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3255
imageContainsPoint: aPoint
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3256
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3257
    ^image notNil and:
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  3258
	[((0@0 corner:(image extent) - 1) containsPoint: (((aPoint - margin + 1) / magnification) floor))]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3259
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3260
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3261
widthOfContents
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3262
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  3263
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  3264
    ^(image width * magnification x) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3265
! !
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  3266
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3267
!ImageEditView methodsFor:'release'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3268
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3269
releasePasteDrawing
2085
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  3270
    self repairDamage.
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  3271
    (lastPastePoint notNil and: [ClipboardMagnified notNil]) 
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3272
    ifTrue: [ 
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  3273
        self redraw: ((lastPastePoint"-self viewOrigin") extent: (ClipboardMagnified extent)). 
2085
4cf52f994f0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  3274
        "/ self repairDamage.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3275
    ].
2440
a9abeb0e3562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  3276
    lastPastePoint := ClipboardMagnified := nil
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3277
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3278
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3279
releaseUndos
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  3280
    undoImages removeAll.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3281
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  3282
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3283
!ImageEditView methodsFor:'testing'!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3284
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3285
checkModified
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3286
    modifiedHolder value ifTrue:[
2634
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
  3287
        ((YesNoBox title:(resources string:'Image was not saved. Exit anyway ?'))
2591
87cab7199c7e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 2590
diff changeset
  3288
            noText:(resources string:'Cancel');
2634
dc5098a445d4 resources
Claus Gittinger <cg@exept.de>
parents: 2591
diff changeset
  3289
            yesText:(resources string:'Exit without Saving');
2591
87cab7199c7e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 2590
diff changeset
  3290
            showAtPointer;
2747
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3291
            accepted
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3292
        ) ifFalse: [^false].
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3293
818a513a64c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
  3294
        self modified:false.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3295
    ].
2591
87cab7199c7e Use 'Discard Changes and Exit' instead of 'Forget it...'
Stefan Vogel <sv@exept.de>
parents: 2590
diff changeset
  3296
    ^ true
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  3297
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  3298
    "Modified: / 29.7.1998 / 18:55:24 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3299
! !
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  3300
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
  3301
!ImageEditView class methodsFor:'documentation'!
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3302
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3303
version
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
  3304
    ^ '$Header$'
3762
1baf6a044dd2 changed: #pasteAt:mode:
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
  3305
!
1baf6a044dd2 changed: #pasteAt:mode:
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
  3306
1baf6a044dd2 changed: #pasteAt:mode:
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
  3307
version_CVS
4853
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
  3308
    ^ '$Header$'
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  3309
! !
2239
d2f65f84f314 saveAsButtonImage added
ca
parents: 2177
diff changeset
  3310
4203
a257aa6878ac class: ImageEditView
Claus Gittinger <cg@exept.de>
parents: 4149
diff changeset
  3311
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
  3312
ImageEditView initialize!