|
|
Class: Form
Object
|
+--GraphicsContext
|
+--DeviceGraphicsContext
|
+--GraphicsMedium
|
+--Form
|
+--Form::ImageForm
|
+--Pixmap
- Package:
- stx:libview
- Category:
- Compatibility-ST80-Graphics-Display Objects
- Version:
- rev:
1.143
date: 2009/02/26 21:23:01
- user: stefan
- file: Form.st directory: libview
- module: stx stc-classLibrary: libview
- Author:
- Claus Gittinger
Instances of this class represent forms (i.e. bit- and pixmaps)
which can be created on a drawing device.
In X, these device resources are XPixmaps.
Not all devices will support forms.
NOTICE:
the Form class is a historic leftover and now only used for real
device forms (i.e. on devices which support downloading bitmaps).
In your application, you should always use Image, both for compatibility
with ST-80 and for device independence, since Form may not be supported
by all devices.
WARNING:
Forms created on some device may not be recreatable, when an
image is restarted on a display with different display capabilities.
For example, a 24bit truecolor form will be lost when the image is
saved and restarted in an 8bit or monochrome display.
Worse: the information is completely lost.
With images, the original information is always preserved, although
the display may be with less resolution, dithered or otherwise
approximated.
Image
DeviceDrawable
Compatibility-ST80
-
and
-
return a constant usable as bitblt-combinationrule.
In ST-80rel2.x, these used to be numeric constants; in ST/X,
these are symbolic.
-
black
-
ST80 compatibility;
In old st80, you could use `Form black' for drawing
- here we return the black color.
-
darkGray
-
ST80 compatibility;
In old st80, you could use `Form darkGray' for drawing
- here we return the darkGray color.
-
darkGrey
-
ST80 compatibility;
In old st80, you could use `Form darkGrey' for drawing
- here we return the darkGrey color.
-
gray
-
ST80 compatibility;
In old st80, you could use `Form gray' for drawing
- here we return the grey color.
-
grey
-
ST80 compatibility;
In old st80, you could use `Form grey' for drawing
- here we return the grey color.
-
lightGray
-
ST80 compatibility;
In old st80, you could use `Form lightGray' for drawing
- here we return the lightGray color.
-
lightGrey
-
ST80 compatibility;
In old st80, you could use `Form lightGray' for drawing
- here we return the lightGray color.
-
over
-
return a constant usable as bitblt-combinationrule.
In ST-80rel2.x, these used to be numeric constants; in ST/X,
these are symbolic.
-
paint
-
return a constant usable as bitblt-combinationrule.
In ST-80rel2.x, these used to be numeric constants; in ST/X,
these are symbolic.
-
reverse
-
return a constant usable as bitblt-combinationrule.
In ST-80rel2.x, these used to be numeric constants; in ST/X,
these are symbolic.
-
under
-
return a constant usable as bitblt-combinationrule.
In ST-80rel2.x, these used to be numeric constants; in ST/X,
these are symbolic.
-
white
-
ST80rel2.x compatibility;
In old st80, you could use `Form white' for drawing
- here we return the white color.
Compatibility-Squeak
-
extent: ext depth: d bits: data
-
-
extent: ext depth: d fromArray: data offset: offs
-
cleanup
-
lowSpaceCleanup
-
cleanup in low-memory situations
file search
-
findBitmapFile: fileName
-
find the bitmap file in one of the standard places;
return the pathName or nil
fileIn/Out
-
fromFile: filename
-
create a new form taking the bits from a file on the default device.
WARNING:
Please do no longer use this, since it will not work
correctly in multi-display applications (creates the form on the
default Display).
Use #fromFile:on: and pass the devive as argument.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
fromFile: filename on: aDevice
-
create a new form on device, aDevice and
initialize the pixels from the file filename
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
fromFile: filename resolution: dpi
-
create a new form taking the bits from a file on the default device
the data in the file is assumed to be for dpi resolution;
if it is different from the displays resolution, magnify or
shrink the picture (but only in integer magnification steps).
WARNING:
Please do no longer use this, since it will not work
correctly in multi-display applications (creates the form on the
default Display).
Use #fromFile:resolution:on: and pass the devive as argument.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
fromFile: filename resolution: dpi on: aDevice
-
create a new form on device, aDevice and
initialize the pixels from the file filename;
the data in the file is assumed to be for dpi resolution;
if it is different from the displays resolution, magnify or
shrink the picture (but only in integer magnification steps)
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
readFrom: fileName
-
same as Form>>fromFile: - for ST-80 compatibility.
WARNING:
Please do no longer use this, since it will not work
correctly in multi-display applications (creates the form on the
default Display).
Use #fromFile:on: and pass the device as argument.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
initialization
-
flushDeviceForms
-
recreate all forms on aDevice; called by Workstation, to
have all background bitmaps at hand, when views are restored
-
initialize
-
initialize set of dictionaries to look for bitmaps
-
reinitializeAllOn: aDevice
-
recreate all forms on aDevice; called by Workstation, to
have all background bitmaps at hand, when views are restored
-
update: something with: aParameter from: changedObject
-
sent just before snapOut and just after a snapIn
instance creation
-
dotOfSize: size
-
create and return a form which contains a dot (filled circle)
of the given size.
-
extent: ext
-
create a new, cleared form, take dimensions from ext.
Smalltalk-80 compatibility
-
extent: ext depth: d
-
create a new, cleared form.
Smalltalk-80 compatibility
-
extent: ext depth: d onDevice: aDevice
-
create a new form on device, aDevice; depth is what device likes most
-
extent: ext fromArray: data
-
create a new form, take dimensions from ext, bits from data.
Smalltalk-80 compatibility.
-
extent: ext fromArray: data offset: offs
-
create a new form, take dimensions from ext, bits from data.
Smalltalk-80 compatibility.
-
extent: ext fromArray: data offset: offs onDevice: aDevice
-
create a new form, take dimensions from ext, bits from data.
-
extent: ext fromArray: data onDevice: aDevice
-
create a new form, take dimensions from ext, bits from data.
-
extent: ext offset: anOffset
-
create a new, cleared form, take dimensions from ext.
Smalltalk-80 compatibility
-
extent: ext onDevice: aDevice
-
create a new form on device, aDevice; depth is what device likes most
-
width: w height: h
-
create a new form on the default device
-
width: w height: h depth: d
-
create a new form on the default device
-
width: w height: h depth: d onDevice: aDevice
-
create a new form with depth d on device, aDevice
-
width: w height: h fromArray: anArray
-
create a new form on the default device
-
width: w height: h fromArray: anArray onDevice: aDevice
-
create a new form on device, aDevice and
initialize the pixels from anArray
-
width: w height: h offset: offs fromArray: anArray
-
create a new form on the default device
-
width: w height: h offset: offs fromArray: anArray onDevice: aDevice
-
create a new form on the default device
-
width: w height: h onDevice: aDevice
-
create a new form on device, aDevice; depth is what device likes most
obsolete instance creation
-
darkGreyFormOn: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
extent: ext depth: d on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
extent: ext fromArray: data offset: offs on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
extent: ext fromArray: data on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
extent: ext on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
grey: percent on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
lightGreyFormOn: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
mediumGreyFormOn: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
veryDarkGreyFormOn: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
veryLightGreyFormOn: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
width: w height: h depth: d on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
width: w height: h fromArray: anArray on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
width: w height: h offset: offs fromArray: anArray on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
width: w height: h on: aDevice
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
obsolete patterns
-
darkGreyFormBits
-
-
grey12Bits
-
-
grey25Bits
-
-
grey37Bits
-
-
grey50Bits
-
-
grey6Bits
-
-
greyFormBits
-
-
lightGreyFormBits
-
-
veryDarkGreyFormBits
-
-
veryLightGreyFormBits
-
Compatibility-ST80
-
destroy
-
destroy my underlying device resource(s)
-
displayAt: aPoint
-
show the receiver on the current display screen
-
displayOn: aGC at: aPoint rule: rule
-
draw in aGC.
Smalltalk-80 (2.x) compatibility
-
displayOn: aGC rule: rule
-
draw in aGC.
Smalltalk-80 (2.x) compatibility
-
displayOn: aGC x: x y: y
-
draw in aGC.
Smalltalk-80 (2.x) compatibility
-
displayOn: aGC x: x y: y rule: rule
-
draw in aGC.
Smalltalk-80 (2.x) compatibility
-
isOpen
-
-
offset
-
set the offset.
Smalltalk-80 compatibility
-
offset: org
-
set the offset.
Smalltalk-80 compatibility
-
preferredBounds
-
Compatibility-Squeak
-
colormapIfNeededForDepth: destDepth
-
-
magnify: aRectangle by: scale smoothing: smooth
-
accessing
-
bits
-
return a ByteArray filled with my bits -
for depth 8 forms, 1 pixel/byte is filled;
for depth 1 forms, 8 pixels/byte are filled
for depth 4 forms, 2 pixels/byte are filled.
Padding is done row-wise to the next BYTE-boundary
If multiple pixels are contained in a single byte,
left bits are in the most significant bit positions.
(i.e. for width==13 and depth==1 it will return 2 bytes per scanline)
-
bits: aByteArray
-
set the forms bits;
for depth-8 forms, 1 pixel/byte is expected;
for depth-1 forms, 8 pixels/byte are expected
for depth-4 forms, 2 pixels/byte are expected.
Padding is expected to the next byte-boundary
(i.e. for width==13 and depth==1 2 bytes per scanline are expected)
-
bitsPerSample
-
for compatibility with Image class ...
-
colorMap
-
return the receivers colormap
-
colorMap: anArrayOrColorMap
-
set the receivers colormap
-
depth
-
return the receivers depth
-
fileName
-
return the filename, from which the receiver was created,
or nil, if it was not read from a file
-
filename
-
return the filename, from which the receiver was created,
or nil, if it was not read from a file
-
forgetBits
-
for image, which also keeps the bits - so there is
no need to hold them again here
-
mask
-
for compatibility with images; forms have no mask/alpha channel
-
photometric
-
for compatibility with Image class ...
-
samplesperPixel
-
for compatibility with Image class ...
-
valueAt: aPoint
-
return the pixel at aPoint; the coordinates start with 0@0
in the upper left, increasing to the lower right
-
valueAt: aPoint put: value
-
set the pixel at aPoint; the coordinates start with 0@0
in the upper left, increasing to the lower right.
binary storage
-
readBinaryContentsFrom: stream manager: manager
-
tell the newly restored Form about restoration
-
storeBinaryDefinitionOn: stream manager: manager
-
store a binary representation of the receiver on stream.
This is an internal interface for binary storage mechanism.
Redefined to store the actual bits, even if I have been loaded
from a file, and to ommit all device related stuff.
comanche processing
-
asHtmlElementIn: htmlContainer
-
answer my HTML representation (String),
as I would look like inside htmlContainer
-
asHttpResponseTo: request
-
-
asWebImage
-
return a MIMEDocument
converting
-
asForm
-
convert & return the receiver into a Form instance - nothing to be done here
-
asImage
-
convert & return the receiver into an Image instance
-
asImageForm
-
convert & return the receiver into a ImageForm instance
copying
-
executor
-
redefined for faster creation of finalization copies
(only device, gcId and drawableId are needed)
-
postCopy
-
redefined to copy the colorMap as well
editing
-
show
-
open an imageView on the receiver
getting a device form
-
asFormOn: aDevice
-
convert & return the receiver into a Form instance
and associate it to a device (i.e. download its bits).
Added for protocol compatibility with Image.
-
asMonochromeFormOn: aDevice
-
added for protocol compatiblity with Image
-
exactOn: aDevice
-
for compatibility with color protocol - here, the same as #onDevice.
-
exactOrNearestOn: aDevice
-
for compatibility with color protocol - here, the same as #onDevice.
-
nearestOn: aDevice
-
for compatibility with color protocol - here, the same as #onDevice.
-
on: aDevice
-
associate the receiver to a device (i.e. download its bits);
return a deviceForm (possibly different from the receiver).
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
onDevice: aDevice
-
associate the receiver to a device (i.e. download its bits);
return a deviceForm (possibly different from the receiver).
image manipulations
-
clearMaskedPixels
-
Added for protocol compatibility with Image.
-
darkened
-
return a darkened version of the receiver.
Added for protocol compatibility with Color and Image.
Here, the receiver is returned as a kludge
- actually should return a darkened image (or Color black ?) ..
-
easyMagnifiedBy: extent into: newForm
-
return a new form magnified by extent, aPoint.
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'
-
flipHorizontal
-
return a new form flipped vertically
-
flipVertical
-
return a new form flipped horizontally
-
hardMagnifiedBy: extent
-
return a new form magnified by extent, aPoint.
This method handles non-integral factors.
-
lightened
-
return a lightened version of the receiver.
Added for protocol compatibility with Color and Image.
Here, the receiver is returned as a kludge
- actually should return a lightened image (or Color white ?) ..
-
magnifiedBy: extent
-
return a new form magnified by extent, aPoint.
If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'
-
magnifiedTo: anExtent
-
return a new form magnified to have the size specified by extent.
This may distort the image if the arguments ratio is not the images ratio.
See also #magnifiedPreservingRatioTo: and #magnifiedBy:
-
magnifyBy: scale
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
initialization
-
createGC
-
physically create a device GC.
Since we do not need a gc-object for the drawable until something is
really drawn, none is created up to the first draw.
This method is sent, when the first drawing happens.
Redefined here to create a bitmap GC (some devices (i.e. windows) require
different GC's for different canvases.
-
initGC
-
stop server from sending exposure events for Forms -
(will fill up stream-queue on some stupid (i.e. sco) systems
-
initialize
-
-
recreate
-
reconstruct the form after a snapin or a migration
-
releaseFromDevice
-
flush device data.
The sender has to take care that the Form has been
unregistered from (Finalization-)Lobby
inspecting
-
inspectorClass
-
redefined to launch an ImageInspector
(instead of the default InspectorView).
printing & storing
-
storeOn: aStream
-
append an ascii representation of the receiver to aStream,
from which a copy of the receiver can be reconstructed
private
-
beImmediateForm
-
read the pixels from the device into a local data array.
This makes certain that a fileName form is independent of
its fileName.
To make the image smaller (i.e. not keep all those bitmaps),
this is NOT done by default.
-
flushDeviceHandles
-
flush device handles (sent after a restart)
-
getBits
-
if the receiver was not created from a file, or
an array (i.e. it was drawn), read the pixels from the
device into a local data array. This has to be done before
an image is saved, or the receiver is storedBinary, since
the information present in the device is lost after restart/reload
-
readFromFile: fn
-
read a monochrome form from a file (in xbm-format).
The fileName argument, fn should be a relative pathname
such as bitmaps/foo.xbm and the corresponding file
will be searched in the standard places (i.e. along the SEARCHPATH).
Notice, when saving an image, only that fileName is kept with the
form, and the file is reloaded at image startup time.
You should therefore make certain, that the file is present at image
reload time. (this is done to make the image smaller ...)
If you dont like that behavior (or your application should be able to
restart fully standAlone), send #beImmediateForm to all instances of
Form - this will set the data instance variable to a ByteArray containing
the actual bits and will therefore no longer depend on the file being present.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
readFromFile: filename resolution: dpi
-
read a monochrome form from a file, which is assumed to have data for a dpi-resolution;
if the actual resolution of the device differs, magnify the form.
Read the comment in #readFromFile: on what happenes if the file is no longer present
after an image reload.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
restored
-
flush device data, when restored (sent after a binaryLoad)
-
width: w height: h
-
actual create of a monochrome form
-
width: w height: h depth: d
-
actual create of an arbitrary deep form (but, must be supported by device)
-
width: wIn height: hIn fromArray: anArray
-
actual create of a monochrome form from array.
This method is somewhat more complicated as it should be due to
supporting both byte-wise (ST/X-type) and short-word-wise (ST-80-type)
Arrays; in the later case, the shorts are first converted to bytes in
a ByteArray, then passed to the device.
-
width: w height: h offset: offs fromArray: anArray
-
actual create of a monochrome form from array
queries
-
ascentOn: aGC
-
displayOn: does not draw above baseline
-
bounds
-
return my bounds (added to make forms usable as VisualComponents)
-
colorFromValue: pixel
-
given a pixelValue, return the corresponding color.
For compatibility with Images
-
hasBits
-
return true, if the receiver has its pixel data available.
For forms, which were created from data, this is always true.
For forms, which were created as off-screen device forms on some
device, this is always false.
-
heightOn: aGC
-
return my height, if displayed on aGC;
since my height is independent of the device (the number of pixels),
return the pixel-height
-
isDithered
-
for compatibility with color protocol
-
isForm
-
return true, if the receiver is some kind of form;
true is returned here - the method is redefined from Object.
-
isImageOrForm
-
return true, if the receiver is some kind of image or form;
true is returned here - the method is redefined from Object.
-
widthOn: aGC
-
return my width, if displayed on aGC;
since my width is independent of the device (the number of pixels),
return the pixel-width
DeviceFormHandle
ImageForm
|