eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'GraphicsMedium':

Home

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

Class: GraphicsMedium


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
      |
      +--Form

Package:
stx:libview
Category:
Graphics-Support
Version:
rev: 1.89 date: 2023/11/21 14:09:25
user: cg
file: GraphicsMedium.st directory: libview
module: stx stc-classLibrary: libview

Description:


this is an abstract superclass for all kinds of drawables which
have a physical representation (i.e. have an extent). 
Don't use messages from here - it will vanish soon.

[Instance variables:]

    width           <SmallInteger>  the width (device dependent, usually pixels or inches)
    height          <SmallInteger>  the height (device dependent, usually pixels or inches)

copyright

COPYRIGHT (c) 1989 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:

Signal constants
o  drawingOnClosedDrawableSignal
return the signal which is raised, if drawing is attempted
on a closed drawable.
This is especially useful, if a forked thread animates
a view in the background, and is not properly synchronized
with the window thread - i.e. the window gets closed by the user,
and the background process continues to draw.
In this case, the background thread should handle this signal
and terminate itself in the handler.

accessing-defaults
o  defaultFont
get the default font used for drawing

o  defaultFont: aFont
set the default font used for drawing

instance creation
o  new
create a new drawable - take the current display as
its device (for now, this may be changed until the view is
physically created)

Usage example(s):

    'Warning: DeviceGraphicsContext (' print. self name print. ') should not be created with new' printNL.

o  on: aDevice
create a new drawable on aDevice

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

o  onDevice: aDevice
create a new drawable on aDevice

queries
o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.


Instance protocol:

Compatibility-ST80
o  displayArc: origin radius: radius from: startAngle angle: angle
draw an arc around a point

o  displayArcBoundedBy: boundingBox startAngle: startAngle sweepAngle: sweepAngle
draw an arc/circle/ellipse - ST-80 compatibility

o  displayArcBoundedBy: boundingBox startAngle: startAngle sweepAngle: sweepAngle at: origin
draw an arc/circle/ellipse - ST-80 compatibility

o  displayLineFrom: startPoint to: endPoint translateBy: anOffset
draw a line - ST-80 compatibility

o  displayPolyline: aPolygon
draw a polygon - ST-80 compatibility

o  displayRectangularBorder: aRectangle
draw a rectangle - ST-80 compatibility

o  displayRectangularBorder: aRectangle at: aPoint
draw a rectangle - ST-80 compatibility

o  displayWedgeBoundedBy: boundingBox startAngle: startAngle sweepAngle: sweepAngle
fill an arc/circle/ellipse - ST-80 compatibility.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  displayWedgeBoundedBy: boundingBox startAngle: startAngle sweepAngle: sweepAngle at: origin
fill an arc/circle/ellipse - ST-80 compatibility.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  findFont: aFontDescription
given a fontDescription, return a device-font for it
on my device.

o  key

o  phase
return the origin within the mask (used to draw with patterns).
This is an alias for ST/X's #maskOrigin

o  phase: aPoint
set the origin within the mask (used to draw with patterns).
This is an alias for ST/X's #maskOrigin:

o  setDevicePattern: aColorOrMask
ST/X can paint in any color or image

o  tilePhase
return the origin within the mask (used to draw with patterns).
This is an alias for ST/X's #maskOrigin

o  tilePhase: aPoint
set the origin within the mask (used to draw with patterns).
This is an alias for ST/X's #maskOrigin

o  widthOfString: aString
given a string, return its width in pixels if
drawn on the receiver's device.

o  widthOfString: aString from: start to: stop
given a string, return the width in pixels if
a substring is drawn on the receiver's device.

Compatibility-Squeak
o  copyBits: aRectangle from: aForm at: srcOrigin clippingBox: clippingBox rule: rule fillColor: fillColor
ST-80 compatibility: numeric rule

Usage example(s):

      |dst src|

      dst := Form width:8 height:8 fromArray:#[
                                              2r00000000
                                              2r00000000
                                              2r00000000
                                              2r00000000
                                              2r11111111
                                              2r11111111
                                              2r11111111
                                              2r11111111
                                             ].
      src := Form width:8 height:8 fromArray:#[
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                             ].

    dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
    dst inspect

Usage example(s):

      |dst src|

      dst := Form width:8 height:8 fromArray:#[
                                              2r00000000
                                              2r00000000
                                              2r00000000
                                              2r00000000
                                              2r11111111
                                              2r11111111
                                              2r11111111
                                              2r11111111
                                             ].
      src := Form width:8 height:8 fromArray:#[
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                              2r00001111
                                             ].

    dst copyBits:(0@0 corner:8@8) from:src at:0@0 clippingBox:(0@0 corner:8@8) rule:15 fillColor:Color black.
    dst inspect

o  fill: aRectangle fillColor: aColor
fill the rectangular area specified by aRectangle with the black color

