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.126 date: 2018/05/02 19:06:41
user: cg
file: ImageView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
Claus Gittinger

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


Related information:

    Image
    Form

Class protocol:

initialization
o  initialize

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

o  forceSmoothing: aBoolean

o  forceSmoothingHolder

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

drawing
o  generateMagnifiedImage
smooth

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
self cursor:(Cursor handGrab).

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

o  mouseWheelZoom: amount
CTRL-wheel action

o  sizeChanged: how
(comment from inherited method)
tell subviews that I changed size.
How is either #smaller, #larger or nil, and is used to control the order,
in which subviews are notified (possibly reducing redraw activity)

o  updateImageAfterSizeChange
self clear.

initialization & release
o  destroy
image := nil.

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

menu
o  editImage

o  fitBigMenuItemVisible

o  magnifyBy: scale

o  middleButtonMenu

o  middleButtonMenuExtraSlice

o  saveImageAs

o  saveImageAs: filename

o  smoothFitBigMenuItemVisible

o  smoothingMenuItemVisible

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

o  selfIsNotImageEditor
for the menu; to hide edit item

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

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

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


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.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 12:37:46 GMT