eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ImageEditView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ImageEditView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ImageView
                  |
                  +--ImageEditView

Package:
stx:libwidg2
Category:
Views-Misc
Version:
rev: 1.384 date: 2023/11/21 14:45:59
user: cg
file: ImageEditView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


An ImageEditView is a view which can be used by applications
like the Image Editor for editing or inspecting (bitmap-) images.

copyright

COPYRIGHT (c) 1997 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

accessing
o  editModeBox

o  editModeCopy

o  editModeFill

o  editModeFilledBox

o  editModePaste

o  editModePasteMasked

o  editModePasteUnder

o  editModePasteWithMask

o  editModePoint

o  editModeSmooth

o  editModeSpecialOperation

o  gridMagnificationLimit

o  gridMagnificationLimit: anInteger

o  lastSaveDirectory

o  lastSaveDirectory: aStringOrFilename

helpers
o  copyImageToClipboard: copiedImage

initialization
o  initialize
self initialize

resources
o  classResources
(comment from inherited method)
if not already loaded, get the classes resourcePack and return it


Instance protocol:

accessing
o  activityInfoHolder
return the value of the instance variable 'activityInfoHolder' (automatically generated)

o  activityInfoHolder: something
set the value of the instance variable 'activityInfoHolder' (automatically generated)

o  clearModified

o  clickInfoCallBack: aTwoArgBlock

o  clipBoard

o  clipBoardImage
if there is an image in the clobal clipboard,
return that (and thus support copy-paste from another smalltalk application).
Otherwise return the local clipboardImage from a classVar to support copy-paste
within this smalltalk session.

o  drawingAlpha
return the alpha value for drawing;
if the current drawing color is nil, ONLY the alpha value will be changed

o  drawingAlpha: anAlphaValue
set the alpha value for drawing;
if the current drawing color is nil, ONLY the alpha value will be changed

o  drawingColorHolders
left/right mouse colors

o  drawingColors
return the two colors in which I will draw (left / right mouse button colors)

o  drawingColors: anArrayTwoColors
set the two colors in which I will draw (left / right mouse button colors)

o  editMode
is one of the edit modes:

EditModePoint
EditModeBox
EditModePaste
EditModePasteUnder
EditModePasteMasked
EditModePasteWithMask
EditModeFilledBox
EditModeFill
EditModeCopy
EditModeSpecialOperation
EditModeSpray
EditModeCircle
EditModeSmooth
EditModePointBlend
EditModePointBrighter
EditModePointDarker

o  editMode: anEditModeSymbol
must be one of the edit modes:

EditModePoint
EditModeBox
EditModePaste
EditModePasteUnder
EditModePasteWithMask
EditModePasteMasked
EditModeFilledBox
EditModeFill
EditModeCopy
EditModeSpecialOperation
EditModeSpray
EditModeCircle
EditModeSmooth
EditModePointBlend
EditModePointBrighter
EditModePointDarker

o  floodFillMaxHueError: aFraction
Modified (format): / 17-02-2017 / 15:26:59 / cg

o  floodFillMaxLightError: aFraction
Modified (format): / 17-02-2017 / 15:27:03 / cg

o  image: anImage scroll: doScroll
(comment from inherited method)
set the image possibly scroll as set by adjust
- may show a wait cursor, if image dithering may take a while

o  image: anImage scroll: doScroll invalidate: doInvalidate
(image isNil or: [self checkModified])

o  imageInfoHolder

o  imageInfoHolder: something

o  magnification

o  magnification: aPoint
self scrollToTopLeft.

o  modified

o  modified: aBoolean

o  modifiedHolder

o  mouseKeyColorMode

o  mouseKeyColorMode: aMode

o  penWidth

o  penWidth: anInteger

o  readOnly

o  readOnly: aBoolean

o  removelastUndo

o  resourceClass

o  resourceClass: aClassOrClassNameString
support for names will vanish - obsolete left over from tz

o  resourceClassName

o  resourceMessage

o  resourceSelector

o  resourceSelector: aStringOrSymbol

o  selectMaskForDrawing
self selectedColorIndex:1.

o  selectedColor
the mask is selected - return a pseudoColor holding ONLY the alpha value

o  selectedColor: aColor

o  selectedColorIndex

o  selectedColorIndex: aPixelIndex

o  setModified
remember being modified (to ask about saving, when closing)

o  spraySpot

o  spraySpot: something

o  undoImages

o  userAllowedToChangeDrawingColor: aBoolean
for special applications, whre user is only allowed to draw
in the predefined color (eg. expecco)