o  fillBlack: aRectangle
fill the rectangular area specified by aRectangle with the black color

o  fillColor: something
fill the receiver with something;
something may be a Form, Color or colorIndex

o  fillRectangle: aRectangle color: aColor
fill a rectangle with the given paint color

o  fillWhite
fill all of the receiver with the white color

o  fillWhite: aRectangle
fill the rectangular area specified by aRectangle with the white color

Compatibility-VW
o  displayBackgroundIfNeededOn: aGraphicsContext

o  inactiveForegroundColor
a dummy method to support VW widgets

o  selectionBackgroundColor
a dummy method to support VW widgets

o  selectionForegroundColor
a dummy method to support VW widgets

o  separatorColor
a dummy method to support VW widgets

accessing
o  at: aPoint
return the pixel at the coordinate given by aPoint

o  at: aPoint put: aPixelColor
set a pixel

Usage example(s):

     Display rootView at:(0@0) put:(Color red).
     Display rootView at:(1@1) put:(Color red).
     Display rootView at:(2@2) put:(Color red).
     Display rootView at:(3@3) put:(Color red).
     Display rootView at:(4@4) put:(Color red).
     Display rootView at:(5@5) put:(Color red).

o  atX: x y: y
return the pixel at the coordinate given by x/y

o  atX: x y: y put: aPixelColor
set a pixel

o  backgroundPaint
return the background paint color.
(used for opaqueForms and opaqueStrings)

o  backgroundPaint: aColor
set the background-paint color; this is used in opaque-draw
operations

o  basicFont
return the font for drawing

o  basicFont: aFont
set the font for drawing if it has changed.
This is a low level entry, which is not to be redefined
(i.e. it must not imply a redraw operation)

o  blackColor

o  bottomCenter
return the topCenter point

o  bottomLeft
return the bottomLeft point

o  boundingBox

o  capStyle
return the current cap-style for line-drawing.
possible styles are: #notLast, #butt, #round, #projecting

o  capStyle: aStyleSymbol
set the cap-style for line-drawing;
possible styles are: #notLast, #butt, #round, #projecting

o  center
return the point at the center of the receiver

o  characterEncoding
returns a symbol describing how the contents is encoded internally.
For now, this should be the same encoding as my fonts encoding (otherwise, mappings would
occur when drawing).
This is (currently) only passed down from the fileBrowser,
and required when japanese/chinese/korean text is edited.
(encoding is something like #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc)

o  characterEncoding: encodingArg
define how the contents is encoded internally.
This should normally never be required, as ST/X now assumes
unicode (of which iso8859-1 is a subset) encoding.
The possibility to change the characterEncoding is provided as
a backward compatibility hook for programs which want to use
another encoding internally. One such view is the CharacterSetView,
which wants to show character as they are actually present in a font.

o  clipByChildren
drawing shall be done into my view only (default)

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

o  clipRect
return the clip-rectangle for drawing.
If there is currently no active clip, return the underlying
displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility.

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

o  clipRect: aRectangle
set the drawing clip-rectangle

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

o  clippedByChildren: aBoolean
turn on/off drawing over children.
If on, a superview may draw 'over' its children.
If off (the default), drawing is 'under' its children.
Only useful for the rootView, to draw over any visible views.
(for example, when dragging a rubber-line)

o  clippingBounds
return the clipping rectangle for drawing (in logical coordinates),
nil if there is none.

o  clippingBounds: aRectangleOrNil
set the clipping rectangle for drawing (in logical coordinates);
a nil argument turn off clipping (i.e. whole view is drawable)

o  clippingBoundsOrNil
return the clipping rectangle for drawing, nil if there is none.

o  clippingRectangle: aRectangleOrNil
set the clipping rectangle for drawing (in logical coordinates);
a nil argument turn off clipping (i.e. whole view is drawable)

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

o  clippingRectangleOrNil
return the clipping rectangle for drawing, nil if there is none.

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

o  colorAt: aPoint
return the color of the pixel at the coordinate given by x@y

o  colorAtX: x y: y
return the color of the pixel at the coordinate given by aPoint

o  container
return my container - for protocol compatibility

o  corner
return the corner point i.e. the bottom-right point

o  corner: aPoint
set the corner point i.e. change extent so that corner will be
aPoint while leaving the origin unchanging

o  dashStyle: aDashList offset: dashOffset
define dashes. Each element of the dashList specifies the length
of a corresponding dash. For example, setting it to [4 4]
defines 4on-4off dashing;
Setting it to [1 2 4 2] defines 1on-2off-4on-2off dashes.
The dashOffset specifies where in the dashList the dashing starts.
Ignored here - this may not be supported by all graphics devices.

o  depth

** This method must be redefined in concrete classes (subclassResponsibility) **

o  device
return the device, the receiver is associated with.
Please use graphicsDevice for ST80 compatibility.

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

o  device: aDevice
set the device

o  deviceClippingBounds: aRectangleOrNil
set the clipping rectangle for drawing (in device coordinates);
a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)

