eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ImageView':

Home

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

Class: ImageView


Inheritance:

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

Package:
stx:libwidg2
Category:
Views-Misc
Version:
rev: 1.162 date: 2023/08/31 13:19:15
user: cg
file: ImageView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


This View knows how to display a (bitmap-)image (or form).

You can display an image with:

    ImageView openOn:anImageFileName
or:
    ImageView openOnImage:anImage
or:
    ImageView new image:anImage

i.e.

    ImageView openOn:'../../goodies/bitmaps/gifImages/garfield.gif'
    ImageView openOn:'../../goodies/bitmaps/SBrowser.xbm'

    ImageView openOnImage:(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif')
    ImageView openOnImage:(Image fromFile:'../../goodies/bitmaps/SBrowser.xbm')

adjust:
    controls how images are displayed;
    can be one of:
        #topLeft    - image is displayed as usual
        #center     - image is shown centered
        #fitBig     - big images are shrunk to make it fit the view
        #fitSmall   - small images are magnified to make it fit the view,
        #fit        - all images are magnified to fit the view

copyright

COPYRIGHT (c) 1993 by Claus Gittinger 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:

initialization
o  initialize
(comment from inherited method)
to get language changes

menu specs
o  middleButtonMenu
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:ImageView andSelector:#middleButtonMenu
     (Menu new fromLiteralArrayEncoding:(ImageView middleButtonMenu)) startUp

o  middleButtonMenuExtraSaveSlice
can be refdefined in subclasses to add more menu items

o  middleButtonMenuExtraSlice
can be refdefined in subclasses to add more menu items

queries-plugin
o  aspectSelectors

startup
o  openOn: anImageOrFileName
startup an image viewer on an image or
an image read from a file.
Return the imageView (not the topView)

Usage example(s):

     ImageView openOn:'bitmaps/gifImages/garfield.gif'
     ImageView openOn:'bitmaps/xpmBitmaps/misc_icons/BOOK.xpm'

o  openOnFile: aFileName
startup an image viewer on an image read from a file.
Return the imageView (not the topView)

Usage example(s):

     ImageView openOnFile:'../../goodies/bitmaps/gifImages/garfield.gif'
     ImageView openOnFile:'../../goodies/bitmaps/xpmBitmaps/misc_icons/BOOK.xpm'

o  openOnImage: anImage
startup an image viewer on an image.
Return the imageView (not the topView)

Usage example(s):

     ImageView openOnImage:(Image fromFile:'bitmaps/gifImages/garfield.gif') title:'garfield'
     ImageView openOnImage:(Image fromFile:'../../libtool/bitmaps/SBrowser.xbm') title:'old browser icon'

o  openOnImage: anImage title: aString
startup an image viewer on an image.
Return the imageView (not the topView)

Usage example(s):

     ImageView openOnImage:(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') title:'garfield'
     ImageView openOnImage:(Image fromFile:'../../libtool/bitmaps/SBrowser.xbm')


Instance protocol:

accessing
o  adjust
get the adjust (how the image is displayed);
currently, support #topLeft, #center, #fitBig, #fitSmall and #fit:
#topLeft - image is displayed as usual
#center - image is shown centered
#fitBig - big images are shrunk to make it fit the view
#fitSmall - small images are magnified to make it fit the view,
#fit - all images are magnified to fit the view
#smoothFitBig - fitBig with smoothing
#smoothFitSmall - fitSmall with smoothing
#smoothFit - fit with smoothing

o  adjust: layoutSymbol
set the adjust (how the image is displayed);
currently, support #topLeft, #center, #fitBig, #fitSmall and #fit:
#topLeft - image is displayed as usual
#center - image is shown centered
#fitBig - big images are shrunk to make it fit the view
#fitSmall - small images are magnified to make it fit the view,
#fit - all images are magnified to fit the view
#topLeftNoZoom - image is displayed as usual, and magnification is reset
#smoothFitBig - fitBig with smoothing
#smoothFitSmall - fitSmall with smoothing
#smoothFit - fit with smoothing

o  adjustHolder
get a valeHolder for the adjust (how the image is displayed);
currently, support #topLeft, #center, #fitBig, #fitSmall and #fit:
#topLeft - image is displayed as usual
#center - image is shown centered
#fitBig - big images are shrunk to make it fit the view
#fitSmall - small images are magnified to make it fit the view,
#fit - all images are magnified to fit the view
#smoothFitBig - fitBig with smoothing
#smoothFitSmall - fitSmall with smoothing
#smoothFit - fit with smoothing

o  canScrollWithFourWayCursor: something

o  forceSmoothing
true if the image will be smoothed, when magnifying

o  forceSmoothing: aBoolean
set to true if the image shall be smoothed, when magnifying

o  forceSmoothingHolder
this holder controls if the image should be smoothed, when magnifying

o  image
return the image

o  image: anImage
set the image scrolls as set by adjust
- may show a wait cursor, if image dithering may take a while

o  image: anImage scroll: doScroll
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
set the image possibly scroll as set by adjust
- may show a wait cursor, if image dithering may take a while

o  imageEditAction: aOneArgBlockOrNil
if nonNil, aOneArgBlockOrNil will be called to open
the image editor (as by the 'Edit Image' menu action).
If never set, the default ImageEditor is opened.

o  magnification

o  magnificationFactor

o  magnificationFactor: aNumber
explicitMagnificationFactor ~= aNumber

o  model: aValueHolder
(comment from inherited method)
Set the model.
Here, if I am my own menuPerformer/menuHolder,
set the menuHolder and menuPerformer to the model.
This is a compatibility kludge,
since typically, ST-80 code expects the model to provide a menu
and perform it. If the model does not support a menu message,
it will be forwarded to the view.
Those apps which want the view to provide the (default) menu have to reset
this by sending #menuHolder: message (again)

o  rotation
in degrees

o  rotation: degrees
in degrees

o  setImage: anImage
set the image - show a wait cursor, since image dithering may take a while

o  setImage: anImage scroll: doScroll
set the image - may show a wait cursor, if image dithering may take a while

o  setImage: anImage scroll: doScroll invalidate: doInvalidate
set the image - may show a wait cursor, if image dithering may take a while

o  sizeToFit: aBoolean

o  smoothDelayed
If on a slow machine, the UI is better if we first do a fast (but ugly)
magnify, followed by a slow smoothing in the background.
If the machine is fast, we should do smoothing and magnification in one
step. Set smoothDelayed to false for that.

o  smoothDelayed: aBoolean
If on a slow machine, the UI is better if we first do a fast (but ugly)
magnify, followed by a slow smoothing in the background.
If the machine is fast, we should do smoothing and magnification in one
step. Set smoothDelayed to false for that.

o  tileMode: aBoolean tileOffset: aPoint

accessing-channels
o  imageChannel

o  imageChannel: aValueHolder

o  mousePointHolder

change & update
o  update: something with: aParameter from: changedObject

o  updateFromModel
the model changes, set my image

channels
o  magnificationFactorHolder

o  magnificationFactorHolder: aValueHolder

o  rotationHolder

o  rotationHolder: aValueHolder

drawing
o  generateMagnifiedImage
as of 2021-01 cannot magnify forms

o  generateRotatedImage

o  generateSmoothImage

o  redrawX: x y: y width: w height: h
rectRight rectBelow

event handling
o  buttonMotion: state x: x y: y
lastMousePoint value:mousePoint.

o  buttonPress: button x: x y: y
indicate scroll operation ongoing via the 4-way cursor

o  buttonRelease: button x: x y: y
(comment from inherited method)
button was released - check my components for a hit.

o  imageChanged
flush the cacehd magnified image after a change of the image

o  mouseWheelZoom: amount
CTRL-wheel action

o  sizeChanged: how from: oldExtentOrNil
my view has changed the size (not the contents)

o  updateImageAfterSizeChange
self clear.

initialization & release
o  destroy
image := nil.

o  initialize
(comment from inherited method)
must be called if redefined

o  release

menu
o  editImage
popup menu item to open an image editor

o  fitBigMenuItemVisible

o  magnifyBy: scale
set again, so the menu shows nothing

o  middleButtonMenu
(comment from inherited method)
return the menu associated with the middle mouse button.
Here, return a hooked on menu, but usually redefined to provide a widget-specific
menu.

o  middleButtonMenuExtraSlice

o  saveImageAs

o  saveImageAs: filename

o  smoothFitBigMenuItemVisible

o  smoothingMenuItemVisible

o  zoomIn
popup menu item to zoom in (magnify more)

o  zoomOut
popup menu item to zoom out (magnify less)

queries
o  selfIsNotImageEditor
for the menu; to hide edit item

queries-contents
o  heightOfContents
return the image's height - scrollbar needs this info

o  widthOfContents
return the image's width - scrollbar needs this info

scrolling
o  canScrollWithFourWayCursor

o  scrollToMakeRectangleVisible: aRectangle
try to arrange for aRectangle to be visible (at the center, if possible)

Usage example(s):

     |v|
     v := ImageView new image:(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif').
     v openAndWaitUntilVisible.
     v inspect.
     v scrollToMakeRectangleVisible:((300@100) corner:(320@120)).

o  scrollToMakeVisible: aPoint
try to arrange for aPoint (in logical image coordinates)
to be visible (at the center, if possible)

Usage example(s):

     |v|
     v := ImageView new image:(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif').
     v openAndWaitUntilVisible.
     v inspect.
     v scrollToMakeVisible:(300@100).


Examples:


|top imgView scrView|

top := StandardSystemView new.
top extent:300@300.

imgView := ImageView new.
imgView image:(Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif').

scrView := HVScrollableView forView:imgView.
scrView origin:0@0 corner:1.0@1.0.
top add:scrView.

top open.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:33:54 GMT