drawing
o  drawFrame
draws a black frame around the image's bounds

o  drawFramesIn: aRectangle
draws the pixel frame grid

o  drawPasteRectangleAt: aPoint
currentPoint := currentPoint - self viewOrigin.

o  fillFramedRectangle: aRectangle

o  redraw: aRectangle
+ self viewOrigin

o  redrawImageX: x y: y width: w height: h

o  redrawImageX: x y: y width: w height: h unmaskedOnly: unmaskedOnly
redraw the magnified (editing) view of the image

o  redrawImageX: x y: y width: w height: h unmaskedOnly: unmaskedOnly processColorsWith: aColorBlockOrNil
redraw the magnified (editing) view of the image

o  redrawX: x y: y width: w height: h
self clippingRectangle: (x@y extent:w@h).

o  startSpray
the angle is uniformly ditributed

o  stopSpray

event handling
o  buttonMotion: state x: x y: y
readOnly ifTrue:[^ self].

o  buttonPress: button x: x y: y
with shift, paste is offset by pasted image's size

o  buttonRelease: button x: x y: y
"/ cg: what a kludge - please change to use a valueHolder,

o  inPasteMode

o  keyboardZoom: largerBoolean
ALT+/- (was: CTRL+/-) zoom action

o  pointerLeave: state
(comment from inherited method)
mouse pointer left

image editing
o  askForSpecialOperation
let user ask for which special operation to apply to the selected imageBox,
then perform it.

o  autoCropLeft: doLeft right: doRight top: doTop bottom: doBottom
self warn:'extract subImage '

o  copyImageToClipboard

o  copyImageToClipboard: someImage

o  copyRotatedSubImageToClipBoard: degrees in: imageBox

o  cropLeft: doLeft right: doRight top: doTop bottom: doBottom

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  drawingColorOrNil
care for mask in 24bit mode.

o  drawingPixelOrNil

o  flipSubImage: how in: imageBox
now, do it

o  gradientFillIn: imageBox orientation: orientation auto: auto
with auto, pick 2 bounding pixels and do a gradient fill with those;

o  magnifyAntiAliasedImageTo: newSize

o  magnifyImageTo: newSize

o  magnifySmoothingBy: scale

o  magnifySmoothingTo: newSize

o  makeNewColorMapByMapping: functionOfColor
wrong name: no longer needs a colormap - can also process the pixels

undoable make a new image by processing colors with a function.
If the image is a true-color image (rgb), the function is applied
to every pixel's color and a new pixel-array is created (this is slow).
Currently not done (why?):
If the image is a palette image,
the function is applied to the colormap only and a new colormap is
created (i.e. this is very fast).

This is the internal low level function to brighten, darken
or hue-shift the image.
Returns true, if there was any change.

o  makeSubImageX: oldX y: oldY width: newWidth height: newHeight

o  makeUndo

o  pasteAt: aPoint mode: modeSymbol
called from button-press/button motion while in paste mode:
paste the image in the clipboard at aPoint.
Mode is one of:
nil - ?
#withMask - paste both mask and pixel
#masked - only unmasked source pixels are pasted
#under - only paste source pixel if unmasked in dest

o  shiftImageHorizontal: shiftH vertical: shiftV

o  shiftImageHorizontal: shiftH vertical: shiftV wrap: doWrap
shift the pixels;
shift<0 is left-shift/up-shift; shift>0 is right-shift/down-shift;
doWrap controls if shifted-out pixels are to be shifted in at the opposite side.
i.e.:
0123456789 -> 3456789789 (shift: -3) 0123456789 -> 0120123456 (shift:3)
or, with wrap:
0123456789 -> 3456789012 (shift: -3) 0123456789 -> 7890123456 (shift:3)

o  shifted: image horizontal: shiftH vertical: shiftV wrap: doWrap
shift the pixels;
shift<0 is left-shift/up-shift; shift>0 is right-shift/down-shift;
doWrap controls if shifted-out pixels are to be shifted in at the opposite side.
i.e.:
0123456789 -> 3456789789 (shift: -3) 0123456789 -> 0120123456 (shift:3)
or, with wrap:
0123456789 -> 3456789012 (shift: -3) 0123456789 -> 7890123456 (shift:3)

o  specialOperation: operation on: imageBox withColor: clr
ask for and perform one of the special operations on the previously selected imageBox;
then redraw as required

o  text: aString at: aPoint
draw a character

o  undo