o  deviceClippingBoundsOrNil
return the clipping rectangle as physical coordinated for drawing, nil if there is none.

o  deviceClippingRectangle: aRectangleOrNil
set the clipping rectangle for drawing (in device coordinates);
a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)

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

o  deviceFont
return the current drawing font as a device font

o  drawableId
return the id of the drawable on the device

o  font
return the current drawing font

o  font: aFont
set the font for drawing if it has changed.
This should be redefined in some widget to perform an automatic
redraw/invalidate. See also: #basicFont:

o  function
return the current drawing function

o  function: aSymbol
set the drawing function if it has changed.
The argument is one of:
#copy,#copyInverted,#xor,#and,#andReverse
#andInverted,#or,#orReverse,#orInverted
#invert,#clear,#set,#noop,#equiv,#nand
Notice: not all graphicMedia support all functions

o  gcId
return the receiver's graphic context id on the device

o  graphicsContext

o  graphicsContext: newGc
set the graphics context

o  graphicsDevice
same as #device, for ST-80 compatibility

o  id
return the id of the drawable on the device.
Obsolete, use #drawableId!

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

o  joinStyle
return the current join-style for polygon-drawing.
possible styles are: #miter, #bevel, #round

o  joinStyle: aStyleSymbol
set the join-style of lines in polygon-drawing;
possible styles are: #miter, #bevel, #round

o  left
return the left i.e. x-coordinate of top-left of the receiver

o  leftCenter
return the leftCenter point

o  lineStyle
return the current line-drawing-style.
possible styles are: #solid, #dashed, #doubleDashed,
#dotted, #dashDot or #dashDotDot.

o  lineStyle: aStyleSymbol
set the line-drawing-style;
possible styles are: #solid, #dashed, #doubleDashed,
#dotted, #dashDot or #dashDotDot.

o  lineWidth
return the current drawing linewidth

o  lineWidth: aNumber
set the line drawing width in pixels

o  mask
return the current drawing mask

o  mask: aForm
set the drawing mask

o  maskOrigin
return the origin within the mask (used to draw with patterns).
Should be redefined in classes which support it.
This is an alias for ST-80's #phase

o  maskOrigin: aPoint
set the origin within the mask (used to draw with patterns).
Should be redefined in classes which support it.
This is an alias for ST-80's #phase:

o  maskOriginX: x y: y
set the origin within the mask (used to draw with patterns).
Should be redefined in classes which support it.
This is an alias for ST-80's #phase:

o  medium
return the destination medium i.e. the underlying graphics device

o  noClipByChildren
drawing shall also be done into subviews

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

o  origin
return the origin i.e. coordinate of top-left of the receiver

o  paint
return the current paint drawing color

o  paint: aColor
set the drawing painting color, aColor can be a dithered one

o  paint: fgColor on: bgColor
set the paint and backgroundPaint, used for text and bitmaps.
Both colors may be dithered colors

o  paint: fgColor on: bgColor function: f
set paint, background-paint and function

o  realized
return true, if the receiver is realized.
The receiver may still be unmapped, if the container is unrealized.
Use reallyRealized to make certain that I am really mapped.

o  reallyRealized
return true, if the receiver is realized and all containers
are realized.

o  rightCenter
return the leftCenter point

o  setClippingBounds: aRectangleOrNil

o  setDevice: aDevice
set the device

o  setGraphicsExposures: aBoolean
want to if aBoolean is true - or don't want to be notified
of graphics exposures

o  setMaskOrigin: aPoint
set the origin within the mask (used to draw with patterns).
OBSOLETE: use #maskOrigin: or #phase:

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

o  setMaskOriginX: x y: y
set the origin within the mask (used to draw with patterns).
OBSOLETE: use #maskOriginX:y: or #phase:

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

o  top
return the top i.e. y-coordinate of top-left of the receiver

o  topCenter
return the topCenter point

o  topRight
return the topRight point

o  viewBackground
for protocol compatibility with view; return my background paint color here

o  viewOrigin
return the drawable's visible origin (for scrolling)

o  whiteColor

accessing-dimensions
o  extent
return the extent;
i.e. a point with width as x, height as y coordinate

o  extent: extent
set the extent.
Might be redefined to perform other actions (especially notifications)

o  height
return the height of the receiver

o  height: anInteger
set the height of the receiver.
Might be redefined to perform other actions (especially notifications)

o  setHeight: anInteger
set the view's height in pixels.
Direct setter, not redefined in subclasses

o  setWidth: anInteger
set the view's width in pixels.
Direct setter, not redefined in subclasses

o  setWidth: w height: h
set both width and height.
Direct setter, not redefined in subclasses

o  width
return the width of the receiver

