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.333 date: 2018/05/01 08:38:10
user: cg
file: ImageEditView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
Thomas Zwick

Description:


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


Related information:

    ImageEditor
    Image

Class protocol:

accessing
o  editModeBox

o  editModeCopy

o  editModeFill

o  editModeFilledBox

o  editModePaste

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


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 one in the clobal clipboard,
return that (an 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
EditModePasteWithMask
EditModeFilledBox
EditModeFill
EditModeCopy
EditModeSpecialOperation
EditModeSpray
EditModeCircle
EditModeSmooth

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

EditModePoint
EditModeBox
EditModePaste
EditModePasteUnder
EditModePasteWithMask
EditModeFilledBox
EditModeFill
EditModeCopy
EditModeSpecialOperation
EditModeSpray
EditModeCircle
EditModeSmooth

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

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: aColorBlock
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
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  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

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

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  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  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  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  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

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  flipHorizontal
Modified (format): / 31-08-2017 / 12:13:03 / cg

o  flipVertical

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

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  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 operation 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

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

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

printing
o  print

o  printMagnified

o  printWithMagnification: magnification

queries
o  heightOfContents

o  imageContainsPastePoint: aPoint
- 1

o  imageContainsPoint: aPoint

o  selfIsNotImageEditor

o  widthOfContents

release
o  releasePasteDrawing
-self viewOrigin

o  releaseUndos

testing
o  checkModified



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 23 Sep 2018 10:28:17 GMT