image editing-editmode button actions
o  arrow1At: aPoint
called from button-press/button motion while in arrow-at-start-drawing mode:
drag a line,
when released, draw the line with the currently selected color

o  arrow2At: aPoint
called from button-press/button motion while in arrow-at-end-drawing mode:
drag a line,
when released, draw the line with the currently selected color

o  boxAt: aPoint
called from button-press/button motion while in box-drawing mode:
drag a rectangular outline,
when released, draw a rectangle with the currently selected color

o  circleAt: aPoint
called from button-press/button motion while in circle-drawing mode:
drag an ellipse,
when released, draw an ellipse with the currently selected color

o  commonBoxOperation: action at: aPoint
common code for filling/drawing.

o  copyAt: aPoint
called from button-press/button motion while in copy-drawing mode:
drag a filled box,
when released, copy the selected rectangle to the clipboard

o  cropSubImageAt: aPoint
called from button-press/button motion while in crop-subImage mode:
drag a filled box,
when released, change the image to the new bounds

o  ensureColorInImage: aColor
ensure that image can represent aColor
(if image has a colorMap)

o  fillAt: aPoint
called from button-press motion while in floo-fill drawing mode:
perform a flood-fill with the currently selected color

o  filledBoxAt: aPoint
called from button-press/button motion while in filled rectangle-drawing mode:
drag a filled box,
when released, fill a rectangular area with the currently selected color

o  filledCircleAt: aPoint
called from button-press/button motion while in filled circle-drawing mode:
drag a filled ellipse,
when released, fill an ellipse with the currently selected color

o  lineAt: aPoint
called from button-press/button motion while in line-drawing mode:
drag a line,
when released, draw the line with the currently selected color

o  lineAt: aPoint arrowStyle: arrowStyleOrNil
called from button-press/button motion while in line-drawing mode:
drag a line,
when released, draw the line with the currently selected color

o  maskOutsideCircleAt: aPoint
called from button-press/button motion while in filled rectangle-drawing mode:
drag a box,
when released, mask everything outside the rectangular area

o  maskOutsideRectAt: aPoint
called from button-press/button motion while in filled rectangle-drawing mode:
drag a box,
when released, mask everything outside the rectangular area

o  pasteAt: aPoint
called from button-press/button motion while in paste mode:
paste the image in the clipboard at aPoint

o  pasteMaskedAt: aPoint
called from button-press/button motion while in paste mode:
paste the image in the clipboard at aPoint.
In this mode, only pixels which are not masked in the source image
are pasted.

o  pasteUnderAt: aPoint
called from button-press/button motion while in paste mode:
pasteUnder the image in the clipboard at aPoint.
In this mode, only pixels which are not equal to
the current color or masked are pasted.

o  pasteWithMaskAt: aPoint
called from button-press/button motion while in paste mode:
paste the image in the clipboard at aPoint.
In this mode, both the mask and the image pixel are pasted

o  pointAt: aPoint
called from button-press/button motion while in point-drawing mode:
draw a single pixel with the currently selected color

o  pointAt: aPoint width: pw
called from button-press/button motion while in point-drawing mode:
draw a single pixel (or dot of width pw) with the currently selected color,
or blend it with the selected color or make it brighter/darker

o  pointBlendAt: aPoint
called from button-press/button motion while in point-blending drawing mode:
blend a single pixel with the currently selected color.
Notice: this is called via #perform (editMode+At:)

o  pointBrighterAt: aPoint
called from button-press/button motion while in point-brighter drawing mode:
makes a single pixel slightly brighter.
Notice: this is called via #perform (editMode+At:)

o  pointDarkerAt: aPoint
called from button-press/button motion while in point-darker drawing mode:
makes a single pixel slightly darker.
Notice: this is called via #perform (editMode+At:)

o  smoothAt: aPoint
called from button-press/button motion while in smoothing mode:
smoth (average) a single pixel with pixels around

o  specialOperationAt: aPoint
special operation on a rectangular area

o  sprayAt: aPoint
called from button-press/button motion while in spray mode:
start spraying with the currently selected color

image manipulation
o  brightenImage
make the image brighter

o  darkenImage
make the image darker

o  exchangeGreenBlueChannels
exchange red and blue channels

o  exchangeRedBlueChannels
exchange red and blue channels

o  exchangeRedGreenChannels
exchange red and green channels

o  flipHorizontal
flip the whole image horizontally

o  flipVertical
flip the whole image vertivally

o  makeBorderedImageX: newX y: newY width: newWidth height: newHeight