o  width: anInteger
set the width of the receiver.
Might be redefined to perform other actions (especially notifications)

o  width: w height: h
set both width and height of the receiver.
Might be redefined to perform other actions (especially notifications)

accessing-internals
o  background
return the current background drawing color.
OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:

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

o  background: aColor
set the internal background color for drawing - aColor must be a real color.
OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:

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

o  foreground
return the current foreground drawing color.
OBSOLETE: use #paint: / #paint:on:

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

o  foreground: aColor
set the internal foreground color for drawing - aColor must be a real color.
OBSOLETE: this method will vanish; use #paint: / #paint:on:

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

o  foreground: fgColor background: bgColor
set both internal foreground and internal background colors
- these must be real colors.
OBSOLETE: this method will vanish; use #paint: / #paint:on:

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

o  foreground: fgColor background: bgColor function: fun
set foreground, background colors and function.
OBSOLETE: this method will vanish; use #paint: / #paint:on:

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

o  foreground: aColor function: fun
set the foreground color and function for drawing.
OBSOLETE: this method will vanish; use #paint: / #paint:on:

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

o  setRealized: aBoolean
low level special interface to manipulate the realized state.
Non-public interface, only to be used by experts.
(use to pretend a view has been realized - for example with alien views)

accessing-transformation
o  scale
return the scale factor (as point) of the transformation

o  scale: aPoint
set the scale factor of the transformation

o  transformation
return the transformation

o  transformation: aTransformation
set the transformation

o  translateBy: aPoint
add to the translation offset of the transformation

o  translation
return the translation factor (as point) of the transformation

o  translation: aPoint
set the translation offset of the transformation

basic drawing
o  displayArcX: x y: y width: width height: height from: startAngle angle: angle
draw an arc in a box
- this could be recoded to draw using displayLine.
The angles may be float or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  displayDottedRectangleX: x y: y width: w height: h
draw a dotted-line rectangle
A general implementation is found here; deviceGC's
may reimplement this if directly supported by the device

o  displayHorizontalWavelineFromX: x0 y: y0 toX: x1
draw a horizontal wave-line from x0/y0 to x1/y0

o  displayLineFromX: x0 y: y0 toX: x1 y: y1
draw a line from x0/y0 to x1/y1

o  displayOpaqueForm: aForm x: x y: y
draw a form at x/y;
if the form has depth 1, 1's in the form are
drawn in current fg, 0's in current bg color.
If the form has depth ~~ 1, it is copied as is onto the receiver

o  displayOpaqueString: aString from: index1 to: index2 x: x y: y
draw part of a string with both fg and bg at x/y in current font

o  displayPolygon: aPolygon
draw a polygon
- this could be recoded to draw using displayLine

o  displayRectangleX: x y: y width: w height: h
draw a rectangle
- this could be recoded to draw using displayLine

o  displayString: aString from: index1 to: index2 x: x y: y
draw part of a string with fg at x/y in current font

o  displayString: aString from: index1 to: index2 x: x y: y opaque: opaque
draw part of a string with both fg and bg at x/y in current font

o  displayString: aString from: index1 to: index2 x: x y: y opaque: opaque maxWidth: maxWidth
draw part of a string with both fg and bg at x/y in current font

basic filling
o  fillArcX: x y: y width: w height: h from: start angle: angle
fill an arc with current paint color.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  fillPolygon: points
fill a polygon with current paint color

o  fillRectangleX: x y: y width: w height: h
fill a rectangle with current paint color

o  fillRectangleX: x y: y width: w height: h color: aColor
fill a rectangle with given color

bit blitting
o  copyBitsFrom: aByteArray bitsPerPixel: bpp depth: depth padding: pad width: srcW height: srcH x: srcX y: srcY toX: dstX y: dstY
copy bits from a smalltalk byteArray.
The bits found there are supposed to be in the devices native format (i.e.
translated to allocated color indices on pseudoColor devices and padded as required.
The byteOrder is MSB and will be converted as appropriate by the underlying devices
method to whatever the device needs.

o  copyFrom: aGC toX: dstX y: dstY
copy from a drawable - maybe self

o  copyFrom: aGC x: srcX y: srcY toX: dstX y: dstY width: w height: h
copy from a drawable - maybe self

o  copyFrom: aDrawable x: srcX y: srcY toX: dstX y: dstY width: w height: h async: async
copy from aDrawable into the receiver;
the source may be the receiver as well - in this case its a scroll.
All coordinates are in device coordinates.
If the receiver is a view AND async is true, the call returns immediately
- otherwise, it returns when the scroll operation is finished.
(not all devices care for this).
If the receiver is a pixmap, the call always returns immediately.

o  copyFrom: aGC x: dstX y: dstY width: w height: h
copy from a drawable - maybe self

o  copyPlaneFrom: aDrawable x: srcX y: srcY toX: dstX y: dstY width: w height: h
copy one plane from aDrawable into the receiver. 0's are drawn in
background, while 1's are drawn with foreground color.
The depth of aDrawable must (should) be 1.
The drawable must have been allocated on the same device.
All coordinates are in device coordinates.

coordinate translation
o  translatePoint: aPoint from: anotherWindowOrNilForScreen
translate a point in anotherWindowOrNilForScreen (or root window if nil) to myself.
anotherWindowOrNilForScreen must be on the same display

o  translatePoint: aPoint to: anotherWindowOrNilForScreen
translate a point in myself to anotherWindowOrNilForScreen (or root window if nil).
anotherWindowOrNilForScreen must be on the same display

o  translatePointFromRoot: aPoint
translate a point in root window coordinates to myself.

o  translatePointToRoot: aPoint
translate a point in myself to root window coordinates.

copying-private
o  postCopy
this may not be enough to allow copying of views ...

Usage example(s):

super postCopy.

o  postDeepCopy
(comment from inherited method)
allows for cleanup after deep copying.
To be redefined in subclasses.

drawing
o  display: someObject at: aPoint
draw someObject - this must understand the #displayOn:at: message

o  displayArcIn: aRectangle from: startAngle angle: angle
draw an arc in a box

o  displayArcOrigin: origin corner: corner from: startAngle angle: angle
draw an arc in a box

o  displayArcX: x y: y w: w h: h from: startAngle angle: angle
draw an arc; apply transformation if nonNil

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

o  displayCircle: aPoint radius: r
draw a circle around a center point

o  displayCircleIn: aRectangle
draw a circle in a box

o  displayCircleX: x y: y radius: r
draw a circle around a center point

o  displayForm: aFormOrImage
draw a form (or image) at the origin

o  displayForm: aFormOrImage at: aPoint
draw a form (or image)

o  displayForm: formToDraw x: x y: y
draw a form or image non opaque;
if it's a 1-plane bitmap, 1-bits are drawn in the
current paint-color, leaving pixels with 0-bits unchanged
(i.e. only 1-bits are drawn from the form).
If it's a deep form (i.e. a pixmap) the current paint
settings are ignored and the form is drawn as-is.
Care must be taken, that the paint color is correctly allocated
(by sending #on: to the color) before doing so.
Using functions other than #copy only makes sense if you are
certain, that the colors are real colors (actually, only for
noColor or allColor).

o  displayForm: aFormOrImage x: x y: y opaque: opaque
draw a form (or image) at x/y;
if the form has depth 1, 1's in the form are
drawn in current paint color, 0's are ignored.
If the form has depth ~~ 1, the current fg color setting is ignored.

o  displayImage: aFormOrImage
draw an image (or form).
Provided for ST-80 compatibilty;
in ST/X, images are also handled by #displayForm:

o  displayImage: aFormOrImage at: aPoint
draw an image (or form).
Provided for ST-80 compatibilty;
in ST/X, images are also handled by #displayForm:

o  displayImage: aFormOrImage x: x y: y
draw an image (or form).
Provided for ST-80 compatibilty;
in ST/X, images are also handled by #displayForm:

o  displayLineFrom: point1 to: point2
draw a line

o  displayLineFromX: xStart y: yStart toX: xEnd y: yEnd brush: aForm
draw a line using a brush.
Here, a slow fallback is used, drawing into a
temporary bitmap first, which is then displayed

o  displayOpaqueString: aString at: aPoint
draw a string with both fg and bg

o  displayOpaqueString: aString from: start to: stop at: aPoint
draw part of a string - drawing both fg and bg

o  displayOpaqueString: aString x: x y: y
draw a string at the coordinate x/y - draw foreground pixels in paint-color,
background pixels in bgPaint color. If the transformation involves scaling,
the fonts point-size is scaled as appropriate.
Assuming that device can only draw in device colors, we have to handle
the case where paint and/or bgPaint are dithered colors or images.

o  displayOpaqueString: aString x: x y: y angle: drawAngle
draw a string along a (possibly non-horizontal) line,
drawing both fg and bg pixels.
The angle is in degrees, clock-wise, starting with 0 for
a horizontal draw.
Drawing is done by first drawing the string into a temporary bitmap,
which is rotated and finally drawn as usual.
NOTICE: due to the rotation of the temporary bitmap, this is a slow
operation - not to be used with cillions of strings ...

Usage example(s):

     |v|

     v := View new.
     v extent:300@200.
     v openAndWaitUntilVisible.
     0 to:360 by:45 do:[:a |
         v paint:Color black on:Color red.
         v displayOpaqueString:'hello world' x:100 y:100 angle:a.
     ].

o  displayPoint: aPoint
draw a pixel

o  displayPointX: x y: y
draw a point (with current paint-color); apply transformation if nonNil

o  displayRectangle: aRectangle
draw a rectangle

o  displayRectangleOrigin: origin corner: corner
draw a rectangle

o  displayRectangleOrigin: origin extent: extent
draw a rectangle

o  displayRoundRectangleX: left y: top width: width height: height wCorner: wCorn hCorner: hCorn
|v|

(v := View new) extent:200@200; openAndWaitUntilVisible.
v displayRoundRectangleX:10 y:10 width:100 height:100 wCorner:20 hCorner:20

o  displayString: aString at: aPoint
draw a string - drawing fg only

o  displayString: aString centeredAt: aPoint
draw a string - drawing fg only

o  displayString: aString centeredAtX: x y: y
draw a string - drawing fg only

o  displayString: aString from: start to: stop at: aPoint
draw part of a string - drawing fg only

o  displayString: aString x: x y: y
draw a string at the coordinate x/y -
draw foreground-pixels only (in current paint-color),
leaving background as-is. If the transformation involves scaling,
the fonts point-size is scaled as appropriate.

o  displayString: aString x: x y: y angle: drawAngle
draw a string along a (possibly non-horizontal) line - drawing fg only.
The angle is in degrees, clock-wise, starting with 0 for
a horizontal draw.
Drawing is done by first drawing the string into a temporary bitmap,
which is rotated and finally drawn as usual.
NOTICE: due to the rotation of the temporary bitmap, this is a slow
operation - not to be used with cillions of strings ...

Usage example(s):

     |v|

     v := View new.
     v extent:300@200.
     v openAndWaitUntilVisible.
     0 to:360 by:90 do:[:a |
         v paint:Color black.
         v displayString:'hello world' x:100 y:100 angle:a.
     ].

Usage example(s):

     |v|

     v := View new.
     v extent:400@400.
     v openAndWaitUntilVisible.
     0 to:360 by:5 do:[:a |
         v paint:Color black.
         v displayString:'.........hello' x:200 y:200 angle:a.
     ].

Usage example(s):

     |v|

     v := View new.
     v extent:200@100.
     v openAndWaitUntilVisible.
     v displayString:' hello' x:90 y:50 angle:0.
     v displayString:' hello' x:90 y:50 angle:45.
     v displayString:' hello' x:90 y:50 angle:90.
     v displayString:' hello' x:90 y:50 angle:180.
     v displayString:' hello' x:90 y:50 angle:270.

Usage example(s):

     |v|

     v := View new.
     v extent:200@100.
     v openAndWaitUntilVisible.
     v displayString:'hello' x:50 y:50 angle:0.
     v displayString:'hello' x:50 y:50 angle:45.
     v displayString:'hello' x:50 y:50 angle:90.
     v displayString:'hello' x:50 y:50 angle:135.
     v displayString:'hello' x:50 y:50 angle:180.
     v displayString:'hello' x:50 y:50 angle:225.
     v displayString:'hello' x:50 y:50 angle:270.
     v displayString:'hello' x:50 y:50 angle:315.

o  displayString: aString x: x y: y angle: drawAngle opaque: opaque
common code to draw a string along a (possibly non-horizontal) line.
The angle is in degrees, clock-wise, starting with 0 for
a horizontal draw.
Drawing is done by first drawing the string into a temporary bitmap,
which is rotated and finally drawn as usual.
NOTICE: due to the rotation of the temporary bitmap, this is a slow
operation - not to be used with cillions of strings ...
CAVEAT: if the string is not a real string (i.e. a LabelAndIcon),
this can (currently) only be done opaque

o  displayUnscaledForm: formToDraw x: x y: y
draw a form or image non opaque and unscaled;
if it's a 1-plane bitmap, 1-bits are drawn in the
current paint-color, leaving pixels with 0-bits unchanged
(i.e. only 1-bits are drawn from the form).
If it's a deep form (i.e. a pixmap) the current paint
settings are ignored and the form is drawn as-is.
Care must be taken, that the paint color is correctly allocated
(by sending #on: to the color) before doing so.
Using functions other than #copy only makes sense if you are
certain, that the colors are real colors (actually, only for
noColor or allColor).
The origins coordinate is transformed, but the image itself is unscaled.

o  displayUnscaledOpaqueForm: formToDraw x: x y: y
draw a form or image opaque and unscaled;
if it's a 1-plane bitmap, 1-bits are drawn in the
current paint-color, 0 bits in background color.
If it's a deep form (i.e. a pixmap) the current paint
settings are ignored and the form is drawn as-is (opaque).
The origins coordinate is transformed, but the image itself is unscaled.

o  displayUnscaledOpaqueString: aString from: index1 to: index2 x: x y: y
draw a substring at the transformed coordinate x/y but do not scale the font.
Draw foreground pixels in paint-color, background pixels in bgPaint color.

o  displayUnscaledOpaqueString: aString x: x y: y
draw a string at the transformed coordinate x/y but do not scale the font.
Draw foreground pixels in paint-color, background pixels in bgPaint color.

o  displayUnscaledString: aString from: index1 to: index2 x: x y: y
draw a substring at the transformed coordinate x/y but do not scale the font.
draw foreground-pixels only (in current paint-color), leaving background as-is.

o  displayUnscaledString: aString x: x y: y
draw a string at the transformed coordinate x/y but do not scale the font.
draw foreground-pixels only (in current paint-color), leaving background as-is.

drawing in device coordinates
o  displayDeviceForm: aForm x: x y: y
draw a form or image non opaque (i.e. only foreground color is drawn);
If it's a 1-plane bitmap, 1-bits are drawn in the
current paint-color, leaving pixels with 0-bits unchanged
(i.e. only 1-bits are drawn from the form).
If it's a deep form (i.e. a pixmap) the current paint
settings are ignored and the form is drawn as-is;
however, the mask is applied if present.

The form should must have been allocated on the same device,
otherwise its converted here, which slows down the draw.
No transformation or scaling is done.
Care must be taken, that the paint color is correctly allocated
(by sending #on: to the color) before doing so.
Using functions other than #copy only makes sense if you are
certain, that the colors are real colors (actually, only for
noColor or allColor).

o  displayDeviceLineFromX: x1 y: y1 toX: x2 y: y2
draw a line in device coordinates

o  displayDeviceOpaqueForm: aForm x: x y: y
draw a form or image opaque (i.e. both fg and bg is drawn);
If it's a 1-plane bitmap, 1-bits are drawn in the
current paint-color and 0-bits in the bgPaint color.
If it's a deep form (i.e. a pixmap) the current paint/bgPaint
settings are ignored and the form drawn as-is.
Any mask is ignored.
In the 1-plane case, special care must be taken if paint and/or bgPaint
dithered colors or patterns, since are that the colors are correctly allocated (by sending #on:
to the colors) before doing so.
The form should have been allocated on the same device; otherwise,
its converted here, which slows down the draw.
Drawing is in device coordinates; no scaling is done.

o  displayDeviceOpaqueString: aString from: index1 to: index2 x: x y: y
draw a substring at the coordinate x/y - draw foreground pixels in
paint-color and background pixels in bgPaint-color.
Assuming that device can only draw in device colors, we have to handle
the case where paint and/or bgPaint are dithered colors.
No translation or scaling is done.

o  displayDeviceOpaqueString: aString x: x y: y
draw a string at the coordinate x/y - draw foreground pixels in
paint-color and background pixels in bgPaint-color.
No translation or scaling is done

o  displayDeviceRectangleX: x y: y width: w height: h
draw a rectangle in device coordinates

o  displayDeviceString: aString from: index1 to: index2 in: font x: x y: y
draw a substring at the coordinate x/y -
draw foreground-pixels only (in current paint-color), leaving background as-is.
No translation or scaling is done

o  displayDeviceString: aString from: index1 to: index2 x: x y: y
draw a substring at the coordinate x/y -
draw foreground-pixels only (in current paint-color), leaving background as-is.
No translation or scaling is done

o  displayDeviceString: aString x: x y: y
draw a string at the coordinate x/y -
draw foreground-pixels only (in current paint-color), leaving background as-is.
No translation or scaling is done

o  fillDeviceRectangleX: x y: y width: w height: h
fill a rectangle with current paint color (device coordinates)

edge drawing
o  drawEdgesForX: x y: y width: w height: h level: l
draw 3D edges into a rectangle

o  drawEdgesForX: x y: y width: w height: h level: l shadow: shadowColor light: lightColor halfShadow: halfShadowColor halfLight: halfLightColor style: edgeStyle
draw 3D edges into a rectangle

o  edgeDrawn: whichOne
a redefinable hook for views which like to draw
over their edges (some checkToggles do).
Nothing done here.

evaluating in another context
o  reverseDo: aBlock
evaluate aBlock with foreground and background interchanged.
This can be reimplemented here in a faster way.

o  withBackground: fgColor do: aBlock
marked as obsolete by cg at 03-11-2021

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

o  withForeground: fgColor background: bgColor do: aBlock
marked as obsolete by cg at 03-11-2021

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

o  withForeground: fgColor background: bgColor mask: aMask do: aBlock
marked as obsolete by cg at 03-11-2021

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

o  withForeground: fgColor do: aBlock
marked as obsolete by cg at 03-11-2021

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

o  withPaint: aColor do: aBlock
evaluate aBlock with changed paint color.

o  xoring: aBlock
evaluate aBlock with function xoring

event handling
o  catchExpose
expose event handling is only required for views.

o  waitForExpose
expose event handling is only required for views.

filling
o  black
fill the receiver with black

o  clear
clear the receiver with background

o  clearDeviceRectangleX: x y: y width: w height: h
clear a rectangular area to background

o  clearInside
clear the receiver with background - ST-80 compatibility

o  clearRectangle: aRectangle
clear the rectangular area in the receiver to background

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

o  clearView
clear the receiver with its view background

o  fill: aColorOrFormOrColorIndex
fill the receiver with aColorOrFormOrColorIndex;
something may be a Form, Color or colorIndex

o  fillArc: origin radius: r from: startAngle angle: angle
draw a filled arc around a point.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  fillArcIn: aRectangle from: startAngle angle: angle
draw a filled arc in a box.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  fillArcOrigin: origin corner: corner from: startAngle angle: angle
draw a filled arc in a box.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  fillArcX: x y: y w: w h: h from: startAngle angle: angle
draw a filled arc; apply transformation if nonNil.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

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

o  fillArcX: x y: y width: w height: h from: startAngle to: endAngle
draw a filled arc in a box, given startAngle and endAngle.
The angles may be floats or integer - they are given in degrees.
Positive angles are taken clockwise, negative angles are counterclockwise.

o  fillCircle: aPoint radius: aNumber
draw a filled circle around aPoint

o  fillCircleIn: aRectangle
draw a filled circle in a box

o  fillCircleX: x y: y radius: r
draw a filled circle around x@y

o  fillRectangle: aRectangle
fill a rectangle with current paint color

o  fillRectangleLeft: left top: top right: cornerX bottom: cornerY
draw a filled rectangle.
Notice: the cornerPoint itself is NOT included

o  fillRectangleOrigin: origin corner: corner
draw a filled rectangle.
Notice: the cornerPoint itself is NOT included

o  fillRectangleOrigin: origin extent: extent
draw a filled rectangle.
Notice: the cornerPoint itself is NOT included

o  fillRectangleOrigin: origin width: w height: h
draw a filled rectangle.
Notice: the cornerPoint itself is NOT included

o  fillRoundRectangleX: left y: top width: width height: height wCorner: wCorn hCorner: hCorn
|v|

(v := View new) extent:200@200; openAndWaitUntilVisible.
v fillRoundRectangleX:10 y:10 width:100 height:100 wCorner:20 hCorner:20

o  invertRectangle: aRectangle
invert a rectangle in the receiver

o  white
fill the receiver with white

initialization & release
o  close
same as destroy - for ST-80 compatibility

o  defaultFont

o  destroy
destroy a medium - here the gc is completely destroyed

o  initGC
since we do not need a gc-object for the drawable until something is
really drawn, none is created.
This method is sent, when the first drawing happens

o  initialize
must be called if redefined

Usage example(s):

super initialize.

o  initializeForDevice: aDevice
allocate a GraphicsContext for a device

o  recreate
reacreate a medium after snapIn

o  releaseGC
destroy the associated device GC resource - can be done to be nice to the
display if you know that you are done with a drawable.

misc
o  clippedTo: aRectangle do: aBlock

o  flush
send all buffered drawing to the device.

o  setDevice: aDevice id: aDrawbleId gcId: aGCId
private

o  setPaint: fgColor on: bgColor
set the paint and background-paint color.
The bg-paint is used in opaque-draw operations.
Only set the variables, but do not send it to the device,
Used on initialization.

o  sync
send all buffered drawing to the device and wait until the device responds

printing & storing
o  storeOn: aStream
blocked: ascii storeString not possible (recursive - view - subviews - container)

queries
o  fontAscent
answer the ascent of the current font on the current device

o  hasRectangularBounds
can be redefined, but then it should also provide handles

o  horizontalIntegerPixelPerMillimeter
return the (rounded) number of pixels per millimeter

o  horizontalPixelPerInch
return the number of horizontal pixels per inch of the display

o  horizontalPixelPerMillimeter
return the number of pixels per millimeter (not rounded)

o  horizontalPixelPerMillimeter: millis
return the number of pixels (not rounded) for millis millimeter

o  resolution
return a point consisting of pixel-per-inch horizontally and vertically.

o  verticalIntegerPixelPerMillimeter
return the (rounded) number of pixels per millimeter

o  verticalPixelPerInch
return the number of vertical pixels per inch of the display

o  verticalPixelPerMillimeter
return the number of pixels per millimeter (not rounded)

o  verticalPixelPerMillimeter: millis
return the number of pixels (not rounded) for millis millimeter

testing
o  isPSGraphicsContext

view creation
o  createBitmapFromArray: data width: width height: height
create a bitmap from data and set the drawableId

o  createPixmapWidth: w height: h depth: d
create a pixmap and set the drawableId

o  createRootWindow

o  createWindowFor: aView type: typeSymbol origin: org extent: ext minExtent: minE maxExtent: maxE borderWidth: bw subViewOf: sv style: styleSymbol inputOnly: inp label: label owner: owner icon: icn iconMask: icnM iconView: icnV
create a window and set the drawableId



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 11:34:15 GMT