o  makeBrighter
make the image brighter (obsolete, backward compatible entry)

o  makeDarker
make the image darker (obsolete, backward compatible entry)

o  makeGrayScaleImage

o  makeInverse

o  makeInvertedBits
invert the pixels
for palette images, this will lead to funny results;
for all others, this makes it a negative

o  makeNegative
make a real negative.
For non-palette images, this is done by inverting the pixels;
for palette images, we need new colors.

o  makeSlightlyBrighter

o  makeSlightlyDarker

o  newImageWithUndo: newImage
undoable set a new image (after processing)

o  performSpecialOperation: operation on: imageBox withColor: clr
actually perform one of the special operations on the previously selected imageBox

o  reduceColorResolutionBy: numBits
reduce by masking off numBits r/g/b bits

o  resizeImageTo: newSize

o  resizedImage: image to: newSize
helper for image resize and mask resize.
return a resized version of image

o  rotateImageBy: rotation
rotate by (degrees)

o  slightlyBrighter: aColor

o  slightlyDarker: aColor

o  threeDProjection: dx1 and: dx2
3D projection

image-dragging & info
o  dragRectangleStartingAt: aPointIn emphasis: emphasis
draw a drag rectangle (filled or unfilled, depending on the emphasis arg).
This is called by operations like rectangle, filledRectangle, copy etc.
(i.e. any operation which operates on a box).
The cpu stays in this method dragging the mouse pointer,
until the button is released.

Emphasis is one of:
box - a frame is drawn
inverseFilledBox - the dragged box is filled by the inverse color
filledBox - the dragged box is filled with black
grayedBox - the dragged box is drawn with a gray shadow

o  drawCursorAt: aPoint
the mouse was moved to aPoint (in the image).
Update the info (showing rgb + other info) in the lower info bar.
Also changes the cursor to a stop-cursor, if outside the image

o  imageInfoString

o  showCursorAt: aPoint andInformation: aLabel

o  updateActivity: something

o  updateImageInfo: someTextOrObject
show someText in the lower info area

o  updateImageInfoFor: aPoint
show info about the pixel at aPoint in the lower info area

initialization & release
o  destroy
(comment from inherited method)
image := nil.

o  initialize
left/right mouse colors

o  release
keep the edited image here (it is nilled in ImageView)
- we want to get it after close

loading & saving
o  askForFileNameToSave: msg
ask for a fileName

o  loadFromClass

o  loadFromClass: aClassOrClassName andSelector: aStringOrSymbol
support for names will vanish - obsolete left over from tz

o  loadFromFile: aFileName

o  loadFromFile: aFileName readerClass: imageReaderClassOrNil
imageReaderClass := ImageReader allSubclasses

o  loadFromMessage: classAndSelector
switch to the class and selector specified by classAndSelector.

o  loadfromClass: aClassOrSymbol andSelector: aStringOrSymbol

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  save

o  save: image imageOrMask: what
save the image or the mask only (if what == #mask)

o  save: image imageOrMask: what as: fileNameArg
save the image or the mask only (if what == #mask)

o  saveAs

o  saveButtonImageToFileAs

o  saveButtonImageToFileAs: aFileName
save the image as if in a button in aFileName

o  saveImageFileAs
ask for a fileName and save the image

o  saveImageFileAs: aFileName
save the image in aFileName

o  saveImageMaskFileAs
ask for a fileName and save the mask only

o  saveImageMaskFileAs: aFileName
save the mask only in aFileName

o  saveImageOrMask: what
save the image or the mask only (if what == #mask)

o  saveMethod
save the image as a resource method.
Return true if ok; false if not

o  saveMethodAs
ask for method/selector; save the image there.
Return true if saved, false if not

o  saveMethodAsInFormat: formatOrNil
ask for method/selector; save the image there.
Return true if saved, false if not

o  saveMethodInFormat: formatOrNil
save the image as a resource method.
Return true if ok; false if not

printing
o  print
(comment from inherited method)
print the receiver on the standard output stream (which is not the Transcript)

o  printMagnified

o  printWithMagnification: magnification

queries
o  imageContainsPastePoint: aPoint
- 1

o  imageContainsPoint: aPoint

o  selfIsNotImageEditor

queries-contents
o  heightOfContents
(comment from inherited method)
return the image's height - scrollbar needs this info

o  widthOfContents
(comment from inherited method)
return the image's width - scrollbar needs this info

release
o  releasePasteDrawing
-self viewOrigin

o  releaseUndos

testing
o  checkModified



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:41:58 GMT