Graphics

AbstractFont
AbstractFont defines the generic interface that all fonts need to implement.
approxWidthOfText:
Return the width of aText -- quickly, and a little bit dirty. Used by lists morphs containing Text objects to get a quick, fairly accurate measure of the width of a list item.
ascent
ascentOf:
baseKern
basicAscentOf:
basicDescentOf:
characterToGlyphMap
Return the character to glyph mapping table. If the table is not provided the character scanner will query the font directly for the width of each individual character.
derivativeFonts
descent
descentOf:
displayStrikeoutOn:from:to:
display the strikeout if appropriate for the receiver
displayString:on:from:to:at:kern:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) display context.
displayString:on:from:to:at:kern:baselineY:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) display context.
displayUnderlineOn:from:to:
display the underline if appropriate for the receiver
emphasisString
Answer a translated string that represents the receiver's emphasis.
emphasisStringFor:
Answer a translated string that represents the attributes given in emphasisCode.
familyName
Answer the name to be used as a key in the TextConstants dictionary.
hasDistinctGlyphsForAll:
Answer true if the receiver has glyphs for all the characters
in asciiString and no single glyph is shared by more than one character, false otherwise.
The default behaviour is to answer true, but subclasses may reimplement
hasGlyphsForAll:
Answer true if the receiver has glyphs for all the characters
in asciiString, false otherwise.
The default behaviour is to answer true, but subclasses may reimplement
height
Answer the height of the receiver, total of maximum extents of
characters above and below the baseline.
installOn:foregroundColor:backgroundColor:
Install the receiver on the given DisplayContext (either BitBlt or Canvas) for further drawing operations.
isFontSet
isRegular
isSubPixelPositioned
Answer true if the receiver is currently using subpixel positioned
glyphs, false otherwise. This affects how padded space sizes are calculated
when composing text.
Currently, only FreeTypeFonts are subPixelPositioned, and only when not
Hinted
isSymbolFont
Answer true if the receiver is a Symbol font, false otherwise.
The default is to answer false, subclasses can reimplement
isTTCFont
kerningLeft:right:
lineGrid
Answer the relative space between lines
linearWidthOf:
This is the scaled, unrounded advance width.
pixelSize
Make sure that we don't return a Fraction
pixelsPerInchChanged
The definition of TextStyle class>>pixelsPerInch has changed. Do whatever is necessary.
pointSize
releaseCachedState
textStyle
textStyleName
Answer the name to be used as a key in the TextConstants dictionary.
widthAndKernedWidthOfLeft:right:into:
Set the first element of aTwoElementArray to the width of leftCharacter and
the second element to the width of left character when kerned with
rightCharacterOrNil. Answer aTwoElementArray
widthOf:
Return the width of the given character
widthOfString:
widthOfString:from:to:
Measure the length of the given string between start and stop index
widthOfStringOrText:
xTable
Return the xTable for the font. The xTable defines the left x-value for each individual glyph in the receiver. If such a table is not provided, the character scanner will ask the font directly for the appropriate width of each individual character.
AcornWindowProxy
An AcornWindowProxy is xxxxxxxxx.
Instance Variables
flags: <Object>
flags
- xxxxx
addButton:
we need a button on the window. If there is already one, ignore this.
If the host window does not yet exist we need only set the flag. If there is
already a window, we will need to destroy the old window, add the flag and recreate
addCloseButton
we need a close button on the window. If there is already one, ignore this.
If the host window does not yet exist we need only set the flag. If there is
already a window, we will need to destroy the old window, add the flag and recreate
addFlag:
add flagVal to the flags
addIconiseButton
we need a iconise button on the window. If there is already one, ignore this.
If the host window does not yet exist we need only set the flag. If there is
already a window, we will need to destroy the old window, add the flag and recreate
addToggleSizeButton
we need a toggle size button on the window. If there is already one, ignore this.
If the host window does not yet exist we need only set the flag. If there is
already a window, we will need to destroy the old window, add the flag and recreate
attributes
return the ByteArray representing the desired window attributes. This is utterly platform dependent and my default is an empty ByteArray to signify a default window
defaultWindowType
set myself up for use as a normal window titlebar, close, iconise & size buttons
hasButton:
do I have the button?
hasTitleBar
do I have a title bar set?
initialize
Subclasses should redefine this method to perform initializations on instance creation
isActiveHostWindowProxyClass
windowTitle:
set the window title. If the window is open and doesn't already have a
titlebar, add the title bar, recreate and set the title
AnimatedGIFReadWriter
An AnimatedGIFReadWriter is xxxxxxxxx.
Instance Variables
comments: <Object>
delays: <Object>
forms: <Object>
comments
- xxxxx
delays
- xxxxx
forms
- xxxxx
allImages
comment:
delays
forms
formsFromFileNamed:
formsFromStream:
readBitData
using modified Lempel-Ziv Welch algorithm.
typicalFileExtensions
wantsToHandleGIFs
BDFFontReader
I am a conversion utility for reading X11 Bitmap Distribution Format fonts. My code is derived from the multilingual Squeak changeset written by OHSHIMA Yoshiki (ohshima@is.titech.ac.jp), although all support for fonts with more than 256 glyphs has been ripped out. See http://www.is.titech.ac.jp/~ohshima/squeak/squeak-multilingual-e.html .
My class methods contain tools for fetching BDF source files from a well-known archive site, batch conversion to Squeak's .sf2 format, and installation of these fonts as TextStyles. Also, the legal notices for the standard 75dpi fonts I process this way are included as "x11FontLegalNotices'.
convertFilesNamed:toFamilyNamed:inDirectoryNamed:
convertX11FontsToStrike2
downloadFonts
errorFileFormat
errorUnsupported
getLine
gettingAndInstallingTheFonts
initialize
Subclasses should redefine this method to perform initializations on instance creation
installX11Fonts
new
openFileNamed:
read
readAttributes
I don't handle double-quotes correctly, but it works
readChars
readOneCharacter
x11FontLegalNotices
BMPReadWriter
A BMPReadWriter is xxxxxxxxx.
Instance Variables
bfOffBits: <Object>
bfSize: <Object>
bfType: <Object>
biBitCount: <Object>
biClrImportant: <Object>
biClrUsed: <Object>
biCompression: <Object>
biHeight: <Object>
biPlanes: <Object>
biSize: <Object>
biSizeImage: <Object>
biWidth: <Object>
biXPelsPerMeter: <Object>
biYPelsPerMeter: <Object>
bfOffBits
- xxxxx
bfSize
- xxxxx
bfType
- xxxxx
biBitCount
- xxxxx
biClrImportant
- xxxxx
biClrUsed
- xxxxx
biCompression
- xxxxx
biHeight
- xxxxx
biPlanes
- xxxxx
biSize
- xxxxx
biSizeImage
- xxxxx
biWidth
- xxxxx
biXPelsPerMeter
- xxxxx
biYPelsPerMeter
- xxxxx
displayAllFrom:
nextImage
Dencoding an image on stream and answer the image.
nextPutImage:
Encoding anImage on stream.
read24BmpFile
Read 24-bit pixel data from the given a BMP stream.
read24BmpLine:into:startingAt:width:
readAllFrom:
readColorMap
Read colorCount BMP color map entries from the given binary stream. Answer an array of Colors.
readHeader
readIndexedBmpFile:
Read uncompressed pixel data of depth d from the given BMP stream, where d is 1, 4, 8, or 16
typicalFileExtensions
understandsImageFormat
Test to see if the image stream format is understood by this decoder.
This should be implemented in each subclass of ImageReadWriter so that
a proper decoder can be selected without ImageReadWriter having to know
about all possible image file types.
BitBlt
I represent a block transfer (BLT) of pixels into a rectangle (destX, destY, width, height) of the destinationForm. The source of pixels may be a similar rectangle (at sourceX, sourceY) in the sourceForm, or a constant color, currently called halftoneForm. If both are specified, their pixel values are combined with a logical AND function prior to transfer. In any case, the pixels from the source are combined with those of the destination by as specified by the combinationRule.
The combination rule whose value is 0 through 15 programs the transfer to produce 1 or 0 according to its 4-bit representation as follows:
8: if source is 0 and destination is 0
4: if source is 0 and destination is 1
2: if source is 1 and destination is 0
1: if source is 1 and destination is 1.
At each pixel the corresponding bits of the source and destination pixel values determine one of these conditions; if the combination rule has a 1 in the corresponding bit position, then the new destination value will be 1, otherwise it will be zero. Forms may be of different depths, see the comment in class Form.
In addition to the original 16 combination rules, this BitBlt supports
16 fails (to simulate paint bits)
17 fails (to simulate erase bits)
18 sourceWord + destinationWord
19 sourceWord - destinationWord
20 rgbAdd: sourceWord with: destinationWord. Sum of color components
21 rgbSub: sourceWord with: destinationWord. Difference of color components
22 OLDrgbDiff: sourceWord with: destinationWord. Sum of abs of differences in components
23 OLDtallyIntoMap: destinationWord. Tallies pixValues into a colorMap
these old versions don't do bitwise dest clipping. Use 32 and 33 now.
24 alphaBlend: sourceWord with: destinationWord. 32-bit source and dest only
25 pixPaint: sourceWord with: destinationWord. Wherever the sourceForm is non-zero, it replaces the destination. Can be used with a 1-bit source color mapped to (0, FFFFFFFF), and a fillColor to fill the dest with that color wherever the source is 1.
26 pixMask: sourceWord with: destinationWord. Like pixPaint, but fills with 0.
27 rgbMax: sourceWord with: destinationWord. Max of each color component.
28 rgbMin: sourceWord with: destinationWord. Min of each color component.
29 rgbMin: sourceWord bitInvert32 with: destinationWord. Min with (max-source)
30 alphaBlendConst: sourceWord with: destinationWord. alpha is an arg. works in 16 bits.
31 alphaPaintConst: sourceWord with: destinationWord. alpha is an arg. works in 16 bits.
32 rgbDiff: sourceWord with: destinationWord. Sum of abs of differences in components
33 tallyIntoMap: destinationWord. Tallies pixValues into a colorMap
34 alphaBlendScaled: srcWord with: dstWord. Alpha blend of scaled srcWord and destWord.
The color specified by halftoneForm may be either a Color or a Pattern. A Color is converted to a pixelValue for the depth of the destinationForm. If a Pattern, BitBlt will simply interpret its bitmap as an array of Color pixelValues. BitBlt aligns the first element of this array with the top scanline of the destinationForm, the second with the second, and so on, cycling through the color array as necessary. Within each scan line the 32-bit value is repeated from left to right across the form. If the value repeats on pixels boudaries, the effect will be a constant color; if not, it will produce a halftone that repeats on 32-bit boundaries.
Any transfer specified is further clipped by the specified rectangle (clipX, clipY, clipWidth, clipHeight), and also by the bounds of the source and destination forms.
To make a small Form repeat and fill a big form, use an InfiniteForm as the source.
To write on a form and leave with both transparent and opapue areas, use a MaskedForm as the source.
Pixels from a source to a destination whose pixels have a different depth are converted based on the optional colorMap. If colorMap is nil, then conversion to more bits is done by filling the new high-order bits with zero, and conversion to fewer bits is done by truncating the lost high-order bits.
The colorMap, if specified, must be a either word array (ie Bitmap) with 2^n elements, where n is the pixel depth of the source, or a fully specified ColorMap which may contain a lookup table (ie Bitmap) and/or four separate masks and shifts which are applied to the pixels. For every source pixel, BitBlt will first perform masking and shifting and then index the lookup table, and select the corresponding pixelValue and mask it to the destination pixel size before storing.
When blitting from a 32 or 16 bit deep Form to one 8 bits or less, the default is truncation. This will produce very strange colors, since truncation of the high bits does not produce the nearest encoded color. Supply a 512 long colorMap, and red, green, and blue will be shifted down to 3 bits each, and mapped. The message copybits...stdColors will use the best map to the standard colors for destinations of depths 8, 4, 2 and 1. Two other sized of colorMaps are allowed, 4096 (4 bits per color) and 32786 (five bits per color).
Normal blits between 16 and 32 bit forms truncates or pads the colors automatically to provide the best preservation of colors.
Colors can be remapped at the same depth. Sometimes a Form is in terms of colors that are not the standard colors for this depth, for example in a GIF file. Convert the Form to a MaskedForm and send colorMap: the list of colors that the picture is in terms of. MaskedForm will use the colorMap when copying to the display or another Form. (Note also that a Form can be copied to itself, and transformed in the process, if a non-nil colorMap is supplied.)
alphaBlendDemo
antiAliasDemo
asGrafPort
basicDisplayString:from:to:at:strikeFont:kern:
benchDiffsFrom:to:
benchmark
benchmark2
benchmark3
bitPeekerFromForm:
bitPokerToForm:
cachedFontColormapFrom:to:
Modified from computeColormapFrom:to:.
clipBy:
clipByX1:y1:x2:y2:
clipHeight
clipHeight:
Set the receiver's clipping area height to be the argument, anInteger.
clipRange
clip and adjust source origin and extent appropriately
clipRect
Answer the receiver's clipping area rectangle.
clipRect:
Set the receiver's clipping area rectangle to be the argument, aRectangle.
clipWidth
clipWidth:
Set the receiver's clipping area width to be the argument, anInteger.
clipX
clipX:
Set the receiver's clipping area top left x coordinate to be the argument,
anInteger.
clipY
clipY:
Set the receiver's clipping area top left y coordinate to be the argument,
anInteger.
color
Return the current fill color as a Color.
Gives the wrong answer if the halftoneForm is a complex pattern of more than one word.
colorConvertingMap:from:to:keepSubPixelAA:
colorMap
colorMap:
See last part of BitBlt comment. 6/18/96 tk
combinationRule
Answer the receiver's combinationRule
combinationRule:
Set the receiver's combination rule to be the argument, anInteger, a
number in the range 0-15.
copy:from:in:
copy:from:in:fillColor:rule:
Specify a Color to fill, not a Form. 6/18/96 tk
copy:from:in:halftoneForm:rule:
copyBits
Primitive. Perform the movement of bits from the source form to the
destination form. Fail if any variables are not of the right type (Integer,
Float, or Form) or if the combination rule is not implemented.
In addition to the original 16 combination rules, this BitBlt supports
16 fail (to simulate paint)
17 fail (to simulate mask)
18 sourceWord + destinationWord
19 sourceWord - destinationWord
20 rgbAdd: sourceWord with: destinationWord
21 rgbSub: sourceWord with: destinationWord
22 rgbDiff: sourceWord with: destinationWord
23 tallyIntoMap: destinationWord
24 alphaBlend: sourceWord with: destinationWord
25 pixPaint: sourceWord with: destinationWord
26 pixMask: sourceWord with: destinationWord
27 rgbMax: sourceWord with: destinationWord
28 rgbMin: sourceWord with: destinationWord
29 rgbMin: sourceWord bitInvert32 with: destinationWord
copyBitsAgain
Primitive. See BitBlt|copyBits, also a Primitive. Essential. See Object
documentation whatIsAPrimitive.
copyBitsColor:alpha:gammaTable:ungammaTable:
This entry point to BitBlt supplies an extra argument to specify the fore color
argb value for operation 41. This is split into an alpha value and an rgb value,
so that both can be passed as smallIntegers to the primitive.
rgbColorInteger must be a smallInteger between 0 and 16rFFFFFF.
alpha must be a smallInteger between 0 and 16rFF.
copyBitsFrom:to:at:
copyBitsTranslucent:
This entry point to BitBlt supplies an extra argument to specify translucency
for operations 30 and 31. The argument must be an integer between 0 and 255.
copyForm:to:rule:
copyForm:to:rule:color:
copyForm:to:rule:colorMap:
copyForm:to:rule:fillColor:
copyFrom:in:to:
current
destForm
destForm:sourceForm:fillColor:combinationRule:destOrigin:sourceOrigin:extent:clipRect:
destForm:sourceForm:halftoneForm:combinationRule:destOrigin:sourceOrigin:extent:clipRect:
destOrigin:
Set the receiver's destination top left coordinates to be those of the
argument, aPoint.
destRect
The rectangle we are about to blit to or just blitted to.
destRect:
Set the receiver's destination form top left coordinates to be the origin of
the argument, aRectangle, and set the width and height of the receiver's
destination form to be the width and height of aRectangle.
destX:
Set the top left x coordinate of the receiver's destination form to be the
argument, anInteger.
destX:destY:width:height:
Combined init message saves 3 sends from DisplayScanner
destY:
Set the top left y coordinate of the receiver's destination form to be the
argument, anInteger.
displayGlyph:at:left:right:font:
Display a glyph in a multi-lingual font. Do 2 pass rendering if necessary.
This happens when #installStrikeFont:foregroundColor:backgroundColor: sets rule 37 (rgbMul).
the desired effect is to do two bitblt calls. The first one is with rule 37 and special colormap.
The second one is rule 34, with a colormap for applying the requested foreground color.
This two together do component alpha blending, i.e. alpha blend red, green and blue separatedly.
This is needed for arbitrary color over abitrary background text with subpixel AA.
displayString:from:to:at:kern:baselineY:font:
Double dispatch into the font. This method is present so that other-than-bitblt entities can be used by CharacterScanner and friends to display text.
displayString:from:to:at:kern:font:
Double dispatch into the font. This method is present so that other-than-bitblt entities can be used by CharacterScanner and friends to display text.
displayString:from:to:at:strikeFont:kern:
If required, do a second pass with new rule and colorMap.
This happens when #installStrikeFont:foregroundColor:backgroundColor: sets rule 37 (rgbMul).
the desired effect is to do two bitblt calls. The first one is with rule 37 and special colormap.
The second one is rule 34, with a colormap for applying the requested foreground color.
This two together do component alpha blending, i.e. alpha blend red, green and blue separatedly.
This is needed for arbitrary color over abitrary background text with subpixel AA.
drawFrom:to:
drawFrom:to:withFirstPoint:
Draw a line whose end points are startPoint and stopPoint.
The line is formed by repeatedly calling copyBits at every
point along the line. If drawFirstPoint is false, then omit
the first point so as not to overstrike at line junctions.
drawLoopX:Y:
Primitive. Implements the Bresenham plotting algorithm (IBM Systems
Journal, Vol. 4 No. 1, 1965). It chooses a principal direction, and
maintains a potential, P. When P's sign changes, it is time to move in
the minor direction as well. This particular version does not write the
first and last points, so that these can be called for as needed in client code.
Optional. See Object documentation whatIsAPrimitive.
eraseBits
Perform the erase operation, which puts 0's in the destination
wherever the source (which is assumed to be just 1 bit deep)
has a 1. This requires the colorMap to be set in order to AND
all 1's into the destFrom pixels regardless of their size.
exampleAt:rule:fillColor:
exampleColorMap
exampleOne
exampleTwo
fill:fillColor:rule:
Fill with a Color, not a Form. 6/18/96 tk
fillColor
fillColor:
The destForm will be filled with this color or pattern of colors. May be an old Color, a new type Color, a Bitmap (see BitBlt comment), a Pattern, or a Form. 6/18/96 tk
getPluginName
Private. Return the name of the plugin representing BitBlt.
Used for dynamically switching between different BB representations only.
halftoneForm
Returns the receivers half tone form. See class commment.
halftoneForm:
Sets the receivers half tone form. See class commment.
height:
Set the receiver's destination form height to be the argument, anInteger.
initialize
Subclasses should redefine this method to perform initializations on instance creation
installFont:foregroundColor:backgroundColor:
Double dispatch into the font. This method is present so that other-than-bitblt entities can be used by CharacterScanner and friends to display text.
installFreeTypeFont:foregroundColor:backgroundColor:
Set up the parameters. Since the glyphs in a TTCFont is 32bit depth form, it tries to use rule=34 to get better AA result if possible.
installStrikeFont:foregroundColor:backgroundColor:
installTTCFont:foregroundColor:backgroundColor:
Set up the parameters. Since the glyphs in a TTCFont is 32bit depth form, it tries to use rule=34 to get better AA result if possible.
paintBits
Perform the paint operation, which requires two calls to BitBlt.
pixelAt:
Assumes this BitBlt has been set up specially (see the init message,
BitBlt bitPeekerFromForm:. Returns the pixel at aPoint.
pixelAt:put:
Assumes this BitBlt has been set up specially (see the init message,
BitBlt bitPokerToForm:. Overwrites the pixel at aPoint.
primDisplayString:from:to:map:xTable:kern:
recreateColorMaps
roundVariables
setDestForm:
setDestForm:sourceForm:fillColor:combinationRule:destOrigin:sourceOrigin:extent:clipRect:
sourceForm
sourceForm:
Set the receiver's source form to be the argument, aForm.
sourceOrigin:
Set the receiver's source form coordinates to be those of the argument,
aPoint.
sourceRect:
Set the receiver's source form top left x and y, width and height to be
the top left coordinate and extent of the argument, aRectangle.
sourceX:
Set the receiver's source form top left x to be the argument, anInteger.
sourceY:
Set the receiver's source form top left y to be the argument, anInteger.
tallyMap
Return the map used for tallying pixels
tallyMap:
Install the map used for tallying pixels
toForm:
width:
Set the receiver's destination form width to be the argument, anInteger.
Bitmap
My instances provide contiguous storage of bits, primarily to hold the graphical data of Forms. Forms and their subclasses provide the additional structural information as to how the bits should be interpreted in two dimensions.
asByteArray
Faster way to make a byte array from me.
copyFromByteArray: makes equal Bitmap.
atAllPut:
Fill the receiver, an indexable bytes or words object, with the given positive integer. The range of possible fill values is [0..255] for byte arrays and [0..(2^32 - 1)] for word arrays.
bitPatternForDepth:
The raw call on BitBlt needs a Bitmap to represent this color. I already am Bitmap like. I am already adjusted for a specific depth. Interpret me as an array of (32/depth) Color pixelValues. BitBlt aligns the first element of this array with the top scanline of the destinationForm, the second with the second, and so on, cycling through the color array as necessary. 6/18/96 tk
byteAt:
Extract a byte from a Bitmap. Note that this is a byte address and it is one-order. For repeated use, create an instance of BitBlt and use pixelAt:. See Form pixelAt: 7/1/96 tk
byteAt:put:
Insert a byte into a Bitmap. Note that this is a byte address and it is one-order. For repeated use, create an instance of BitBlt and use pixelAt:put:. See Form pixelAt:put: 7/1/96 tk
byteSize
compress:toByteArray:
Store a run-coded compression of the receiver into the byteArray ba,
and return the last index stored into. ba is assumed to be large enough.
The encoding is as follows...
S {N D}*.
S is the size of the original bitmap, followed by run-coded pairs.
N is a run-length * 4 + data code.
D, the data, depends on the data code...
0 skip N words, D is absent
1 N words with all 4 bytes = D (1 byte)
2 N words all = D (4 bytes)
3 N words follow in D (4N bytes)
S and N are encoded as follows...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes
compressGZip
just hacking around to see if further compression would help Nebraska
compressToByteArray
Return a run-coded compression of this bitmap into a byteArray
copy
Answer another instance just like the receiver. Subclasses typically override postCopy; they typically do not override shallowCopy.
copyFromByteArray:
This method should work with either byte orderings
decodeIntFrom:
decompress:fromByteArray:at:
Decompress the body of a byteArray encoded by compressToByteArray (qv)...
The format is simply a sequence of run-coded pairs, {N D}*.
N is a run-length * 4 + data code.
D, the data, depends on the data code...
0 skip N words, D is absent
(could be used to skip from one raster line to the next)
1 N words with all 4 bytes = D (1 byte)
2 N words all = D (4 bytes)
3 N words follow in D (4N bytes)
S and N are encoded as follows (see decodeIntFrom:)...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes
decompressFromByteArray:
defaultElement
Return the default element of the receiver
encodeBytesOf:in:at:
Copy the integer anInt into byteArray ba at index i, and return the next index
encodeInt:
Encode the integer int as per encodeInt:in:at:, and return it as a ByteArray
encodeInt:in:at:
Encode the integer anInt in byteArray ba at index i, and return the next index.
The encoding is as follows...
0-223 0-223
224-254 (0-30)*256 + next byte (0-7935)
255 next 4 bytes
fromByteStream:
Initialize the array of bits by reading integers from the argument,
aStream.
integerAt:
Return the integer at the given index
integerAt:put:
Store the integer at the given index
isColormap
Bitmaps were used as color maps for BitBlt.
This method allows to recognize real color maps.
newFromStream:
pixelValueForDepth:
Self is being used to represent a single color. Answer bits that appear in ONE pixel of this color in a Bitmap of the given depth. The depth must be one of 1, 2, 4, 8, 16, or 32. Returns an integer. First pixel only.
primFill:
Fill the receiver, an indexable bytes or words object, with the given positive integer. The range of possible fill values is [0..255] for byte arrays and [0..(2^32 - 1)] for word arrays.
printOn:
Append a sequence of characters that identify the receiver to aStream.
printOnStream:
readCompressedFrom:
Decompress an old-style run-coded stream into this bitmap:
[0 means end of runs]
[n = 1..127] [(n+3) copies of next byte]
[n = 128..191] [(n-127) next bytes as is]
[n = 192..255] [(n-190) copies of next 4 bytes]
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
restoreEndianness
This word object was just read in from a stream. Bitmaps are always compressed and serialized in a machine-independent way. Do not correct the Endianness.
storeBits:to:on:
Store my bits as a hex string, breaking the lines every 100 bytes or
so to comply with the maximum line length limits of Postscript (255
bytes).
swapBytesIn:from:to:
writeOn:
Store the array of bits onto the argument, aStream. A leading byte of 16r80 identifies this as compressed by compressToByteArray (qv).
writeUncompressedOn:
Store the array of bits onto the argument, aStream.
(leading byte ~= 16r80) identifies this as raw bits (uncompressed).
CharacterBlock
My instances contain information about displayed characters. They are used to return the results of methods:
Paragraph characterBlockAtPoint: aPoint and
Paragraph characterBlockForIndex: stringIndex.
Any recomposition or movement of a Paragraph can make the instance obsolete.
<
Answer whether the string index of the receiver precedes that of
aCharacterBlock.
<=
Answer whether the string index of the receiver does not come after that
of aCharacterBlock.
=
Answer true if the receiver's species, origin and corner match aRectangle's.
>
Answer whether the string index of the receiver comes after that of
aCharacterBlock.
>=
Answer whether the string index of the receiver does not precede that of
aCharacterBlock.
copy
Overridden because Rectangle does a deepCopy, which goes nuts with the text
max:
min:
moveBy:
Change the corner positions of the receiver so that its area translates by
the amount defined by the argument, aPoint.
printOn:
Refer to the comment in Object|printOn:.
stringIndex
Answer the position of the receiver in the string it indexes.
stringIndex:text:topLeft:extent:
textLine
textLine:
CharacterBlockScanner
My instances are used to scan text to compute the CharacterBlock for a character specified by its index in the text or its proximity to the cursor location.
buildCharacterBlockIn:
handle nullText
characterBlockAtPoint:in:
Answer a CharacterBlock for character in aParagraph at point aPoint. It
is assumed that aPoint has been transformed into coordinates appropriate
to the text's destination form rectangle and the composition rectangle.
characterBlockAtPoint:index:in:
This method is the Morphic characterBlock finder. It combines
MVC's characterBlockAtPoint:, -ForIndex:, and buildCharcterBlock:in:
characterBlockForIndex:in:
Answer a CharacterBlock for character in aParagraph at targetIndex. The
coordinates in the CharacterBlock will be appropriate to the intersection
of the destination form rectangle and the composition rectangle.
characterPointSetX:
cr
Answer a CharacterBlock that specifies the current location of the mouse
relative to a carriage return stop condition that has just been
encountered. The ParagraphEditor convention is to denote selections by
CharacterBlocks, sometimes including the carriage return (cursor is at
the end) and sometimes not (cursor is in the middle of the text).
crossedX
Text display has wrapping. The scanner just found a character past the x
location of the cursor. We know that the cursor is pointing at a character
or before one.
endOfRun
Before arriving at the cursor location, the selection has encountered an
end of run. Answer false if the selection continues, true otherwise. Set
up indexes for building the appropriate CharacterBlock.
indentationLevel:
set the number of tabs to put at the beginning of each line
lastCharacterExtentSetX:
lastSpaceOrTabExtentSetX:
paddedSpace
When the line is justified, the spaces will not be the same as the font's
space character. A padding of extra space must be considered in trying
to find which character the cursor is pointing at. Answer whether the
scanning has crossed the cursor.
placeEmbeddedObject:
Workaround: The following should really use #textAnchorType
setFont
Set the font and other emphasis.
setStopConditions
Set the font and the stop conditions for the current run.
tab
CharacterScanner
My instances hold the state associated with scanning text. My subclasses scan characters for specified purposes, such as computing a CharacterBlock or placing characters into Forms.
addEmphasis:
Set the bold-ital-under-strike emphasis.
addKern:
Set the current kern amount.
basicScanCharactersFrom:to:in:rightX:stopConditions:kern:
Primitive. This is the inner loop of text display--but see
scanCharactersFrom: to:rightX: which would get the string,
stopConditions and displaying from the instance. March through source
String from startIndex to stopIndex. If any character is flagged with a
non-nil entry in stops, then return the corresponding value. Determine
width of each character from xTable, indexed by map.
If dextX would exceed rightX, then return stops at: 258.
Advance destX by the width of the character. If stopIndex has been
reached, then return stops at: 257. Optional.
See Object documentation whatIsAPrimitive.
columnBreak
embeddedObject
handleIndentation
indentationLevel
return the number of tabs that are currently being placed at the beginning of each line
indentationLevel:
set the number of tabs to put at the beginning of each line
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeFromParagraph:clippedBy:
initializeStringMeasurer
isBreakableAtIndex:
leadingTab
return true if only tabs lie to the left
measureString:inFont:from:to:
WARNING: In order to use this method the receiver has to be set up using #initializeStringMeasurer
placeEmbeddedObject:
Place the anchoredMorph or return false if it cannot be placed.
In any event, advance destX by its width.
plainTab
This is the basic method of adjusting destX for a tab.
scanCharactersFrom:to:in:rightX:stopConditions:kern:
scanJapaneseCharactersFrom:to:in:rightX:stopConditions:kern:
scanMultiCharactersFrom:to:in:rightX:stopConditions:kern:
setActualFont:
Set the basal font to an isolated font reference.
setAlignment:
setConditionArray:
setFont
Set the font and other emphasis.
setFont:
Set the font by number from the textStyle.
text:textStyle:
textColor:
Overridden in DisplayScanner
wantsColumnBreaks:
Color
This class represents abstract color, regardless of the depth of bitmap it will be shown in. At the very last moment a Color is converted to a pixelValue that depends on the depth of the actual Bitmap inside the Form it will be used with. The supported depths (in bits) are 1, 2, 4, 8, 16, and 32. The number of actual colors at these depths are: 2, 4, 16, 256, 32768, and 16 million. (See comment in BitBlt.) To change the depth of the Display and set how many colors you can see, execute: (Display newDepth: 8). (See comment in DisplayMedium)
Color is represented as the amount of light in red, green, and blue. White is (1.0, 1.0, 1.0) and black is (0, 0, 0). Pure red is (1.0, 0, 0). These colors are "additive". Think of Color's instance variables as:
r amount of red, a Float between 0.0 and 1.0.
g amount of green, a Float between 0.0 and 1.0.
b amount of blue, a Float between 0.0 and 1.0.
(But, in fact, the three are encoded as values from 0 to 1023 and combined in a single integer, rgb. The user does not need to know this.)
Many colors are named. You find a color by name by sending a message to class Color, for example (Color lightBlue). Also, (Color red: 0.2 green: 0.6 blue: 1.0) or (Color r: 0.2 g: 0.6 b: 1.0) creates a color. (see below)
A color is essentially immutable. Once you set red, green, and blue, you cannot change them. Instead, create a new Color and use it.
Applications such as contour maps and bar graphs will want to display one of a set of shades based on a number. Convert the range of this number to an integer from 1 to N. Then call (Color green lightShades: N) to get an Array of colors from white to green. Use the Array messages at:, atPin:, or atWrap: to pull out the correct color from the array. atPin: gives the first (or last) color if the index is out of range. atWrap: wraps around to the other end if the index is out of range.
Here are some fun things to run in when your screen has color:
Pen new mandala: 30 diameter: Display height-100.
Pen new web "Draw with the mouse, opt-click to end"
Display fillWhite. Pen new hilberts: 5.
Form toothpaste: 30 "Draw with mouse, opt-click to end"
You might also want to try the comment in
Form>class>examples>tinyText...
Messages:
mixed: proportion with: aColor Answer this color mixed with the given color additively. The proportion, a number between 0.0 and 1.0, determines what what fraction of the receiver to use in the mix.
+ add two colors
- subtract two colors
* multiply the values of r, g, b by a number or an Array of factors. ((Color named: #white) * 0.3) gives a darkish gray. (aColor * #(0 0 0.9)) gives a color with slightly less blue.
/ divide a color by a factor or an array of three factors.
errorForDepth: d How close the nearest color at this depth is to this abstract color. Sum of the squares of the RGB differences, square rooted and normalized to 1.0. Multiply by 100 to get percent.
hue Returns the hue of the color. On a wheel from 0 to 360 with pure red at 0 and again at 360.
saturation Returns the saturation of the color. 0.0 to 1.0
brightness Returns the brightness of the color. 0.0 to 1.0
name Look to see if this Color has a name.
display Show a swatch of this color tracking the cursor.
lightShades: thisMany An array of thisMany colors from white to the receiver.
darkShades: thisMany An array of thisMany colors from black to the receiver. Array is of length num.
mix: color2 shades: thisMany An array of thisMany colors from the receiver to color2.
wheel: thisMany An array of thisMany colors around the color wheel starting and ending at the receiver.
pixelValueForDepth: d Returns the bits that appear be in a Bitmap of this depth for this color. Represents the nearest available color at this depth. Normal users do not need to know which pixelValue is used for which color.
Messages to Class Color.
red: r green: g blue: b Return a color with the given r, g, and b components.
r: g: b: Same as above, for fast typing.
hue: h saturation: s brightness: b Create a color with the given hue, saturation, and brightness.
pink
blue
red ... Many colors have messages that return an instance of Color.
canUnderstand: #brown Returns true if #brown is a defined color.
names An OrderedCollection of the names of the colors.
named: #notAllThatGray put: aColor Add a new color to the list and create an access message and a class variable for it.
fromUser Shows the palette of colors available at this display depth. Click anywhere to return the color you clicked on.
hotColdShades: thisMany An array of thisMany colors showing temperature from blue to red to white hot.
stdColorsForDepth: d An Array of colors available at this depth. For 16 bit and 32 bits, returns a ColorGenerator. It responds to at: with a Color for that index, simulating a very big Array.
colorFromPixelValue: value depth: d Returns a Color whose bit pattern (inside a Bitmap) at this depth is the number specified. Normal users do not need to use this.
(See also comments in these classes: Form, Bitmap, BitBlt, Pattern, MaskedForm.)
*
Answer this color with its RGB multiplied by the given number, or
multiply this color's RGB values by the corresponding entries in the
given array.
+
Answer this color mixed with the given color in an additive color space.
-
Answer aColor is subtracted from the given color in an additive color space.
/
Answer this color with its RGB divided by the given number.
=
Return true if the receiver equals the given color. This method handles TranslucentColors, too.
addFillStyleMenuItems:hand:from:
Add the items for changing the current fill style of the receiver
adjustBrightness:
Adjust the relative brightness of this color. (lowest value is 0.005 so that hue information is not lost)
adjustSaturation:brightness:
Adjust the relative saturation and brightness of this color. (lowest value is 0.005 so that hue information is not lost)
alpha
Return the opacity ('alpha') value of opaque so that normal colors can be compared to TransparentColors.
alpha:
Answer a new Color with the given amount of opacity ('alpha').
alphaMixed:with:
Answer this color mixed with the given color. The proportion, a number
between 0.0 and 1.0, determines what what fraction of the receiver to
use in the mix. For example, 0.9 would yield a color close to the
receiver. This method uses RGB interpolation; HSV interpolation can lead
to surprises. Mixes the alphas (for transparency) also.
asColor
Convert the receiver into a color
asColorref
Convert the receiver into a colorref
asHTMLColor
asNINode
asNontranslucentColor
atLeastAsLuminentAs:
atMostAsLuminentAs:
attemptToMutateError
A color is immutable. Once a color's red, green, and blue have been initialized, you cannot change them. Instead, create a new Color and use it.
balancedPatternForDepth:
A generalization of bitPatternForDepth: as it exists. Generates a 2x2 stipple of color.
The topLeft and bottomRight pixel are closest approx to this color
basicType
Answer a symbol representing the inherent type of the receiver
bitPatternForDepth:
Return a Bitmap, possibly containing a stipple pattern, that best represents this color at the given depth. BitBlt calls this method to convert colors into Bitmaps. The resulting Bitmap may be multiple words to represent a stipple pattern of several lines.
black
blacker
blue
Return the blue component of this color, a float in the range [0.0..1.0].
brightness
Return the brightness of this color, a float in the range [0.0..1.0].
brown
byteEncode:
cachedColormapFrom:to:
changeColorIn:event:
Note: This is just a workaround to make sure we don't use the old color inst var
closestPixelValue1
Return the nearest approximation to this color for a monochrome Form.
closestPixelValue2
Return the nearest approximation to this color for a 2-bit deep Form.
closestPixelValue4
Return the nearest approximation to this color for a 4-bit deep Form.
closestPixelValue8
Return the nearest approximation to this color for an 8-bit deep Form.
colorForInsets
colorFrom:
colorFromPixelValue:depth:
colorMapIfNeededFrom:to:
colorNames
colorRampForDepth:extent:
colorTest:extent:colorMapper:
computeColorConvertingMap:from:to:keepSubPixelAA:
computeColormapFrom:to:
computeIndexedColorConvertingMap:from:to:
computeRGBColorConvertingMap:to:keepSubPixelAA:
computeRGBColormapFor:bitsPerColor:
contrastingColor
Answer black or white depending on the luminance.
cyan
dansDarker
Return a darker shade of the same color.
An attempt to do better than the current darker method.
(now obsolete, since darker has been changed to do this. -dew)
darkGray
darkShades:
An array of thisMany colors from black to the receiver. Array is of length num. Very useful for displaying color based on a variable in your program.
darker
Answer a darker shade of this color.
diff:
Returns a number between 0.0 and 1.0
display
Show a swatch of this color tracking the cursor until the next mouseClick.
dominantColor
duller
fillRectangle:on:
Fill the given rectangle on the given canvas with the receiver.
flushCache
Flush my cached bit pattern.
fromArray:
fromRgbTriplet:
fromString:
fromUser
gray
gray:
green
Return the green component of this color, a float in the range [0.0..1.0].
h:s:v:
h:s:v:alpha:
halfTonePattern1
Return a halftone-pattern to approximate luminance levels on 1-bit deep Forms.
halfTonePattern2
Return a halftone-pattern to approximate luminance levels on 2-bit deep Forms.
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
hex
hex:
hotColdShades:
hue
Return the hue of this color, an angle in the range [0.0..360.0].
iconOrThumbnailOfSize:
Answer an appropiate form to represent the receiver
indexInMap:
Return the index corresponding to this color in the given color map. RGB colors are truncated to 3-, 4-, or 5-bits per color component when indexing into such a colorMap.
indexedColors
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeGrayToIndexMap
initializeHighLights
initializeIndexedColors
initializeNames
initializeTranslucentPatterns
isBitmapFill
isBlack
Return true if the receiver represents black
isColor
Answer true if receiver is a Color. False by default.
isGradientFill
isGray
Return true if the receiver represents a shade of gray
isOpaque
isOrientedFill
Return true if the receiver keeps an orientation (e.g., origin, direction, and normal)
isSelfEvaluating
isSolidFill
isTranslucent
isTranslucentColor
This means: self isTranslucent, but isTransparent not
isTransparent
javascriptOn:
lightBlue
lightBrown
lightCyan
lightGray
lightGreen
lightMagenta
lightOrange
lightRed
lightShades:
An array of thisMany colors from white to self. Very useful for displaying color based on a variable in your program.
lightYellow
lighter
Answer a lighter shade of this color.
luminance
Return the luminance of this color, a brightness value weighted by the human eye's color sensitivity.
magenta
makeForegroundColor
Make a foreground color contrasting with me
maskingMap:
mix:shades:
Return an array of thisMany colors from self to color2. Very useful for displaying color based on a variable in your program.
mixed:with:
Mix with another color and do not preserve transpareny. Only use this for extracting the RGB value and mixing it. All other callers should use instead:
aColor alphaMixed: proportion with: anotherColor
muchDarker
muchLighter
name
Return this color's name, or nil if it has no name. Only returns a name if it exactly matches the named color.
named:put:
negated
Return an RGB inverted color
new
oldColorPaletteForDepth:extent:
orColorUnlike:
If this color is a lot like theOther, then return its complement, otherwide, return self
orange
paleBlue
paleBuff
paleGreen
paleMagenta
paleOrange
palePeach
paleRed
paleTan
paleYellow
paler
Answer a paler shade of this color.
pixelScreenForDepth:
pixelValue32
Note: pixelWord not pixelValue so we include translucency
pixelValueForDepth:
Returns an integer representing the bits that appear in a single pixel of this color in a Form of the given depth. The depth must be one of 1, 2, 4, 8, 16, or 32. Contrast with pixelWordForDepth: and bitPatternForDepth:, which return either a 32-bit word packed with the given pixel value or a multiple-word Bitmap containing a pattern. The inverse is the class message colorFromPixelValue:depth:
pixelWord32
Returns an integer representing the bits that appear in a single pixel of this color in a Form of depth 32.
Transparency: The pixel value zero is reserved for transparent. For depths greater than 8, black maps to the darkest possible blue.
Just a little quicker if we are dealing with RGBA colors at 32 bit depth.
pixelWordFor:filledWith:
Return to a 32-bit word that concatenates enough copies of the given pixel value to fill the word (i.e., 32/depth copies). Depth should be one of 1, 2, 4, 8, 16, or 32. The pixel value should be an integer in 0..2^depth-1.
pixelWordForDepth:
Return to a 32-bit word that concatenates enough copies of the receiver's pixel value to fill the word (i.e., 32/depth copies). Depth should be one of 1, 2, 4, 8, 16, or 32. The pixel value should be an integer in 0..2^depth-1.
printHtmlString
answer a string whose characters are the html representation
of the receiver
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
privateAlpha
Private! Return the raw alpha value for opaque. Used only for equality testing.
privateBlue
Private! Return the internal representation of my blue component.
privateGreen
Private! Return the internal representation of my green component.
Replaced >> by bitShift: 0 -. SqR! 2/25/1999 23:08
privateRGB
Private! Return the internal representation of my RGB components.
privateRed
Private! Return the internal representation of my red component.
quickHighLight:
r:g:b:
r:g:b:alpha:
r:g:b:range:
raisedColor
random
red
Return the red component of this color, a float in the range [0.0..1.0].
rgbTriplet
Color fromUser rgbTriplet
saturation
Return the saturation of this color, a value between 0.0 and 1.0.
scaledPixelValue32
Return the alpha scaled pixel value for depth 32
setHue:saturation:brightness:
Initialize this color to the given hue, saturation, and brightness. See the comment in the instance creation method for details.
setPrivateRed:green:blue:
Initialize this color's r, g, and b components to the given values in the range [0..ComponentMax]. Encoded in a single variable as 3 integers in [0..1023].
setRGB:
setRed:green:blue:
Initialize this color's r, g, and b components to the given values in the range [0.0..1.0]. Encoded in a single variable as 3 integers in [0..1023].
setRed:green:blue:range:
Initialize this color's r, g, and b components to the given values in the range [0..r].
shortPrintString
Return a short (but less precise) print string for use where space is tight.
showColorCube
showColors:
showHSVPalettes
showHuesInteractively
shutDown
slightlyDarker
slightlyLighter
slightlyWhiter
storeArrayOn:
storeArrayValuesOn:
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
tan
translucentMaskFor:depth:
transparent
twiceDarker
Answer a significantly darker shade of this color.
twiceLighter
Answer a significantly lighter shade of this color.
veryDarkGray
veryDeepCopyWith:
Return self. I am immutable in the Morphic world. Do not record me.
veryLightGray
veryMuchLighter
veryPaleRed
veryVeryDarkGray
veryVeryLightGray
wheel:
An array of thisMany colors around the color wheel starting at self and ending all the way around the hue space just before self. Array is of length thisMany. Very useful for displaying color based on a variable in your program.
wheel:saturation:brightness:
white
whiter
yellow
ColorForm
ColorForm is a normal Form plus a color map of up to 2^depth Colors. Typically, one reserves one entry in the color map for transparent. This allows 1, 3, 15, or 255 non-transparent colors in ColorForms of depths 1, 2, 4, and 8 bits per pixel. ColorForms don't support depths greater than 8 bits because that would require excessively large color maps with little real benefit, since 16-bit and 32-bit depths already support thousands and millions of colors.
ColorForms have several uses:
1) Precise colors. You can have up to 256 true colors, instead being limited to the 8-bit color palette.
2) Easy transparency. Just store (Color transparent) at the desired position in the color map.
3) Cheap color remapping by changing the color map.
A color map is an Array of up to 2^depth Color objects. A Bitmap colorMap is automatically computed and cached for rapid display. Note that if you change the color map, you must resubmit it via the colors: method to flush this cache.
ColorForms can be a bit tricky. Note that:
a) When you BitBlt from one ColorForm to another, you must remember to copy the color map of the source ColorForm to the destination ColorForm.
b) A ColorForm's color map is an array of depth-independent Color objects. BitBlt requires a BitMap of actual pixel values, adjusted to the destination depth. These are different things! ColorForms automatically maintain a cache of the BitBlt-style color map corresponding to the colors array for the last depth on which the ColorForm was displayed, so there should be little need for clients to work with BitBlt-style color maps.
c) The default map for 8 bit depth has black in the first entry, not transparent. Say (cform colors at: 1 put: Color transparent).
asCursorForm
asFormWithSingleTransparentColors
asGrayScale
Return a grayscale ColorForm computed by mapping each color into its grayscale equivalent
blankCopyOf:scaledBy:
clearColormapCache
colorAt:
Return the color of the pixel at aPoint.
colorAt:put:
Store the given color into the pixel at aPoint. The given color must match one of the colors in the receiver's colormap.
colormapIfNeededFor:
Return a ColorMap mapping from the receiver to destForm.
colormapIfNeededForDepth:
Return a colormap for displaying the receiver at the given depth, or nil if no colormap is needed.
colors
Return my color palette.
colors:
Set my color palette to the given collection.
colorsFromArray:
colorsUsed
Return a list of the colors actually used by this ColorForm.
copy:
Return a new ColorForm containing the portion of the receiver delineated by aRect.
decodeArray
deepCopy
Answer a copy of the receiver with its own copy of each instance
variable.
depth:
displayOnPort:at:
ensureColorArrayExists
Return my color palette.
ensureTransparentColor
Ensure that the receiver (a) includes Color transparent in its color map and (b) that the entry for Color transparent is the first entry in its color map.
extent:depth:
flipBy:centerAt:
Return a copy of the receiver flipped either #vertical or #horizontal.
getTransparencyUnificationLUT
hibernate
Make myself take up less space. See comment in Form>hibernate.
indexOfColor:
Return the index of aColor in my color array
isColorForm
isTranslucent
Answer whether this form may be translucent
isTransparentAt:
Return true if the receiver is transparent at the given point.
mapColor:to:
Replace all occurances of the given color with the given new color in my color map.
mapTransparencies:
mappingWhiteToTransparentFrom:
maskingMap
Return a color map that maps all colors except transparent to words of all ones. Used to create a mask for a Form whose transparent pixel value is zero.
pixelValueAt:
Return the raw pixel value at the given point. Typical clients use colorAt: to get a Color.
readAttributesFrom:
replaceColor:with:
Replace all occurances of the given color with the given new color in my color map.
replaceColorAt:with:
Replace a color map entry with newColor. The entry replaced is the one used by aPoint. If there are are two entries in the colorMap for the oldColor, just replace ONE!! There are often two whites or two blacks, and this is what you want, when replacing one.
replaceColorAtIndex:with:
Replace a color map entry with newColor.
scaledToSize:
super method did not seem to work so well on ColorForms
setColors:cachedColormap:depth:
Semi-private. Set the color array, cached colormap, and cached colormap depth to avoid having to recompute the colormap when switching color palettes in animations.
setColorspaceOn:
setExtent:depth:
Create a virtual bit map with the given extent and bitsPerPixel.
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
transparentAllPixelsLike:
Make all occurances of the given pixel value transparent. Very useful when two entries in the colorMap have the same value. This only changes ONE.
transparentColor:
Make all occurances of the given color transparent. Note: for colors like black and white, which have two entries in the colorMap, this changes BOTH of them. Not always what you want.
transparentColorIndexes
twoToneFromDisplay:backgroundColor:
Copy one-bit deep ColorForm from the Display using a color map that maps all colors except the background color to black. Used for caching the contents of inactive MVC windows.
twoToneFromDisplay:using:backgroundColor:
unhibernate
If my bitmap has been compressed into a ByteArray,
then expand it now, and return true.
unusedColormapEntry
Return the index of an unused color map entry, or zero if there isn't one.
writeAttributesOn:
ColorMap
A ColorMap is xxxxxxxxx.
Instance Variables
colors: <Object>
masks: <Object>
shifts: <Object>
colors
- xxxxx
masks
- xxxxx
shifts
- xxxxx
=
Return true if the receiver is equal to aColorMap
alphaMask
alphaMask:
alphaShift
alphaShift:
at:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive.
at:put:
Primitive. Assumes receiver is indexable. Store the argument value in
the indexable element of the receiver indicated by index. Fail if the
index is not an Integer or is out of bounds. Or fail if the value is not of
the right type for this kind of collection. Answer the value that was
stored. Essential. See Object documentation whatIsAPrimitive.
blueMask
blueMask:
blueShift
blueShift:
colors
colors:
greenMask
greenMask:
greenShift
greenShift:
hash
Hash is re-implemented because #= is re-implemented
inverseMap
Return the inverse map of the receiver
isColormap
isFixed
Return true if the receiver does not use a lookup mechanism for pixel mapping
isIndexed
Return true if the receiver uses a lookup mechanism for pixel mapping
mapBitsFrom:to:
mapPixel:
Perform a forward pixel mapping operation
mappingFrom:to:
mappingFromARGB:
mappingTo:
Compute a new color map through the receiver and aColorMap.
Both maps are assumed to be mappings into canonical ARGB space
mappingToARGB:
masks
masks:shifts:
pixelMap:
Perform a reverse pixel mapping operation
redMask
redMask:
redShift
redShift:
rgbaBitMasks
Return the rgba bit masks for the receiver
setShifts:masks:colors:
shifts
shifts:masks:
shifts:masks:colors:
CompositeTransform
A composite transform provides the effect of several levels of coordinate transformations.
angle
asCompositeTransform
Represent the receiver as a composite transformation
asMatrixTransform2x3
Represent the receiver as a 2x3 matrix transformation
asMorphicTransform
Squash a composite transform down to a simple one
composedWith:
Return a new transform that has the effect of transforming points first by the receiver and then by the argument.
globalPointToLocal:
Transform aPoint from global coordinates into local coordinates
globalTransform:localTransform:
inverseTransformation
Return the inverse transformation of the receiver
invert:
isCompositeTransform
Return true if the receiver is a composite transformation.
Composite transformations may have impact on the accuracy.
isIdentity
Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.
isPureTranslation
Return true if the receiver specifies no rotation or scaling.
localPointToGlobal:
Transform aPoint from global coordinates into local coordinates
offset
scale
transform:
CompositionScanner
CompositionScanners are used to measure text and determine where line breaks and space padding should occur.
columnBreak
Answer true. Set up values for the text line interval currently being
composed.
composeFrom:inRectangle:firstLine:leftSide:rightSide:
Answer an instance of TextLineInterval that represents the next line in the paragraph.
composeLine:fromCharacterIndex:inParagraph:
Answer an instance of TextLineInterval that represents the next line in the paragraph.
cr
Answer true. Set up values for the text line interval currently being
composed.
crossedX
There is a word that has fallen across the right edge of the composition
rectangle. This signals the need for wrapping which is done to the last
space that was encountered, as recorded by the space stop condition.
endOfRun
Answer true if scanning has reached the end of the paragraph.
Otherwise step conditions (mostly install potential new font) and answer
false.
forParagraph:
Initialize the receiver for scanning the given paragraph.
placeEmbeddedObject:
Workaround: The following should really use #textAnchorType
rightX
Meaningful only when a line has just been composed -- refers to the
line most recently composed. This is a subtrefuge to allow for easy
resizing of a composition rectangle to the width of the maximum line.
Useful only when there is only one line in the form or when each line
is terminated by a carriage return. Handy for sizing menus and lists.
setActualFont:
Keep track of max height and ascent for auto lineheight
setFont
Set the font and other emphasis.
setStopConditions
Set the font and the stop conditions for the current run.
space
Record left x and character index of the space character just encounted.
Used for wrap-around. Answer whether the character has crossed the
right edge of the composition rectangle of the paragraph.
tab
Advance destination x according to tab settings in the paragraph's
textStyle. Answer whether the character has crossed the right edge of
the composition rectangle of the paragraph.
CornerRounder
This class is a quick hack to support rounded corners in morphic.
Rather than produce rounded rectangles, it tweaks the display of corners.
Rather than work for any radius, it only supports a radius of 6.
Rather than work for any border width, it only supports widths 0, 1 and 2.
The corners, while apparently transparent, still behave opaquely to mouse clicks.
Worse than this, the approach relies on the ability to extract underlying bits from the canvas prior to display. This ran afoul of top-down display, it seems, in SystemWindow spawnReframeHandle: (qv). It will also make a postscript printer very unhappy.
But, hey, it's cute.
initialize
Subclasses should redefine this method to perform initializations on instance creation
masterMask:masterOverlay:
rectWithinCornersOf:
roundCornersOf:on:in:displayBlock:borderWidth:corners:
saveBitsUnderCornersOf:on:in:corners:
tweakCornersOf:on:in:borderWidth:corners:
This variant has a cornerList argument, to allow some corners to be rounded and others not
Cursor
I am a Form that is a possible appearance for a mouse cursor. My size is always 16x16, ever since the original implementation on the Alto.
There are many examples available in the "current cursor" category of class methods. For example, "Cursor normal" and "Cursor wait". For example:
Cursor wait show
asCursorForm
beCursor
Primitive. Tell the interpreter to use the receiver as the current cursor
image. Fail if the receiver does not match the size expected by the
hardware. Essential. See Object documentation whatIsAPrimitive.
beCursorWithMask:
Primitive. Tell the interpreter to use the receiver as the current cursor image with the given mask Form. Both the receiver and the mask should have extent 16@16 and a depth of one. The mask and cursor bits are combined as follow:
mask cursor effect
0 0 transparent (underlying pixel shows through)
1 1 opaque black
1 0 opaque white
0 1 invert the underlying pixel
blank
bottomLeft
bottomRight
changed:
overriden to reinstall the cursor if it is the active cursor, in case the appearance has changed. (Is this used anywhere? Do cursors really change in place these days?)
corner
crossHair
currentCursor
currentCursor:
down
execute
extent:fromArray:offset:
hasMask
initBottomLeft
initBottomRight
initCorner
initCrossHair
initDown
initMarker
initMenu
initMove
initNormal
initNormalWithMask
initOrigin
initRead
initResizeLeft
initResizeTop
initResizeTopLeft
initResizeTopRight
initRightArrow
initSquare
initTarget
initTopLeft
initTopRight
initUp
initWait
initWrite
initXeq
initialize
Subclasses should redefine this method to perform initializations on instance creation
makeCursorsWithMask
marker
menu
move
new
normal
origin
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
read
resizeBottom
resizeBottomLeft
resizeBottomRight
resizeForEdge:
resizeLeft
resizeRight
resizeTop
resizeTopLeft
resizeTopRight
rightArrow
show
Make the hardware's mouse cursor look like the receiver
showGridded:
Make the current cursor shape be the receiver, forcing the location of the cursor to the point nearest gridPoint.
showWhile:
While evaluating the argument, aBlock, make the receiver be the cursor
shape.
square
startUp
target
topLeft
topRight
up
wait
webLink
withMask
write
CursorWithMask
A Cursor which additionally has a 16x16 transparency bitmap called a "mask". See the comment of beCursorWithMask: for details on how the mask is treated.
asCursorForm
beCursor
Primitive. Tell the interpreter to use the receiver as the current cursor
image. Fail if the receiver does not match the size expected by the
hardware. Essential. See Object documentation whatIsAPrimitive.
derivedFrom:
hasMask
maskForm
setMaskForm:
storeOn:base:
Store the receiver out as an expression that can be evaluated to recreate a Form with the same contents as the original.
withMask
DisplayHostWindow
A subclass of DisplayScreen that uses a (platform appropriate) HostWindowProxy
to do its displaying in a separate host OS window. This is just one example of a
client for HostWindowProxy.
See #test #test2 and HostWindowTests for example usage.
actualScreenSize
return the host window size as if it were 'the' screen
close
close this window
forceToScreen
update the area defined by my bounds
forceToScreen:
update the area defined by damageRectangle
open
open the host window
resetProxy
private - for use when resuming a snapshot file only. If the windowProxy had previously been created, nil it and reopen cleanly. IF you try to use this in a 'live' system it will NOT close the windows since startup conditions assume that proxies are invalid so we don't attempt to close them - since that could cause other problems
setExtent:depth:
reset the host window size to suit the extent chosen
test
((DisplayHostWindow extent: 400@400 depth: 16 ) translateBy: 210@450) test
test2
((DisplayHostWindow extent: 400@400 depth: 16 ) translateBy: 210@450) test2
windowPosition
return the current position of the window
windowPosition:
set the position of the window and then return the new position
windowSize
return the current size of the window - not neccessarily the same as my bitmap
windowSize:
Set the size of the window and then return the current size of the window -
not neccessarily the same
windowTitle:
set the label in the window titlebar to titleString
DisplayMedium
I am a display object which can both paint myself on a medium (displayOn: messages), and can act as a medium myself. My chief subclass is Form.
border:width:
Paint a border whose rectangular area is defined by aRectangle. The
width of the border of each side is borderWidth. Uses black for
drawing the border.
border:width:fillColor:
Paint a border whose rectangular area is defined by aRectangle. The
width of the border of each side is borderWidth. Uses aHalfTone for
drawing the border.
border:width:rule:fillColor:
Paint a border whose rectangular area is defined by aRectangle. The
width of the border of each side is borderWidth. Uses aHalfTone for
drawing the border.
border:widthRectangle:rule:fillColor:
Paint a border whose rectangular area is defined by aRectangle. The
width of each edge of the border is determined by the four coordinates
of insets. Uses aHalfTone and combinationRule for drawing the border.
copyBits:from:at:clippingBox:rule:fillColor:
Make up a BitBlt table and copy the bits.
deferUpdatesIn:while:
DisplayScreen overrides with something more involved...
drawLine:from:to:clippingBox:rule:fillColor:
Draw line by copying the argument, sourceForm, starting at location
beginPoint and ending at endPoint, clipped by the rectangle, clipRect.
The rule and mask for copying are the arguments anInteger and aForm.
fill:fillColor:
Replace a rectangular area of the receiver with the pattern described by
aForm according to the rule over.
fill:rule:fillColor:
Replace a rectangular area of the receiver with the pattern described by
aForm according to the rule anInteger.
fillBlack
Set all bits in the receiver to black (ones).
fillBlack:
Set all bits in the receiver's area defined by aRectangle to black (ones).
fillColor:
Set all pixels in the receiver to the color. Must be a correct color for this depth of medium. TK 1 Jun 96
fillGray
Set all bits in the receiver to gray.
fillGray:
Set all bits in the receiver's area defined by aRectangle to the gray mask.
fillShape:fillColor:
Fill a region corresponding to 1 bits in aShapeForm with aColor
fillShape:fillColor:at:
Fill a region corresponding to 1 bits in aShapeForm with aColor
fillWhite
Set all bits in the form to white.
fillWhite:
Set all bits in the receiver's area defined by aRectangle to white.
fillWithColor:
Fill the receiver's bounding box with the given color.
reverse
Change all the bits in the receiver that are white to black, and the ones
that are black to white.
reverse:
Change all the bits in the receiver's area that intersects with aRectangle
that are white to black, and the ones that are black to white.
reverse:fillColor:
Change all the bits in the receiver's area that intersects with aRectangle
according to the mask. Black does not necessarily turn to white, rather it
changes with respect to the rule and the bit in a corresponding mask
location. Bound to give a surprise.
DisplayObject
The abstract protocol for most display primitives that are used by Views for presenting information on the screen.
align:with:
Translate the receiver's offset such that alignmentPoint aligns with
relativePoint.
boundingBox
Answer the rectangular area that represents the boundaries of the
receiver's space of information.
center
collectionFromFileNamed:
computeBoundingBox
Answer the rectangular area that represents the boundaries of the
receiver's area for displaying information. This is the primitive for
computing the area if it is not already known.
display
Display the receiver on the Display at location 0,0.
displayAt:
Display the receiver located at aDisplayPoint with default settings for
the displayMedium, rule and halftone.
displayOn:
Simple default display in order to see the receiver in the upper left
corner of screen.
displayOn:at:
Display the receiver located at aDisplayPoint with default settings for
rule and halftone.
displayOn:at:clippingBox:
Display the receiver located at aDisplayPoint with default settings for
rule and halftone. Information to be displayed must be confined to the
area that intersects with clipRectangle.
displayOn:at:clippingBox:rule:fillColor:
This is the basic display primitive for graphic display objects. Display
the receiver located at aDisplayPoint with rule, ruleInteger, and mask,
aForm. Information to be displayed must be confined to the area that
intersects with clipRectangle.
displayOn:at:rule:
Display the receiver located at aPoint with default setting for the
halftone and clippingBox.
displayOn:transformation:clippingBox:
Display primitive for the receiver where a DisplayTransformation is
provided as an argument. Alignment is defaulted to the receiver's
rectangle. Information to be displayed must be confined to the area that
intersects with clipRectangle.
displayOn:transformation:clippingBox:align:with:
Display primitive where a DisplayTransformation is provided as an
argument, rule is over and mask is Form black. Information to be
displayed must be confined to the area that intersects with clipRectangle.
displayOn:transformation:clippingBox:align:with:rule:fillColor:
Display the receiver where a DisplayTransformation is provided as an
argument, rule is ruleInteger and mask is aForm. Translate by
relativePoint-alignmentPoint. Information to be displayed must be
confined to the area that intersects with clipRectangle.
displayOn:transformation:clippingBox:fixedPoint:
Display the receiver where a DisplayTransformation is provided as an
argument, rule is over and mask is Form black. No translation.
Information to be displayed must be confined to the area that intersects
with clipRectangle.
displayOn:transformation:clippingBox:rule:fillColor:
Display the receiver where a DisplayTransformation is provided as an
argument, rule is ruleInteger and mask is aForm. No translation.
Information to be displayed must be confined to the area that intersects
with clipRectangle.
displayOnPort:
displayOnPort:at:rule:
extent
Answer the point that represents the width and height of the receiver's
bounding box.
follow:while:
Move an image around on the Display. Restore the background
continuously without causing flashing. The argument, locationBlock,
supplies each new location, and the argument, durationBlock, supplies
true to continue, and then false to stop.
8/20/96 sw: call follow:while:bitsBehind: to do the real work. Note that th
method
now returns the final bits behind as method value.
follow:while:bitsBehind:startingLoc:
Move an image around on the Display. Restore the background continuously without causing flashing. The argument, locationBlock, supplies each new location, and the argument, durationBlock, supplies true to continue or false to stop. This variant takes the bitsBehind as an input argument, and returns the final saved saved bits as method value.
followCursor
Just show the Form following the mouse. 6/21/96 tk
height
Answer the number that represents the height of the receiver's
bounding box.
initialExtent
Included here for when a FormView is being opened
as a window. (4@4) covers border widths.
isTransparent
offset
Answer the amount by which the receiver should be offset when it is
displayed or its position is tested.
offset:
Set the amount by which the receiver's position is offset.
relativeRectangle
Answer a Rectangle whose top left corner is the receiver's offset position
and whose width and height are the same as the receiver.
rounded
Convert the offset of the receiver to integer coordinates.
scaleBy:
Scale the receiver's offset by aPoint.
slideFrom:to:nSteps:
does not display at the first point, but does at the last
slideFrom:to:nSteps:delay:
Slide this object across the display over the given number of steps, pausing for the given number of milliseconds after each step.
slideFrom:to:nSteps:delay:andStay:
Does not display at the first point, but does at the last.
Moreover, if stayAtEnd is true, it leaves the dragged image at the stopPoint
slideWithFirstFrom:to:nSteps:delay:
Slide this object across the display over the given number of steps,
pausing for the given number of milliseconds after each step.
translateBy:
Translate the receiver's offset.
width
Answer the number that represents the width of the receiver's bounding
box.
writeCollection:onFileNamed:
writeOnFileNamed:
Saves the receiver on the file fileName in the format:
fileCode, depth, extent, offset, bits.
writeUncompressedOnFileNamed:
Saves the receiver on the file fileName in the format:
fileCode, depth, extent, offset, bits.
DisplayScanner
My instances are used to scan text and display it on the screen or in a hidden form.
cr
When a carriage return is encountered, simply increment the pointer
into the paragraph.
crossedX
This condition will sometimes be reached 'legally' during display, when,
for instance the space that caused the line to wrap actually extends over
the right boundary. This character is allowed to display, even though it
is technically outside or straddling the clipping ectangle since it is in
the normal case not visible and is in any case appropriately clipped by
the scanner.
defaultFont
displayLine:offset:leftInRun:
The call on the primitive (scanCharactersFrom:to:in:rightX:) will be interrupted according to an array of stop conditions passed to the scanner at which time the code to handle the stop condition is run and the call on the primitive continued until a stop condition returns true (which means the line has terminated). leftInRun is the # of characters left to scan in the current run; when 0, it is time to call setStopConditions.
displayLines:in:clippedBy:
The central display routine. The call on the primitive
(scanCharactersFrom:to:in:rightX:) will be interrupted according to an
array of stop conditions passed to the scanner at which time the code to
handle the stop condition is run and the call on the primitive continued
until a stop condition returns true (which means the line has
terminated).
endOfRun
The end of a run in the display case either means that there is actually
a change in the style (run code) to be associated with the string or the
end of this line has been reached.
initializeFromParagraph:clippedBy:
paddedSpace
Each space is a stop condition when the alignment is right justified.
Padding must be added to the base width of the space according to
which space in the line this space is and according to the amount of
space that remained at the end of the line when it was composed.
placeEmbeddedObject:
Place the anchoredMorph or return false if it cannot be placed.
In any event, advance destX by its width.
plainTab
This is the basic method of adjusting destX for a tab.
setDestForm:
setFont
Set the font and other emphasis.
setPort:
Install the BitBlt to use
setStopConditions
Set the font and the stop conditions for the current run.
tab
text:textStyle:foreground:background:fillBlt:ignoreColorChanges:
textColor:
Overridden in DisplayScanner
DisplayScreen
There is only one instance of me, Display. It is a global and is used to handle general user requests to deal with the whole display screen.
Although I offer no protocol, my name provides a way to distinguish this special instance from all other Forms. This is useful, for example, in dealing with saving and restoring the system.
To change the depth of your Display...
Display newDepth: 16.
Display newDepth: 8.
Display newDepth: 1.
Valid display depths are 1, 2, 4, 8, 16 and 32. It is suggested that you run with your monitors setting the same, for better speed and color fidelity. Note that this can add up to 4Mb for the Display form. Finally, note that newDepth: ends by executing a 'ControlManager restore' which currently terminates the active process, so nothing that follows in the doit will get executed.
Depths 1, 2, 4 and 8 bits go through a color map to put color on the screen, but 16 and 32-bit color use the pixel values directly for RGB color (5 and 8 bits per, respectivlely). The color choice an be observed by executing Color fromUser in whatever depth you are using.
actualScreenDepth
actualScreenSize
addExtraRegion:for:
Register the given rectangle as a region which is drawn by the specified region drawer. The region will be excluded from any updates when #forceDamageToScreen: is called. Note that the rectangle is only valid for a single update cycle; once #forceDamageToScreen: has been called, the region drawer and its region are being removed from the list
beDisplay
Primitive. Tell the interpreter to use the receiver as the current display
image. Fail if the form is too wide to fit on the physical display.
Essential. See Object documentation whatIsAPrimitive.
boundingBox
Answer the rectangular area that represents the boundaries of the
receiver's space of information.
checkForNewScreenSize
clippingTo:do:
Display clippingTo: Rectangle fromUser do:
copyBits:from:at:clippingBox:rule:fillColor:
Make up a BitBlt table and copy the bits.
copyBits:from:at:clippingBox:rule:fillColor:map:
Make up a BitBlt table and copy the bits. Use a colorMap.
copyFrom:
Take on all state of aForm, with complete sharing
defaultBitBltClass
Return the BitBlt version to use when I am active
defaultCanvasClass
Return the WarpBlt version to use when I am active
defaultWarpBltClass
Return the WarpBlt version to use when I am active
deferUpdates:
Set the deferUpdates flag in the virtual machine. When this flag is true, BitBlt operations on the Display are not automatically propagated to the screen. If this underlying platform does not support deferred updates, this primitive will fail. Answer whether updates were deferred before if the primitive succeeds, nil if it fails.
deferUpdatesIn:while:
DisplayScreen overrides with something more involved...
depth:width:height:fullscreen:
displayChangeSignature
findAnyDisplayDepth
Return any display depth that is supported on this system.
findAnyDisplayDepthIfNone:
Return any display depth that is supported on this system.
If there is none, evaluate aBlock.
flash:
Flash the area of the screen defined by the given rectangle.
flash:andWait:
Flash the area of the screen defined by the given rectangle.
flashAll:andWait:
Flash the areas of the screen defined by the given rectangles.
forceDamageToScreen:
Force all the damage rects to the screen.
forceDisplayUpdate
On platforms that buffer screen updates, force the screen to be updated immediately. On other platforms, or if the primitive is not implemented, do nothing.
forceToScreen
Force the entire display area to the screen
forceToScreen:
Force the given rectangular section of the Display to be copied to the screen. The primitive call does nothing if the primitive is not implemented. Typically used when the deferUpdates flag in the virtual machine is on; see deferUpdates:.
fullBoundingBox
fullScreen
Display fullScreen
fullScreen:
fullScreenMode:
On platforms that support it, set full-screen mode to the value of the argument. (Note: you'll need to restore the Display after calling this primitive.
fullScreenOff
fullScreenOn
height
Answer the number that represents the height of the receiver's
bounding box.
isDisplayScreen
isFullScreen
lastScreenModeSelected
newDepth:
Display newDepth: 8.
Display newDepth: 1
newDepthNoRestore:
Change depths. Check if there is enough space! , di
objectForDataStream:
I am about to be written on an object file. Write a reference to the Display in the other system instead.
primRetryShowRectLeft:right:top:bottom:
Copy the given rectangular section of the Display to to the screen. This primitive is not implemented on all platforms. Do nothing if it fails.
primShowRectLeft:right:top:bottom:
Copy the given rectangular section of the Display to to the screen. This primitive is not implemented on all platforms. If this fails, retry integer coordinates.
primitiveDeferUpdates:
Set the deferUpdates flag in the virtual machine. When this flag is true, BitBlt operations on the Display are not automatically propagated to the screen. If this underlying platform does not support deferred updates, this primitive will fail. Answer the receiver if the primitive succeeds, nil if it fails.
release
I am no longer Display. Release any resources if necessary
replacedBy:do:
Permits normal display to draw on aForm instead of the display.
restore
restoreAfter:
Evaluate the block, wait for a mouse click, and then restore the screen.
setExtent:depth:
DisplayScreen startUp
shutDown
Minimize Display memory saved in image
startUp
supportedDisplayDepths
Return all pixel depths supported on the current host platform.
supportsDisplayDepth:
Return true if this pixel depth is supported on the current host platform.
Primitive. Optional.
toggleFullScreen
usableArea
Answer the usable area of the receiver. 5/22/96 sw.
width
Answer the number that represents the width of the receiver's bounding
box.
DisplayText
I represent Text whose emphasis changes are mapped to a set of fonts. My instances have an offset used in determining screen placement for displaying. They get used two different ways in the system. In the user interface, they mainly hold onto some text which is viewed by some form of ParagraphEditor. However, as a DisplayObject, they may need to display efficiently, so my instances have a cache for the bits.
alignedTo:
Return a copy with offset according to alignPointSelector which is one of...
#(topLeft, topCenter, topRight, leftCenter, center, etc)
asParagraph
Answer a Paragraph whose text and style are identical to that of the
receiver.
backgroundColor
boundingBox
Refer to the comment in DisplayObject|boundingBox.
composeForm
computeBoundingBox
Compute minimum enclosing rectangle around characters.
displayOn:at:clippingBox:rule:fillColor:
For TT font, rule 34 is used if possible.
displayOn:transformation:clippingBox:align:with:rule:fillColor:
Refer to the comment in
DisplayObject|displayOn:transformation:clippingBox:align:with:rule:mask:.
displayOnPort:at:
example
fontsUsed
Return a list of all fonts used currently in this text. 8/19/96 tk
foregroundColor
foregroundColor:backgroundColor:
form
Answer the form into which the receiver's display bits are cached.
form:
lineGrid
Answer the relative space between lines of the receiver's text.
numberOfLines
Answer the number of lines of text in the receiver.
offset
Refer to the comment in DisplayObject|offset.
offset:
Refer to the comment in DisplayObject|offset:.
setText:textStyle:offset:
string
Answer the string of the characters displayed by the receiver.
text
Answer the text displayed by the receiver.
text:
Set the receiver to display the argument, aText.
text:textStyle:
text:textStyle:offset:
textStyle
Answer the style by which the receiver displays its text.
textStyle:
Set the style by which the receiver should display its text.
DisplayTransform
This class represents a base for generic transformations of 2D points between different coordinate systems (including scaling and rotation). The transformations map objects between one coordinate system and another where it is assumed that a nested hierarchy of transformations can be defined.
It is assumed that transformations deal with Integer points. All transformations should return Integer coordinates (even though float points may be passed in as argument).
Compositions of transformations MUST work in the following order. A 'global' transformation (the argument in #composedWithGlobal:) is defined as a transformation that takes place between the receiver (the 'local') transformation and any 'global' point computations, whereas a 'local' transformation (e.g., the argument in #composedWithLocal:) takes place between the receiver ('global') and any 'local' points. For the transformation methods this means that combining a global and a local transformation will result in the following order:
globalPointToLocal: globalPoint
"globalPoint -> globalTransform -> localTransform -> locaPoint"
^localTransform globalPointToLocal:
(globalTransform globalPointToLocal: globalPoint)
localPointToGlobal: localPoint
"localPoint -> localTransform -> globalTransform -> globalPoint"
^globalTransform localPointToGlobal:
(localTransform localPointToGlobal: localPoint)
asCompositeTransform
Represent the receiver as a composite transformation
asMatrixTransform2x3
Represent the receiver as a 2x3 matrix transformation
composedWithGlobal:
Return the composition of the receiver and the global transformation passed in.
A 'global' transformation is defined as a transformation that takes place
between the receiver (the 'local') transformation and any 'global' point
computations, e.g., for the methods
globalPointToLocal: globalPoint
globalPoint -> globalTransform -> localTransform -> locaPoint
localPointToGlobal: localPoint
localPoint -> localTransform -> globalTransform -> globalPoint
composedWithLocal:
Return the composition of the receiver and the local transformation passed in.
A 'local' transformation is defined as a transformation that takes place
between the receiver (the 'global') transformation and any 'local' point
computations, e.g., for the methods
globalPointToLocal: globalPoint
globalPoint -> globalTransform -> localTransform -> locaPoint
localPointToGlobal: localPoint
localPoint -> localTransform -> globalTransform -> globalPoint
globalBoundsToLocal:
Transform aRectangle from global coordinates into local coordinates
globalPointToLocal:
Transform aPoint from global coordinates into local coordinates
globalPointsToLocal:
Transform all the points of inArray from global into local coordinates
identity
inverseTransformation
Return the inverse transformation of the receiver
invertBoundsRect:
Return a rectangle whose coordinates have been transformed
from local back to global coordinates.
isCompositeTransform
Return true if the receiver is a composite transformation.
Composite transformations may have impact on the accuracy.
isIdentity
Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.
isMatrixTransform2x3
Return true if the receiver is 2x3 matrix transformation
isMorphicTransform
Return true if the receiver is a MorphicTransform, that is specifies the transformation values explicitly.
isPureTranslation
Return true if the receiver specifies no rotation or scaling.
localBoundsToGlobal:
Transform aRectangle from local coordinates into global coordinates
localPointToGlobal:
Transform aPoint from local coordinates into global coordinates
localPointsToGlobal:
Transform all the points of inArray from local into global coordinates
setIdentity
Initialize the receiver to the identity transformation (e.g., not affecting points)
sourceQuadFor:
FontSet
FontSet provides a mechanism for storing a set of fonts as a class that can be conveniently filedOut, filedIn, and installed as a TextStyle.
The most common use is...
Find a font you like.
Use BitFont to convert a bunch of sizes to data files named, eg, LovelyNN.BF
Use FontSet convertFontsNamed: 'Lovely' to produce a FontSet named Lovely.
FileOut that FontSet for later use.
Use Lovely installAsTextStyle to make all sizes available in a TextStyle
named #Lovely in the TextConstants dictionary.
Use ctrl-k in any text pane to select the new Lovely style for that paragraph.
Then use cmd-1 through 5 or cmd-k to set the point-size for any selection.
acceptsLoggingOfCompilation
compileFont:
convertFontsNamed:
convertFontsNamed:inDirectoryNamed:
convertTextStyleNamed:
fileOut
fontCategory
fontName
fontNamed:fromLiteral:
fontNamed:fromMimeLiteral:
fontSetClass:
installAsDefault
installAsTextStyle
size:fromLiteral:
Form
A rectangular array of pixels, used for holding images. All pictures, including character images are Forms. The depth of a Form is how many bits are used to specify the color at each pixel. The actual bits are held in a Bitmap, whose internal structure is different at each depth. Class Color allows you to deal with colors without knowing how they are actually encoded inside a Bitmap.
The supported depths (in bits) are 1, 2, 4, 8, 16, and 32. The number of actual colors at these depths are: 2, 4, 16, 256, 32768, and 16 million.
Forms are indexed starting at 0 instead of 1; thus, the top-left pixel of a Form has coordinates 0@0.
Forms are combined using BitBlt. See the comment in class BitBlt. Forms that repeat many times to fill a large destination are InfiniteForms.
colorAt: x@y Returns the abstract Color at this location
displayAt: x@y shows this form on the screen
displayOn: aMedium at: x@y shows this form in a Window, a Form, or other DisplayMedium
fillColor: aColor Set all the pixels to the color.
edit launch an editor to change the bits of this form.
pixelValueAt: x@y The encoded color. The encoding depends on the depth.
allocateForm:
Allocate a new form which is similar to the receiver and can be used for accelerated blts
and
anyShapeFill
Fill the interior of the outermost outlined region in the receiver, a 1-bit deep form. Typically the resulting form is used with fillShape:fillColor: to paint a solid color. See also convexShapeFill:
as8BitColorForm
Simple conversion of zero pixels to transparent. Force it to 8 bits.
asCursorForm
asFormOfDepth:
asGrayScale
Assume the receiver is a grayscale image. Return a grayscale ColorForm computed by extracting the brightness levels of one color component. This technique allows a 32-bit Form to be converted to an 8-bit ColorForm to save space while retaining a full 255 levels of gray. (The usual colormapping technique quantizes to 8, 16, or 32 levels, which loses information.)
asHttpResponseTo:
asMIMEDocument
asMIMEDocumentType:
asMorph
Open a morph, as best one can, on the receiver
asNINode
asSourceForm
asWebImage
return a MIMEDocument
balancedPatternFor:
Return the pixel word for representing the given color on the receiver
bitPatternFor:
Return the pixel word for representing the given color on the receiver
bitPatternForDepth:
Only called when a Form is being used as a fillColor. Use a Pattern or InfiniteForm instead for this purpose.
Interpret me as an array of (32/depth) Color pixelValues. BitBlt aligns the first element of this array with the top scanline of the destinationForm, the second with the second, and so on, cycling through the color array as necessary. 6/18/96 tk
bits
Answer the receiver's Bitmap containing its bits.
bits:
Reset the Bitmap containing the receiver's bits.
bitsPerComponent
bitsSize
blankCopyOf:scaledBy:
blend
blendAlpha
border:width:rule:fillColor:
Paint a border whose rectangular area is defined by rect. The
width of the border of each side is borderWidth. Uses fillColor for drawing
the border.
borderFormOfWidth:sharpCorners:
Smear this form around and then subtract the original to produce
an outline. If sharpen is true, then cause right angles to be outlined
by right angles (takes an additional diagonal smears ANDed with both
horizontal and vertical smears).
borderWidth:
Set the width of the border for the receiver to be anInteger and paint it
using black as the border color.
borderWidth:color:
Set the width of the border for the receiver to be anInteger and paint it
using aMask as the border color.
borderWidth:fillColor:
Set the width of the border for the receiver to be anInteger and paint it
using aMask as the border color.
boundingBox
Answer the rectangular area that represents the boundaries of the
receiver's space of information.
bytesPerRow
center
Note that offset is ignored here. Are we really going to embrace offset?
colorAt:
Return the color in the pixel at the given point.
colorAt:put:
Store a Color into the pixel at coordinate aPoint.
colorReduced
Return a color-reduced ColorForm version of the receiver, if possible, or the receiver itself if not.
colormapFromARGB
Return a ColorMap mapping from canonical ARGB space into the receiver.
Note: This version is optimized for Squeak forms.
colormapIfNeededFor:
Return a ColorMap mapping from the receiver to destForm.
colormapIfNeededForDepth:
Return a colormap for displaying the receiver at the given depth, or nil if no colormap is needed.
colormapToARGB
Return a ColorMap mapping from the receiver into canonical ARGB space.
colorsUsed
Return a list of the Colors this form uses.
comeFullyUpOnReload:
Normally this read-in object is exactly what we want to store. 7/26/96 tk
computeBoundingBox
Answer the rectangular area that represents the boundaries of the
receiver's area for displaying information. This is the primitive for
computing the area if it is not already known.
contentsOfArea:
Return a new form which derives from the portion of the original form delineated by aRect.
contentsOfArea:into:
Return a new form which derives from the portion of the original form delineated by aRect.
convexShapeFill:
Fill the interior of the outtermost outlined region in the receiver. The outlined region must not be concave by more than 90 degrees. Typically aMask is Color black, to produce a solid fill. then the resulting form is used with fillShape: to paint a solid color. See also anyShapeFill
copy:
Return a new form which derives from the portion of the original form delineated by aRect.
copy:from:in:rule:
Make up a BitBlt table and copy the bits.
copy:from:to:rule:
copyBits:at:translucent:
Make up a BitBlt table and copy the bits with the given colorMap.
copyBits:from:at:clippingBox:rule:fillColor:
Make up a BitBlt table and copy the bits.
copyBits:from:at:clippingBox:rule:fillColor:map:
Make up a BitBlt table and copy the bits. Use a colorMap.
copyBits:from:at:colorMap:
Make up a BitBlt table and copy the bits with the given colorMap.
copyWithColorsReducedTo:
Note: this has not been engineered.
There are better solutions in the literature.
decodeArray
deepCopy
Answer a copy of the receiver with its own copy of each instance
variable.
defaultCanvasClass
Return the default canvas used for drawing onto the receiver
defaultMimeType
depth
depth:
displayInterpolatedIn:on:
Display the receiver on aForm, using interpolation if necessary.
Form fromUser displayInterpolatedOn: Display.
Note: When scaling we attempt to use bilinear interpolation based
on the 3D engine. If the engine is not there then we use WarpBlt.
displayInterpolatedOn:
Display the receiver on aForm, using interpolation if necessary.
Form fromUser displayInterpolatedOn: Display.
Note: When scaling we attempt to use bilinear interpolation based
on the 3D engine. If the engine is not there then we use WarpBlt.
displayOn:at:clippingBox:rule:fillColor:
This is the basic display primitive for graphic display objects. Display
the receiver located at aDisplayPoint with rule, ruleInteger, and mask,
aForm. Information to be displayed must be confined to the area that
intersects with clipRectangle.
displayOn:transformation:clippingBox:align:with:rule:fillColor:
Graphically, it means nothing to scale a Form by floating point values.
Because scales and other display parameters are kept in floating point to
minimize round off errors, we are forced in this routine to round off to the
nearest integer.
displayOnPort:at:
displayResourceFormOn:
a special display method for blowing up resource thumbnails
displayScaledOn:
Display the receiver on aForm, scaling if necessary.
Form fromUser displayScaledOn: Display.
displayScreen
Return the display screen the receiver is allocated on.
Forms in general are Squeak internal and not allocated on any particular display.
dominantColor
dotOfSize:
drawLine:from:to:clippingBox:rule:fillColor:
Refer to the comment in
DisplayMedium|drawLine:from:to:clippingBox:rule:mask:.
erase
erase1bitShape
eraseShape:
use bwForm as a mask to clear all pixels where bwForm has 1's
exampleBorder
exampleEdits
exampleMagnify
exampleShrink
exampleSketch
exampleSpaceFill
extent
Answer the point that represents the width and height of the receiver's
bounding box.
extent:
extent:depth:
extent:depth:bits:
extent:depth:fromArray:offset:
extent:fromArray:offset:
extent:fromStipple:
extent:offset:
fadeImage:at:indexAndMaskDo:
This fade uses halftones as a blending hack.
Zeros in the halftone produce the original image (self), and
ones in the halftone produce the 'otherImage'.
IndexAndMaskBlock gets evaluated prior to each cycle,
and the resulting boolean determines whether to continue cycling.
fadeImageCoarse:at:
Display fadeImageCoarse: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40
fadeImageFine:at:
Display fadeImageFine: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40
fadeImageHor:at:
Display fadeImageHor: (Form fromDisplay: (10@10 extent: 300@300)) reverse at: 10@10
fadeImageHorFine:at:
Display fadeImageHorFine: (Form fromDisplay: (10@10 extent: 300@300)) reverse at: 10@10
fadeImageSquares:at:
Display fadeImageSquares: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40
fadeImageVert:at:
Display fadeImageVert: (Form fromDisplay: (10@10 extent: 300@300)) reverse at: 10@10
fileReaderServicesForDirectory:
fileReaderServicesForFile:suffix:
fill:rule:fillColor:
Replace a rectangular area of the receiver with the pattern described by aForm
according to the rule anInteger.
fillFromXColorBlock:
Horizontal Gradient Fill.
Supply relative x in [0.0 ... 1.0] to colorBlock,
and paint each pixel with the color that comes back
fillFromXYColorBlock:
General Gradient Fill.
Supply relative x and y in [0.0 ... 1.0] to colorBlock,
and paint each pixel with the color that comes back
fillFromYColorBlock:
Vertical Gradient Fill.
Supply relative y in [0.0 ... 1.0] to colorBlock,
and paint each pixel with the color that comes back
findShapeAroundSeedBlock:
Build a shape that is black in any region marked by seedBlock.
SeedBlock will be supplied a form, in which to blacken various
pixels as 'seeds'. Then the seeds are smeared until
there is no change in the smear when it fills the region, ie,
when smearing hits a black border and thus goes no further.
finish
If there are any pending operations on the receiver complete them. Do not return before all modifications have taken effect.
fixAlpha
Fix the alpha channel if the receiver is 32bit
flipBy:centerAt:
Return a copy of the receiver flipped either #vertical or #horizontal.
floodFill2:at:
Fill the shape (4-connected) at interiorPoint. The algorithm is based on Paul Heckbert's 'A Seed Fill Algorithm', Graphic Gems I, Academic Press, 1990.
NOTE: This is a less optimized variant for flood filling which is precisely along the lines of Heckbert's algorithm. For almost all cases #floodFill:at: will be faster (see the comment there) but this method is left in both as reference and as a fallback if such a strange case is encountered in reality.
floodFill:at:
floodFill:at:tolerance:
Fill the shape (4-connected) at interiorPoint. The algorithm is based on Paul Heckbert's 'A Seed Fill Algorithm', Graphic Gems I, Academic Press, 1990.
NOTE (ar): This variant has been heavily optimized to prevent the overhead of repeated calls to BitBlt. Usually this is a really big winner but the runtime now depends a bit on the complexity of the shape to be filled. For extremely complex shapes (say, a Hilbert curve) with very few pixels to fill it can be slower than #floodFill2:at: since it needs to repeatedly read the source bits. However, in all practical cases I found this variant to be 15-20 times faster than anything else.
Further note (di): I have added a feature that allows this routine to fill areas of approximately constant color (such as photos, scans, and jpegs). It does this by computing a color map for the peeker that maps all colors close to 'old' into colors identical to old. This mild colorblindness achieves the desired effect with no further change or degradation of the algorithm. tolerance should be 0 (exact match), or a value corresponding to those returned by Color>>diff:, with 0.1 being a reasonable starting choice.
floodFillMapFrom:to:mappingColorsWithin:to:
This is a helper routine for floodFill. It's written for clarity (scanning the entire
map using colors) rather than speed (which would require hacking rgb components
in the nieghborhood of centerPixVal. Note that some day a better proximity metric
would be (h s v) where tolerance could be reduced in hue.
flush
If there are any pending operations on the receiver start doing them. In time, they will show up on the receiver but not necessarily immediately after this method returns.
form
Answer the receiver's form. For vanilla Forms, this degenerates to self. Makes several methods that operate on both Forms and MaskedForms much more straightforward. 6/1/96 sw
formForColorCount:
Return a ColorForm of sufficient depth to represent the given number of colors. The maximum number of colors is 256.
fromBMPFile:
fromBMPFileNamed:
fromBinaryStream:
fromDisplay:
Create a virtual bit map from a user specified rectangular area on the
display screen. Reallocates bitmap only if aRectangle ~= the receiver's
extent.
fromDisplay:using:
fromFileNamed:
fromUser
fromUser:
fromUserWithExtent:
getCanvas
Return a Canvas that can be used to draw onto the receiver
hackBits:
This method provides an initialization so that BitBlt may be used, eg, to
copy ByteArrays and other non-pointer objects efficiently.
The resulting form looks 4 wide, 8 deep, and bitThing-size-in-words high.
hasBeenModified
Return true if something *might* have been drawn into the receiver
hasBeenModified:
Change the receiver to reflect the modification state
hasNonStandardPalette
Return true if the receiver has a non-standard palette.
Non-standard means that RGBA components may be located
at positions differing from the standard Squeak RGBA layout
at the receiver's depth.
height
Answer the number that represents the height of the receiver's
bounding box.
hibernate
Replace my bitmap with a compactly encoded representation (a ByteArray). It is vital that BitBlt and any other access to the bitmap (such as writing to a file) not be used when in this state. Since BitBlt will fail if the bitmap size is wrong (not = bitsSize), we do not allow replacement by a byteArray of the same (or larger) size.
iconOrThumbnailOfSize:
Answer an appropiate form to represent the receiver
importImage:
importImageDirectory:
importImageDirectoryWithSubdirectories:
initFromArray:
Fill the bitmap from array. If the array is shorter,
then cycle around in its contents until the bitmap is filled.
initialize
Subclasses should redefine this method to perform initializations on instance creation
innerPixelRectFor:orNot:
Return a rectangle describing the smallest part of me that includes
all pixels of value pv.
Note: If orNot is true, then produce a copy that includes all pixels
that are DIFFERENT from the supplied (background) value
isAllWhite
Answer whether all bits in the receiver are white
isBigEndian
Return true if the receiver contains big endian pixels, meaning the left-most pixel is stored in the most significant bits of a word.
isBltAccelerated:for:
Return true if the receiver can perform accelerated blts operations by itself
isDisplayScreen
isExternalForm
isFillAccelerated:for:
Return true if the receiver can perform accelerated fill operations by itself
isForm
isLittleEndian
Return true if the receiver contains little endian pixels, meaning the left-most pixel is stored in the least significant bits of a word.
isStatic
isTranslucent
Answer whether this form may be translucent
isTransparentAt:
Return true if the receiver is transparent at the given point.
magnify:by:
Answer a Form created as a scaling of the receiver.
Scale may be a Float, and may be greater or less than 1.0.
magnify:by:smoothing:
Answer a Form created as a scaling of the receiver.
Scale may be a Float or even a Point, and may be greater or less than 1.0.
magnifyBy:
Answer a Form created as a scaling of the receiver.
Scale may be a Float or even a Point, and may be greater or less than 1.0.
makeBWForm:
Map this form into a B/W form with 1's in the foreground regions.
makeStar
mapColor:to:
Make all pixels of the given color in this Form to the given new color.
mapColors:to:
Make all pixels of the given color in this Form to the given new color.
maskingMap
Return a color map that maps all colors except transparent to words of all ones. Used to create a mask for a Form whose transparent pixel value is zero.
mimeType
nativeDepth
Return the 'native' depth of the receiver, e.g., including the endianess
newColorMap
Return an uninitialized color map array appropriate to this Form's depth.
numComponents
objectForDataStream:
Return an object to store on an external data stream.
offset
Answer the amount by which the receiver should be offset when it is
displayed or its position is tested.
offset:
Set the amount by which the receiver's position is offset.
oldErase1bitShape
oldPaint
openImageInWindow:
orderedDither32To16
Do an ordered dithering for converting from 32 to 16 bit depth.
over
paddedWidth
pageImage:at:corner:
Produce a page-turning illusion that gradually reveals otherImage
located at topLeft in this form. Corner specifies which corner, as
1=topLeft, 2=topRight, 3=bottomRight, 4=bottomLeft.
pageWarp:at:forward:
Produce a page-turning illusion that gradually reveals otherImage
located at topLeft in this form.
forward == true means turn pages toward you, else away. [ignored for now]
paint
paintAlpha
paintBits:at:translucent:
Make up a BitBlt table and copy the bits with the given colorMap.
pixelCompare:with:at:
Compare the selected bits of this form (those within aRect) against
those in a similar rectangle of otherFrom. Return the sum of the
absolute value of the differences of the color values of every pixel.
Obviously, this is most useful for rgb (16- or 32-bit) pixels but,
in the case of 8-bits or less, this will return the sum of the differing
bits of the corresponding pixel values (somewhat less useful)
pixelValueAt:
Return the raw pixel value at the given point. This pixel value depends on the receiver's depth. Typical clients use colorAt: to get a Color.
pixelValueAt:put:
Store the given raw pixel value at the given point. Typical clients use colorAt:put: to store a color.
pixelValueFor:
Return the pixel word for representing the given color on the receiver
pixelWordFor:
Return the pixel word for representing the given color on the receiver
primCountBits
Count the non-zero pixels of this form.
primPrintHScale:vScale:landscape:
On platforms that support it, this primitive prints the receiver, assumed to be a Form, to the default printer.
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printPostscript:operator:
privateFloodFillValue:
Private. Compute the pixel value in the receiver's depth but take into account implicit color conversions by BitBlt.
readAttributesFrom:
readBitsFrom:
readFrom:
Reads the receiver from the given binary stream with the format:
depth, extent, offset, bits.
readFromOldFormat:
Read a Form in the original ST-80 format.
readNativeResourceFrom:
readResourceFrom:
Store a resource representation of the receiver on aStream.
Must be specific to the receiver so that no code is filed out.
rectangleEnclosingPixelsNotOfColor:
Answer the smallest rectangle enclosing all the pixels of me that are different from the given color. Useful for extracting a foreground graphic from its background.
reducedPaletteOfSize:
Return an array of colors of size nColors, such that those colors
represent well the pixel values actually found in this form.
relativeTextAnchorPosition
replaceByResource:
Replace the receiver by some resource that just got loaded
replaceColor:withColor:
Replace one color with another everywhere is this form
resourceTag
reverse
Change all the bits in the receiver that are white to black, and the ones
that are black to white.
rgbaBitMasks
Return the masks for specifying the R,G,B, and A components in the receiver
rotateBy:
Rotate the receiver by the indicated number of degrees.
rotateBy:centerAt:
Return a rotated copy of the receiver.
direction = #none, #right, #left, or #pi
rotateBy:magnify:smoothing:
Rotate the receiver by the indicated number of degrees and magnify. scale can be a Point to make for interesting 3D effects
rotateBy:smoothing:
Rotate the receiver by the indicated number of degrees.
rowPadding
scaledIntoFormOfSize:
Scale and center the receiver into a form of a given size
scaledToSize:
serviceImageAsBackground
serviceImageImportDirectory
serviceImageImportDirectoryWithSubdirectories
serviceImageImports
serviceOpenImageInWindow
services
setAsBackground
Set this form as a background image.
setBackgroundFromImageFileNamed:
setColorspaceOn:
setExtent:depth:
Create a virtual bit map with the given extent and bitsPerPixel.
setExtent:depth:bits:
Create a virtual bit map with the given extent and bitsPerPixel.
setResourceBits:
Private. Really. Used for setting the 'resource bits' when externalizing some form
shapeBorder:width:
A simplified version for shapes surrounded by transparency (as SketchMorphs).
Note also this returns a new form that may be larger, and does not affect the original.
shapeBorder:width:interiorPoint:sharpCorners:internal:
Identify the shape (region of identical color) at interiorPoint,
and then add an outline of width=borderWidth and color=aColor.
If sharpen is true, then cause right angles to be outlined by
right angles. If internal is true, then produce a border that lies
within the identified shape. Thus one can put an internal border
around the whole background, thus effecting a normal border
around every other foreground image.
shapeFill:interiorPoint:
Identify the shape (region of identical color) at interiorPoint,
and then fill that shape with the new color, aColor
: modified di's original method such that it returns the bwForm, for potential use by the caller
shapeFill:seedBlock:
shouldPreserveContents
Return true if the receiver should preserve it's contents when flagged to be clean. Most forms can not be trivially restored by some drawing operation but some may.
showFormsAcrossTopOfScreen:
showFormsDictAcrossTopOfScreen:
shrink:by:
shutDown
The system is going down. Try to preserve some space
size
Should no longer be used -- use bitsSize instead. length of variable part of instance.
slideImage:at:delta:
Display slideImage: (Form fromDisplay: (40@40 extent: 300@300)) reverse
at: 40@40 delta: 3@-4
smear:distance:
Smear any black pixels in this form in the direction dir in Log N steps
stencil
return a 1-bit deep, black-and-white stencil of myself
store15To24HexBitsOn:
write data for 16-bit form, optimized for encoders writing directly to files to do one single file write rather than 12. I'm not sure I understand the significance of the shifting pattern, but I think I faithfully translated it from the original
store32To24HexBitsOn:
storeBits:to:on:
storeBitsOn:base:
storeHexBitsOn:
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
storeOn:base:
Store the receiver out as an expression that can be evaluated to recreate a Form with the same contents as the original.
storePostscriptHexOn:
storeResourceOn:
Store a resource representation of the receiver on aStream.
Must be specific to the receiver so that no code is filed out.
swapEndianness
Swap from big to little endian pixels and vice versa
tallyPixelValues
Answer a Bitmap whose elements contain the number of pixels in this Form with the pixel value corresponding to their index. Note that the pixels of multiple Forms can be tallied together using tallyPixelValuesInRect:into:.
tallyPixelValuesInRect:into:
Tally the selected pixels of this Form into valueTable, a Bitmap of depth 2^depth similar to a color map. Answer valueTable.
toothpaste:
trimBordersOfColor:
Answer a copy of this Form with each edge trimmed in to the first pixel that is not of the given color. (That is, border strips of the given color are removed).
under
unhibernate
If my bitmap has been compressed into a ByteArray,
then expand it now, and return true.
unload
veryDeepCopyWith:
Return self. I am immutable in the Morphic world. Do not record me.
width
Answer the number that represents the width of the receiver's bounding
box.
wipeImage:at:clippingBox:rectForIndex:
wipeImage:at:delta:
Display wipeImage: (Form fromDisplay: (40@40 extent: 300@300)) reverse
at: 40@40 delta: 0@-2
wipeImage:at:delta:clippingBox:
writeAttributesOn:
writeBMPfileNamed:
Display writeBMPfileNamed: 'display.bmp'
writeBitsOn:
writeJPEGfileNamed:
Write a JPEG file to the given filename using default settings
writeJPEGfileNamed:progressive:
Write a JPEG file to the given filename using default settings. Make it progressive or not, depending on the boolean argument
writeOn:
Write the receiver on the file in the format
depth, extent, offset, bits.
writeOnMovie:
Write just my bits on the file.
writeUncompressedOn:
Write the receiver on the file in the format depth, extent, offset, bits. Warning: Caller must put header info on file! Use writeUncompressedOnFileNamed: instead.
writerForMimeType:
xTallyPixelValue:orNot:
Return an array of the number of pixels with value pv by x-value.
Note that if not is true, then this will tally those different from pv.
xorHack:
yTallyPixelValue:orNot:
Return an array of the number of pixels with value pv by y-value.
Note that if not is true, then this will tally those different from pv.
zoomIn:orOutTo:at:vanishingPoint:
Display zoomInTo: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40.
Display zoomOutTo: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40.
zoomInTo:at:
Display zoomInTo: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40
zoomOutTo:at:
Display zoomOutTo: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40
FormSetFont
FormSetFonts are designed to capture individual images as character forms for imbedding in normal text. While most often used to insert an isolated glyph in some text, the code is actually desinged to support an entire user-defined font. The TextAttribute subclass TextFontReference is specifically designed for such in-line insertion of exceptional fonts in normal text.
copy:toClipBoardAs:ascent:
example
fromFormArray:asciiStart:ascent:
reset
Ignored by FormSetFonts
FormStub
A FormStub is xxxxxxxxx.
Instance Variables
locator: <Object>
locator
- xxxxx
locator
locator:
objectForDataStream:
Force me into outPointers so that I get notified about startup
GIFReadWriter
Copyright (c) Kazuki Yasumatsu, 1995. All rights reserved.
Used with permission. Modified for use in Squeak.
checkCodeSize
close
Write terminator
delay:
Set delay for next image in hundredth (1/100) of seconds
exampleAnim
fillBuffer
flushBits
flushBuffer
flushCode
grabScreenAndSaveOnDisk
initialize
Subclasses should redefine this method to perform initializations on instance creation
loopCount:
Set looping. This must be done before any image is written!
nextBits
nextBitsPut:
nextByte
nextBytePut:
nextImage
Read in the next GIF image from the stream. Read it all into
memory first for speed.
nextPutImage:
Encoding anImage on stream.
peekByte
readBitData
using modified Lempel-Ziv Welch algorithm.
readBody
Read the GIF blocks. Modified to return a form.
readCode
readColorTable:
readHeader
readPixelFrom:
Since bits is a Bitmap with 32 bit values, watch out for the
padding at the end of each row. But, GIF format already wants padding to
32 bit boundary! OK as is. tk 9/14/97
readWord
setParameters:
setStream:
Feed it in from an existing source
skipBitData
typicalFileExtensions
understandsImageFormat
Test to see if the image stream format is understood by this decoder.
This should be implemented in each subclass of ImageReadWriter so that
a proper decoder can be selected without ImageReadWriter having to know
about all possible image file types.
updatePixelPosition
wantsToHandleGIFs
writeBitData:
using modified Lempel-Ziv Welch algorithm.
writeCode:
writeCodeAndCheckCodeSize:
writeHeader
writeWord:
HostFont
A HostFont is xxxxxxxxx.
Instance Variables
fullWidth: <Object>
kernPairs: <Object>
ranges: <Object>
fullWidth
- xxxxx
kernPairs
- xxxxx
ranges
- xxxxx
baseKern
Return the base kern value to be used for all characters.
createCharacterToGlyphMap
Private. Create the character to glyph mapping for a font that didn't have any before. This is basically equivalent to what the former setStopCondition did, only based on indexes.
defaultRanges
descentKern
Return the kern delta for descenders.
displayString:on:from:to:at:kern:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) BitBlt.
displayString:on:from:to:at:kern:baselineY:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) BitBlt.
emphasized:
Answer a copy of the receiver with emphasis set to include code.
fontName:size:emphasis:
fontName:size:emphasis:rangesArray:
^HostFont fontName: ('MS UI Gothic') size: 12 emphasis: 0 rangesArray: EFontBDFFontReaderForRanges basicNew rangesForJapanese.
fontNameFromUser
getFontData
initForSubtitles
initWin32
isoToSqueakMap
listFontName:
listFontNames
makeBoldGlyphs
First check if we can use some OS support for this
makeItalicGlyphs
First check if we can use some OS support for this
makeStruckOutGlyphs
First check if we can use some OS support for this
makeUnderlinedGlyphs
First check if we can use some OS support for this
primitiveCreateFont:size:emphasis:
primitiveDestroyFont:
primitiveFont:fullWidthOfChar:
primitiveFont:getData:
primitiveFont:getKernPair:
primitiveFont:glyphOfChar:into:
primitiveFont:widthOfChar:
primitiveFontAscent:
primitiveFontDataSize:
primitiveFontDescent:
primitiveFontEmbeddingFlags:
primitiveFontEncoding:
primitiveFontNumKernPairs:
rangesForJapanese
testEmbeddingFlags
HostFont basicNew testEmbeddingFlags
textStyleFrom:
textStyleFrom:sizes:
textStyleFrom:sizes:ranges:
textStyleFromUser
unloadAsianTT
widthOfString:from:to:
Measure the length of the given string between start and stop index
HostWindowProxy
This is a proxy for a Host OS window and as such is considered a disposable item. When an image is restarted the client must recreate suitable instances from the information they hold. Platform specific subclasses are available to translate abstract requirements into possible platform concrete data.
There is a registry of instances so that when users let go they can be guaranteed to close down properly. Because the instances point to the source Form in use this can on occasion result in a cycle that defeats the Weak mechanism - hence the implementation of #executor & #asExecutor.
The only requirements placed on the sourceForm instvar are those of being like a DisplayScreen - can return a bits array, the width, depth etc AND able to respond to #resetProxy to remove and rebuild the window proxy
activeWindowProxyClass
asExecutor
attributes
return the ByteArray representing the desired window attributes. This is utterly platform dependent and my default is an empty ByteArray to signify a default window
bits
return the bits - normally of the sourceForm
close
close this window
defaultWindowType
set up my attributes to be a default window - a titlebar, usual decorations etc
depth
return the depth - normally of the sourceForm
executor
Return an object which can act as executor for finalization of the receiver
finalize
close this window
forceToScreen:
update the area of the sourceForm defined by damageRectangle
height
return the height - normally of the sourceForm
initialize
Subclasses should redefine this method to perform initializations on instance creation
isActiveHostWindowProxyClass
isOpen
am I already opened?
offset
return the offset - normally of the sourceForm
on:
set my sourceForm; usually an actual Form but so long as methods like bits, height etc work, it can be anything
open
open a host window built around my position, size and bitmap
primitiveCreateHostWindowWidth:height:originX:y:attributes:
create and open a host window. list is a ByteArray list of window attributes in some platform manner. See subclasses for information
primitiveUpdateHostWindow:bitmap:width:height:depth:left:right:top:bottom:
Force the pixels to the screen. The bitmap details and affected area are given
explicitly to avoid dependence upon any object structure
primitiveWindowClose:
Close the window
primitiveWindowPosition:
Find the topleft corner of the window
primitiveWindowPosition:x:y:
Set the topleft corner of the window - return what is actually set
primitiveWindowSize:
Find the size of the window, just like primitiveScreenSize
primitiveWindowSize:x:y:
Set the size of the window, just like primitiveScreenSize. Return the actually
achieved size
primitiveWindowTitle:string:
Set the label of the title bar of the window
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
recreate
something has changed that require deleting the host window before opening it
with new attributes
register
register:
registry
resetProxy
tell my sourceForm to kill me (gulp) and resurrect me in the correct clothing
setDefaultWindowProxyClass
startUp
unregister
unregister:
width
return the width - normally of the sourceForm
windowPosition
return the current position of the window
windowPosition:
set the position of the window and then return the new position
windowProxyError:
Could be useful to raise an exception but not yet
windowSize
return the current size of the window
windowSize:
Set the size of the window and then return the actually set size of the window - not neccessarily the same
windowTitle:
set the label in the window titlebar to titleString
IdentityGlyphMap
An IdentityGlyphMap is xxxxxxxxx.
Instance Variables
at:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive.
IdentityTransform
An IdentityTransform is xxxxxxxxx.
Instance Variables
angle
asMatrixTransform2x3
Represent the receiver as a 2x3 matrix transformation
composedWith:
composedWithGlobal:
Return the composition of the receiver and the global transformation passed in.
A 'global' transformation is defined as a transformation that takes place
between the receiver (the 'local') transformation and any 'global' point
computations, e.g., for the methods
globalPointToLocal: globalPoint
globalPoint -> globalTransform -> localTransform -> locaPoint
localPointToGlobal: localPoint
localPoint -> localTransform -> globalTransform -> globalPoint
composedWithLocal:
Return the composition of the receiver and the local transformation passed in.
A 'local' transformation is defined as a transformation that takes place
between the receiver (the 'global') transformation and any 'local' point
computations, e.g., for the methods
globalPointToLocal: globalPoint
globalPoint -> globalTransform -> localTransform -> locaPoint
localPointToGlobal: localPoint
localPoint -> localTransform -> globalTransform -> globalPoint
globalBoundsToLocal:
Transform aRectangle from global coordinates into local coordinates
globalPointToLocal:
Transform aPoint from global coordinates into local coordinates
globalPointsToLocal:
Transform all the points of inArray from global into local coordinates
initialize
Subclasses should redefine this method to perform initializations on instance creation
inverseTransformation
Return the inverse transformation of the receiver
invertBoundsRect:
Return a rectangle whose coordinates have been transformed
from local back to global coordinates. Since I am the identity matrix
no transformation is made.
isIdentity
Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.
isPureTranslation
Return true if the receiver specifies no rotation or scaling.
localBoundsToGlobal:
Transform aRectangle from local coordinates into global coordinates
localPointToGlobal:
Transform aPoint from local coordinates into global coordinates
localPointsToGlobal:
Transform all the points of inArray from local into global coordinates
new
offset
setIdentity
I *am* the identity transform
sourceQuadFor:
ImageReadWriter
Copyright (c) Kazuki Yasumatsu, 1995. All rights reserved.
I am an abstract class to provide for encoding and/or decoding an image on a stream.
Instance Variables:
stream <ReadStream | WriteStream> stream for image storages
Class Variables:
ImageNotStoredSignal <Signal> image not stored error signal
MagicNumberErrorSignal <Signal> magic number error signal
Subclasses must implement the following messages:
accessing
nextImage
nextPutImage:
testing
canUnderstand (added tao 10/26/97)
allTypicalFileExtensions
atEnd
changePadOfBits:width:height:depth:from:to:
Change padding size of bits.
close
contents
cr
formFromFileNamed:
formFromServerFile:
formFromStream:
hasMagicNumber:
lf
PPM and PBM are used LF as CR.
next
next:
nextImage
Dencoding an image on stream and answer the image.
nextLong
Read a 32-bit quantity from the input stream.
nextLongPut:
Write out a 32-bit integer as 32 bits.
nextPut:
nextPutAll:
nextPutImage:
Encoding anImage on stream.
nextWord
Read a 16-bit quantity from the input stream.
nextWordPut:
Write out a 16-bit integer as 16 bits.
on:
peekFor:
position
position:
putForm:onFileNamed:
putForm:onStream:
size
Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. See Object
documentation whatIsAPrimitive.
skip:
space
tab
typicalFileExtensions
understandsImageFormat
Test to see if the image stream format is understood by this decoder.
This should be implemented in each subclass of ImageReadWriter so that
a proper decoder can be selected without ImageReadWriter having to know
about all possible image file types.
understandsImageFormat:
unpackBits:depthTo8From:with:height:pad:
Unpack bits of depth 1, 2, or 4 image to it of depth 8 image.
InfiniteForm
I represent a Form obtained by replicating a pattern form indefinitely in all directions.
addFillStyleMenuItems:hand:from:
Add the items for changing the current fill style of the receiver
asColor
asForm
bitPatternForDepth:
colorForInsets
computeBoundingBox
Refer to the comment in DisplayObject|computeBoundingBox.
direction
displayOn:at:clippingBox:rule:fillColor:
This is the real display message, but it doesn't get used until the new
display protocol is installed.
displayOnPort:at:
displayOnPort:offsetBy:
this version tries to get the form aligned where the user wants it and not just aligned with the cliprect
dominantColor
fillRectangle:on:
Fill the given rectangle on the given canvas with the receiver.
form
Bitmap fills respond to #form
form:
isBitmapFill
isGradientFill
isOrientedFill
isSolidFill
isTiled
Return true if the receiver should be drawn as a tiled pattern
isTranslucent
Return true since the bitmap may be translucent and we don't really want to check
normal
offset
Refer to the comment in DisplayObject|offset.
origin
origin:
Ignored
raisedColor
with:
JPEGColorComponent
I represent a single component of color in JPEG YCbCr color space. I can accept a list of blocks in my component from the current MCU, then stream the samples from this block for use in color conversion. I also store the running DC sample value for my component, used by the Huffman decoder.
The following layout is fixed for the JPEG primitives to work:
currentX <SmallInteger>
currentY <SmallInteger>
hSampleFactor <SmallInteger>
vSampleFactor <SmallInteger>
mcuBlocks <Array of: <IntegerArray of: DCTSize2 * Integer>>
widthInBlocks <SmallInteger>
heightInBlocks <SmallInteger>
dctSize <SmallInteger>
mcuWidth <SmallInteger>
mcuHeight <SmallInteger>
priorDCValue <SmallInteger>
acTableIndex
acTableIndex:
dcTableIndex
dcTableIndex:
heightInBlocks
heightInBlocks:
id
id:
initializeSampleStreamBlocks:
mcuWidth:mcuHeight:dctSize:
nextSample
priorDCValue:
qTableIndex
qTableIndex:
resetSampleStream
totalMcuBlocks
updateDCValue:
widthInBlocks
widthInBlocks:
JPEGHuffmanTable
I represent the table of values used to decode Huffman entropy-encoded bitstreams. From the JFIF file header entropy values, I build a derived table of codes and values for faster decoding.
bits:
initialize
Subclasses should redefine this method to perform initializations on instance creation
lookahead
lookaheadBits
lookaheadSymbol
makeDerivedTables
maxcode
valueForCode:length:
values:
JPEGReadStream
Encapsulates huffman encoded access to JPEG data.
The following layout is fixed for the JPEG primitives to work:
collection <ByteArray | String>
position <SmallInteger>
readLimit <SmallInteger>
bitBuffer <SmallInteger>
bitsInBuffer <SmallInteger>
buildLookupTable:counts:
createHuffmanTables:counts:from:to:
Create the actual tables
decodeValueFrom:
Decode the next value in the receiver using the given huffman table.
fillBuffer
getBits:
growHuffmanTable:
initialize
Subclasses should redefine this method to perform initializations on instance creation
nextByte
nextBytes:
reset
Set the receiver's position to the beginning of the sequence of objects.
resetBitBuffer
JPEGReadWriter
I am a subclass of ImageReadWriter that understands JFIF file streams, and can decode JPEG images.
This code is based upon the Independent Joint Photographic Experts Group (IJPEG) software, originally written in C by Tom Lane, Philip Gladstone, Luis Ortiz, Jim Boucher, Lee Crocker, Julian Minguillon, George Phillips, Davide Rossi, Ge' Weijers, and other members of the Independent JPEG Group.
colorConvertFloatYCbCrMCU
colorConvertGrayscaleMCU
colorConvertIntYCbCrMCU
colorConvertMCU
dctFloatRangeLimit:
decodeBlockInto:component:dcTable:acTable:
decodeMCU
decompressionTest
Test decompression; don't generate actual image
getBits:
hACTable
hDCTable
idctBlockFloat:component:
idctBlockInt:component:
idctBlockInt:qt:
idctMCU
initialSOSSetup
initialize
Subclasses should redefine this method to perform initializations on instance creation
nextImage
Dencoding an image on stream and answer the image.
nextImageDitheredToDepth:
notSupported:
okToIgnoreMarker:
on:
parseAPPn
parseDecoderRestartInterval
parseFirstMarker
parseHuffmanTable
parseNOP
don't need to do anything, here
parseNextMarker
Parse the next marker of the stream
parseQuantizationTable
parseStartOfFile
parseStartOfInput
parseStartOfScan
perScanSetup
primColorConvertGrayscaleMCU
primColorConvertGrayscaleMCU:bits:residuals:ditherMask:
JPEGReaderPlugin doPrimitive: #primitiveColorConvertGrayscaleMCU.
primColorConvertIntYCbCrMCU
primColorConvertYCbCrMCU:bits:residuals:ditherMask:
primDecodeBlockInto:component:dcTable:acTable:stream:
primIdctBlockInt:component:
primIdctInt:qt:
processRestart
qTable
sampleFloatRangeLimit:
sampleRangeLimit:
scaleAndSignExtend:inFieldWidth:
scaleQuantizationTable:
setStream:
Feed it in from an existing source
skipMarker
typicalFileExtensions
understandsImageFormat
Answer true if the image stream format is understood by this decoder.
understandsImageFormat:
useFloatingPoint
JPEGReadWriter2
I provide fast JPEG compression and decompression. I require the VM pluginJPEGReadWriter2Plugin, which is typically stored in same directory as the Squeak virtual machine.
JPEGReadWriter2Plugin is based on LIBJPEG library. This sentence applies to the plugin:
"This software is based in part on the work of the Independent JPEG Group".
The LIBJPEG license allows it to be used free for any purpose so long as its origin and copyright are acknowledged. You can read more about LIBJPEG and get the complete source code at www.ijg.org.
compress:quality:
Encode the given Form and answer the compressed ByteArray. Quality goes from 0 (low) to 100 (high), where -1 means default.
imageExtent:
Answer the extent of the compressed image encoded in the given ByteArray.
isPluginPresent
nextImage
Decode and answer a Form from my stream.
nextImageSuggestedDepth:
Decode and answer a Form of the given depth from my stream. Close the stream if it is a file stream. Possible depths are 16-bit and 32-bit.
nextPutImage:
Encode the given Form on my stream with default quality.
nextPutImage:quality:progressiveJPEG:
Encode the given Form on my stream with the given settings. Quality goes from 0 (low) to 100 (high), where -1 means default. If progressiveFlag is true, encode as a progressive JPEG.
primImageHeight:
primImageWidth:
primJPEGCompressStructSize
primJPEGDecompressStructSize
primJPEGErrorMgr2StructSize
primJPEGPluginIsPresent
primJPEGReadHeader:fromByteArray:errorMgr:
primJPEGReadImage:fromByteArray:onForm:doDithering:errorMgr:
primJPEGWriteImage:onByteArray:form:quality:progressiveJPEG:errorMgr:
putForm:quality:progressiveJPEG:onFileNamed:
typicalFileExtensions
uncompress:into:
Uncompress an image from the given ByteArray into the given Form.
Fails if the given Form has the wrong dimensions or depth.
If aForm has depth 16, do ordered dithering.
uncompress:into:doDithering:
Uncompress an image from the given ByteArray into the given Form.
Fails if the given Form has the wrong dimensions or depth.
If aForm has depth 16 and ditherFlag = true, do ordered dithering.
understandsImageFormat
Answer true if the image stream format is understood by this decoder.
MacOS9WindowProxy
A MacOS9WindowProxy is xxxxxxxxx.
Instance Variables
windowAttributes: <Object>
windowClass: <Object>
windowAttributes
- xxxxx
windowClass
- xxxxx
altDBoxProc
attributes
return the ByteArray representing the desired window attributes. This is utterly platform dependent and my default is an empty ByteArray to signify a default window
closeBoxAttribute
dBoxProc
defaultWindowType
set up my attributes to be a default window - a titlebar, usual decorations etc
documentProc
documentWindowClass
floatGrowProc
floatProc
floatSideGrowProc
floatSideProc
floatSideZoomGrowProc
floatSideZoomProc
floatZoomGrowProc
floatZoomProc
isActiveHostWindowProxyClass
movableDBoxProc
noAttributes
noGrowDocProc
plainDBox
rDocProc
standardDocumentAttributes
windowAttributes
windowAttributes:
windowClass
windowClass:
zoomDocProc
zoomNoGrow
MacOSXWindowProxy
A MacOSXWindowProxy is xxxxxxxxx.
Instance Variables
windowAttributes: <Object>
windowClass: <Object>
windowAttributes
- xxxxx
windowClass
- xxxxx
activatesAttribute
alertWindowClass
altPlainWindowClass
asyncDragAttribute
attributes
return the ByteArray representing the desired window attributes. This is utterly platform dependent and my default is an empty ByteArray to signify a default window
closeBoxAttribute
collapseBoxAttribute
compositingAttribute
defaultWindowType
set up my attributes to be a default window - a titlebar, usual decorations etc
documentWindowClass
doesNotCycleAttribute
drawerWindowClass
floatingWindowClass
fullZoomAttribute
helpWindowClass
hideOnFullScreenAttribute
hideOnSuspendAttribute
horizontalZoomAttribute
ignoreClicksAttribute
inWindowMenuAttribute
isActiveHostWindowProxyClass
liveResizeAttribute
metalAttribute
modalWindowClass
movableAlertWindowClass
movableModalWindowClass
noAttributes
noConstrainAttribute
noShadowAttribute
noUpdatesAttribute
opaqueForEventsAttribute
overlayWindowClass
plainWindowClass
resizableAttribute
sheetAlertWindowClass
sheetWindowClass
sideTitlebarAttribute
simpleWindowClass
standardDocumentAttributes
standardFloatingAttributes
standardHandlerAttribute
toolbarButtonAttribute
toolbarWindowClass
utilityWindowClass
verticalZoomAttribute
windowAttributes
windowAttributes:
windowClass
windowClass:
MatrixTransform2x3
This class represents a transformation for points, that is a combination of scale, offset, and rotation. It is implemented as a 2x3 matrix containing the transformation from the local coordinate system in the global coordinate system. Thus, transforming points from local to global coordinates is fast and cheap whereas transformations from global to local coordinate systems are relatively expensive.
Implementation Note: It is assumed that the transformation deals with Integer points. All transformations will return Integer coordinates (even though float points may be passed in here).
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
a11
a11:
a12
a12:
a13
a13:
a21
a21:
a22
a22:
a23
a23:
asMatrixTransform2x3
Represent the receiver as a 2x3 matrix transformation
at:
Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive.
at:put:
Primitive. Assumes receiver is indexable. Store the argument value in
the indexable element of the receiver indicated by index. Fail if the
index is not an Integer or is out of bounds. Or fail if the value is not of
the right type for this kind of collection. Answer the value that was
stored. Essential. See Object documentation whatIsAPrimitive.
byteSize
bytesPerBasicElement
Answer the number of bytes that each of my basic elements requires.
In other words:
self basicSize * self bytesPerBasicElement
should equal the space required on disk by my variable sized representation.
bytesPerElement
composedWithLocal:
Return the composition of the receiver and the local transformation passed in
composedWithLocal:into:
Return the composition of the receiver and the local transformation passed in.
Store the composed matrix into result.
globalBounds:toLocal:
Transform aRectangle from global coordinates into local coordinates
globalBoundsToLocal:
Transform aRectangle from global coordinates into local coordinates
globalPointToLocal:
Transform aPoint from global coordinates into local coordinates
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
identity
inverseTransformation
Return the inverse transformation of the receiver.
The inverse transformation is computed by first calculating
the inverse offset and then computing transformations
for the two identity vectors (1@0) and (0@1)
invertPoint:
Transform aPoint from global coordinates into local coordinates
isIdentity
Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.
isMatrixTransform2x3
Return true if the receiver is 2x3 matrix transformation
isPureTranslation
Return true if the receiver specifies no rotation or scaling.
localBounds:toGlobal:
Transform aRectangle from local coordinates into global coordinates
localBoundsToGlobal:
Transform aRectangle from local coordinates into global coordinates
localPointToGlobal:
Transform aPoint from local coordinates into global coordinates
new
newFromStream:
offset
offset:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
restoreEndianness
This word object was just read in from a stream. It was stored in Big Endian (Mac) format. Swap each pair of bytes (16-bit word), if the current machine is Little Endian.
Why is this the right thing to do? We are using memory as a byteStream. High and low bytes are reversed in each 16-bit word, but the stream of words ascends through memory. Different from a Bitmap.
setAngle:
Set the raw rotation angle in the receiver
setIdentiy
Initialize the receiver to the identity transformation (e.g., not affecting points)
setOffset:
Set the raw offset in the receiver
setScale:
Set the raw scale in the receiver
transformDirection:
Transform aPoint from local coordinates into global coordinates
transformFromLocal:toGlobal:
transformPoint:
Transform aPoint from local coordinates into global coordinates
withAngle:
withOffset:
withRotation:
withScale:
writeOn:
MorphicTransform
This class implements simple translation, scaling and rotation for points, as well as inverse transformations. These transformations are used in TransformMorphs (clipping scrollers) and TransformationMorphs (general flex-morph wrappers) to map, eg, global mouse coords into local coords, and to invert, eg, local damage rectangles into global damage rectangles.
angle
asMatrixTransform2x3
Represent the receiver as a 2x3 matrix transformation
asMorphicTransform
composedWith:
Return a new transform that has the effect of transforming points first by the receiver and then by the argument.
composedWithLocal:
Return the composition of the receiver and the local transformation passed in.
A 'local' transformation is defined as a transformation that takes place
between the receiver (the 'global') transformation and any 'local' point
computations, e.g., for the methods
globalPointToLocal: globalPoint
globalPoint -> globalTransform -> localTransform -> locaPoint
localPointToGlobal: localPoint
localPoint -> localTransform -> globalTransform -> globalPoint
globalPointToLocal:
Transform aPoint from global coordinates into local coordinates
identity
inverseTransformation
Return the inverse transformation of the receiver
invert:
Transform the given point from local to global coordinates.
invertBoundsRect:
Return a rectangle whose coordinates have been transformed
from local back to global coordinates. NOTE: if the transformation
is not just a translation, then it will compute the bounding box
in global coordinates.
invertRect:
isIdentity
Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.
isMorphicTransform
Return true if the receiver is a MorphicTransform, that is specifies the transformation values explicitly.
isPureTranslation
Return true if the receiver specifies no rotation or scaling.
localPointToGlobal:
Transform aPoint from global coordinates into local coordinates
new
offset
offset:
offset:angle:scale:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
scale
setAngle:
setIdentiy
setOffset:
setOffset:angle:scale:
setScale:
transform:
Transform the given point from global to local coordinates.
transformBoundsRect:
Return a rectangle whose coordinates have been transformed
from global to local coordinates. NOTE: if the transformation
is not just a translation, then it will compute the bounding box
in global coordinates.
withAngle:
Return a copy of me with a different Angle
withOffset:
Return a copy of me with a different Offset
withScale:
Return a copy of me with a different Scale
PCXReadWriter
A PCXReadWriter is xxxxxxxxx.
Instance Variables
bitsPerPixel: <Object>
colorPalette: <Object>
colorPlanes: <Object>
encoding: <Object>
height: <Object>
isGrayScale: <Object>
rowByteSize: <Object>
version: <Object>
width: <Object>
bitsPerPixel
- xxxxx
colorPalette
- xxxxx
colorPlanes
- xxxxx
encoding
- xxxxx
height
- xxxxx
isGrayScale
- xxxxx
rowByteSize
- xxxxx
version
- xxxxx
width
- xxxxx
nextImage
Read in the next PCX image from the stream.
nextWord
Read a 16-bit quantity from the input stream.
readBody
readHeader
readPalette
typicalFileExtensions
PNGReadWriter
I am a subclass of ImageReadWriter that decodes Portable Network Graphics
(PNG) images.
Submitted by Duane Maxwell
computeSwizzleMapForDepth:
copyPixels:
Handle non-interlaced pixels of supported colorTypes
copyPixels:at:by:
Handle interlaced pixels of supported colorTypes
copyPixelsGray:
Handle non-interlaced grayscale color mode (colorType = 0)
copyPixelsGray:at:by:
Handle interlaced grayscale color mode (colorType = 0)
copyPixelsGrayAlpha:
Handle non-interlaced grayscale with alpha color mode (colorType = 4)
copyPixelsGrayAlpha:at:by:
Handle interlaced grayscale with alpha color mode (colorType = 4)
copyPixelsIndexed:
Handle non-interlaced indexed color mode (colorType = 3)
copyPixelsIndexed:at:by:
Handle interlaced indexed color mode (colorType = 3)
copyPixelsRGB:
Handle non-interlaced RGB color mode (colorType = 2)
copyPixelsRGB:at:by:
Handle interlaced RGB color mode (colorType = 2)
copyPixelsRGBA:
Handle non-interlaced RGBA color modes (colorType = 6)
copyPixelsRGBA:at:by:
Handle interlaced RGBA color modes (colorType = 6)
createAFormFrom:
debugging
debugging:
doPass:
Certain interlace passes are skipped with certain small image
dimensions
filterAverage:
Use the average of the pixel to the left and the pixel above as a predictor
filterHorizontal:
Use the pixel to the left as a predictor
filterNone:
filterPaeth:
Select one of (the pixel to the left, the pixel above and the pixel to above left) to
predict the value of this pixel
filterScanline:count:
filterVertical:
Use the pixel above as a predictor
grayColorsFor:
return a color table for a gray image
initialize
Subclasses should redefine this method to perform initializations on instance creation
nextImage
Dencoding an image on stream and answer the image.
nextPutImage:
Write out the given form. We're keeping it simple here, no interlacing, no filters.
nextPutImage:interlace:filter:
Note: For now we keep it simple - interlace and filtering are simply ignored
paethPredictLeft:above:aboveLeft:
Predicts the value of a pixel based on nearby pixels, based on
Paeth (GG II, 1991)
processBackgroundChunk
Transcript show: ' BACKGROUND: ',chunk printString.
processIDATChunk
processIHDRChunk
processInterlaced
processNextChunk
processNonInterlaced
processPLTEChunk
processPhysicalPixelChunk
Transcript show: ' PHYSICAL: ',chunk printString.
processSBITChunk
processTransparencyChunk
Transcript show: ' TRANSPARENCY ',chunk printString.
rgbaDecoderMapForDepth:
typicalFileExtensions
understandsImageFormat
Test to see if the image stream format is understood by this decoder.
This should be implemented in each subclass of ImageReadWriter so that
a proper decoder can be selected without ImageReadWriter having to know
about all possible image file types.
updateCrc:from:to:in:
writeChunk:
writeFileSignature
writeIDATChunkOn:
Write the IDAT chunk
writeIENDChunkOn:
Write the IEND chunk
writeIHDRChunkOn:
Write the IHDR chunk
writePLTEChunkOn:
Write the PLTE chunk
writeSBITChunkOn:
Write the IDAT chunk
writeTRNSChunkOn:
Write out tRNS chunk
writeType3DataOn:
Write color indexed data.
writeType6DataOn:
Write RGBA data.
PNMReadWriter
I am a subclass of ImageReadWriter that decodes portable anymap file formats
(pbm, pgm, ppm and pam) images.
I accept the #origin pragma for SE files as described in:
Algoritms For Image Processing And Computer Vision. J. R. Parker
Don't work with 2 bytes samples (16 bit grays, > 32 bits color, etc...),
pam files preliminary support.
f _ ImageReadWriter formFromFileNamed: 'Tools:Squeak3.4:Carmen.ppm'.
f morphEdit
Submitted by Javier Diaz Reinoso, Oct/2003
cleanLine
upTo LF or CR, tab as space
getTokenPbm:
get a number, return rest of collection
nextImage
read one image
nextPutBW:reverse:
nextPutGray:
nextPutImage:
Encoding anImage on stream.
nextPutRGB:
origin
pbmGetLine
Get the next non-comment line from the PBM stream
Look for 'pragmas' - commands hidden in the comments
pbmParam:
Look for a parameter hidden in a comment
pragma:
r:g:b:for:
integer value according depth
readBWreverse:
B&W for PAM
readData
generic data
readGray
gray form
readHeader
read header for pbm, pgm or ppm
readHeaderPAM
read pam header, not tested
readPlainBW
plain BW
readPlainGray
plain gray
readPlainRGB
RGB form, use 32 bits
readRGB
RGB form, use 16/32 bits
stream:
testToSEFile:
tupleType
typicalFileExtensions
understandsImageFormat
P1 to P7
writeHeader:
this is ascii
Pen
My instances can scribble on the screen or some other Form, drawing and printing at any angle. Since I am a BitBlt, the drawing can be done with an arbitary source Form.
arrowHead
Put an arrowhead on the previous pen stroke
arrowHeadForArrowSpec:
Put an arrowhead on the previous pen stroke
arrowHeadFrom:to:arrowSpec:
Put an arrowhead on the pen stroke from oldPt to newPt
color:
Set the pen to the given color or to a color chosen from a fixed set of colors.
defaultNib:
Nib is the tip of a pen. This sets up the pen, with a nib of width widthInteger. You can also set the shape of the pen nib using:
roundNib: widthInteger, or
squareNib: widthInteger, or
sourceForm: aForm
direction
Answer the receiver's current direction. 0 is towards the top of the
screen.
down
Set the state of the receiver's pen to down (drawing).
dragon:
Display restoreAfter: [Display fillWhite. Pen new dragon: 10].
example
feltTip:cellSize:
filberts:side:
Display restoreAfter: [Pen new filberts: 4 side: 5]
fill:color:
go:
Move the pen in its current direction a number of bits equal to the
argument, distance. If the pen is down, a line will be drawn using the
receiver's form source as the shape of the drawing brush.
goto:
Move the receiver to position aPoint. If the pen is down, a line will be
drawn from the current position to the new one using the receiver's
form source as the shape of the drawing brush. The receiver's set
direction does not change.
hilbert:side:
Draw an nth level Hilbert curve with side length s in the center of the
screen. Write directly into the display's bitmap only. A Hilbert curve is
a space-filling curve.
hilberts:
Display restoreAfter: [Display fillWhite. Pen new hilberts: 5]
home
Place the receiver at the center of its frame.
inkBrush
location
Answer where the receiver is currently located.
location:direction:penDown:
mandala:
Display restoreAfter: [Pen new mandala: 30]
new
newOnForm:
north
Set the receiver's direction to facing toward the top of the display screen.
place:
Set the receiver at position aPoint. No lines are drawn.
print:withFont:
Print the given string in the given font at the current heading
putDotOfDiameter:at:
Put a dot of the given size at the given point, using my colot
roundNib:
Makes this pen draw with a round dot of the given diameter.
simplePressurePen
sourceForm:
Set the receiver's source form to be the argument, aForm.
spiral:angle:
Draw a double squiral (see Papert, MindStorms), where each design is made
by moving the receiver a distance of n after turning the amount + or -a.
squareNib:
Makes this pen draw with a square nib of the given width.
tabletScaleFactor
testMouseTracking
testTabletTracking
turn:
Change the direction that the receiver faces by an amount equal to the
argument, degrees.
up
Set the state of the receiver's pen to up (no drawing).
web
Display restoreAfter: [Pen new web]
PenPointRecorder
This class is a special kind of Pen that instead of actually drawing lines records the destination points for those lines. These points can later be accessed through my accessing method #points.
This can be useful when determining the boundaries of a drawing session.
Example:
| pen |
pen _ PenPointRecorder new.
pen up; goto: 100@100; down; goto: 120@120.
Transcript cr;
show: 'Bounding box for drawing: ';
show: (Rectangle encompassing: pen points)
Implementation note: Shouldn't we override #drawFrom:to:withFirstPoint: instead, and what about #drawLoopX:Y:? Aren't we missing those calls?
drawFrom:to:
Overridden to skip drawing but track bounds of the region traversed.
points
Point
I represent an x-y pair of numbers usually designating a location on the screen.
*
Answer a Point that is the product of the receiver and arg.
+
Answer a Point that is the sum of the receiver and arg.
-
Answer a Point that is the difference of the receiver and arg.
/
Answer a Point that is the quotient of the receiver and arg.
//
Answer a Point that is the quotient of the receiver and arg.
<
Answer whether the receiver is above and to the left of aPoint.
<=
Answer whether the receiver is neither below nor to the right of aPoint.
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
>
Answer whether the receiver is below and to the right of aPoint.
>=
Answer whether the receiver is neither above nor to the left of aPoint.
\\
Answer a Point that is the mod of the receiver and arg.
abs
Answer a Point whose x and y are the absolute values of the receiver's x
and y.
adaptToCollection:andSend:
If I am involved in arithmetic with a Collection, return a Collection of
the results of each element combined with me in that expression.
adaptToNumber:andSend:
If I am involved in arithmetic with an Integer, convert it to a Point.
adaptToString:andSend:
If I am involved in arithmetic with a String, convert it to a Number.
adhereTo:
If the receiver lies outside aRectangle, return the nearest point on the boundary of the rectangle, otherwise return self.
angle
Answer the angle in radians between the vectors represented by
the receiver and (1, 0) from the origin.
angleWith:
Answer the angle in radians between the vectors represented by
the receiver and aPoint from the origin.
asFloatPoint
asIntegerPoint
asNonFractionalPoint
asPoint
Answer the receiver itself.
basicType
Answer a symbol representing the inherent type of the receiver
bearingToPoint:
Return the bearing, in degrees, from the receiver to anotherPoint.
Adapted from Playground, where the ultimate provenance of the algorithm was a wild earlier method of Jay Fenton's which I never checked carefully, but the thing has always seemed to work
bitShiftPoint:
ceiling
Answer a Point that is the receiver's x and y ceiling. Answer the receiver if its coordinates are already integral.
corner:
Answer a Rectangle whose origin is the receiver and whose corner is
aPoint. This is one of the infix ways of expressing the creation of a
rectangle.
crossProduct:
Answer a number that is the cross product of the receiver and the
argument, aPoint.
deepCopy
Implemented here for better performance.
degrees
Answer the angle the receiver makes with origin in degrees. right is 0; down is 90.
directionToLineFrom:to:
Answer the direction of the line from the receiver
position.
< 0 => left (receiver to right)
= => on line
> 0 => right (receiver to left).
dist:
Answer the distance between aPoint and the receiver.
dotProduct:
Answer a number that is the dot product of the receiver and the
argument, aPoint. That is, the two points are multipled and the
coordinates of the result summed.
eightNeighbors
extent:
Answer a Rectangle whose origin is the receiver and whose extent is
aPoint. This is one of the infix ways of expressing the creation of a
rectangle.
flipBy:centerAt:
Answer a Point which is flipped according to the direction about the point c.
Direction must be #vertical or #horizontal.
floor
Answer a Point that is the receiver's x and y floor. Answer the receiver if its coordinates are already integral.
fourNeighbors
fromUser
fromUserWithCursor:
grid:
Answer a Point to the nearest rounded grid modules specified by aPoint.
guarded
Return a positive nonzero extent.
hash
Hash is reimplemented because = is implemented.
insideTriangle:with:with:
Return true if the receiver is within the triangle defined by the three coordinates.
Note: This method computes the barycentric coordinates for the receiver and tests those coordinates.
interpolateTo:at:
Interpolate between the instance and end after the specified amount has been done (0 - 1).
isInsideCircle:with:with:
Returns TRUE if self is inside the circle defined by the
points a, b, c. See Guibas and Stolfi (1985) p.107
isIntegerPoint
isPoint
Overridden to return true in Point.
isSelfEvaluating
isZero
javascriptOn:
max
Answer a number that is the maximum
of the x and y of the receiver.
max:
Answer the lower right corner of the rectangle uniquely defined by the
receiver and the argument, aPoint.
min
Answer a number that is the minimum
of the x and y of the receiver.
min:
Answer the upper left corner of the rectangle uniquely defined by the
receiver and the argument, aPoint.
min:max:
nearestPointAlongLineFrom:to:
Note this will give points beyond the endpoints.
Streamlined by Gerardo Richarte 11/3/97
nearestPointOnLineFrom:to:
This will not give points beyond the endpoints
negated
Answer a point whose x and y coordinates are the negatives of those of the receiver. 6/6/96 sw
normal
Answer a Point representing the unit vector rotated 90 deg clockwise.
normalized
Optimized for speed -- ar 8/26/2001
octantOf:
Return 1..8 indicating relative direction to otherPoint.
1=ESE, 2=SSE, ... etc. clockwise to 8=ENE
onLineFrom:to:
onLineFrom:to:within:
Answer true if the receiver lies on the given line segment between p1 and p2 within a small epsilon.
printOn:
The receiver prints on aStream in terms of infix notation.
quadrantOf:
Return 1..4 indicating relative direction to otherPoint.
1 is downRight, 2=downLeft, 3=upLeft, 4=upRight
r
Answer the receiver's radius in polar coordinate system.
r:degrees:
reciprocal
Answer a Point with coordinates that are the reciprocals of mine.
rect:
Answer a Rectangle that encompasses the receiver and aPoint.
This is the most general infix way to create a rectangle.
reflectedAbout:
Answer a new point that is the reflection of the receiver about the given point.
rotateBy:about:
Even though Point.theta is measured CW, this rotates with the more conventional CCW interpretateion of angle.
rotateBy:centerAt:
Answer a Point which is rotated according to direction, about the point c.
Direction must be one of #right (CW), #left (CCW) or #pi (180 degrees).
roundDownTo:
Answer a Point that is the receiver's x and y rounded to grid x and
grid y by lower value (toward negative infinity).
roundTo:
Answer a Point that is the receiver's x and y rounded to grid x and
grid y.
roundUpTo:
Answer a Point that is the receiver's x and y rounded to grid x and
grid y by upper value (toward infinity).
rounded
Answer a Point that is the receiver's x and y rounded. Answer the receiver if its coordinates are already integral.
scaleBy:
Answer a Point scaled by factor (an instance of Point).
scaleFrom:to:
Produce a point stretched according to the stretch from rect1 to rect2
scaleTo:
Return a Point scalefactor for shrinking a thumbnail of the receiver's extent to fit within anExtent
setR:degrees:
setX:setY:
sideOf:
Returns #left, #right or #center if the otherPoint lies to the left, right
or on the line given by the vector from 0@0 to self
sortsBefore:
Return true if the receiver sorts before the other point
squaredDistanceTo:
Answer the distance between aPoint and the receiver.
storeOn:
x@y printed form is good for storing too
theta
Answer the angle the receiver makes with origin in radians. right is 0;
down is 90.
Corrected the constants from single precision to 64 Bit precision
and changed the sends in case of overflow to constants HK 2005-07-23
to:intersects:to:
Returns true if the linesegment from start1 (=self) to end1 intersects
with the segment from start2 to end2, otherwise false.
to:sideOf:
Returns #left, #right, #center if the otherPoint lies to the left, right or on the line given by the vector from self to end
translateBy:
Answer a Point translated by delta (an instance of Point).
transposed
triangleArea:with:
Returns twice the area of the oriented triangle (a, b, c), i.e., the
area is positive if the triangle is oriented counterclockwise
truncateTo:
Answer a Point that is the receiver's x and y truncated to grid x and
grid y.
truncated
Answer a Point whose x and y coordinates are integers. Answer the receiver if its coordinates are already integral.
veryDeepCopyWith:
Return self. I am immutable in the Morphic world. Do not record me.
x
Answer the x coordinate.
x:y:
y
Answer the y coordinate.
Quadrangle
I represent a particular kind of Rectangle that has a border and inside color.
align:with:
Answer a new Quadrangle translated by aPoint2 - aPoint1.
5/24/96 sw: removed hard-coded class name so subclasses can gain same functionality.
alignedTo:
Return a copy with offset according to alignPointSelector which is one of...
#(topLeft, topCenter, topRight, leftCenter, center, etc)
5/24/96 sw: removed hard-coded class name so subclasses can gain same functionality.
borderColor
Answer the form that is the borderColor of the receiver.
borderColor:
Set the borderColor of the receiver to aColor, a Form.
borderWidth
Answer the borderWidth of the receiver.
borderWidth:
Set the borderWidth of the receiver to anInteger.
borderWidthLeft:right:top:bottom:
Set the border width of the receiver to a Rectangle that represents the
left, right, top, and bottom border widths.
display
Display the border and insideRegion of the receiver on the Display.
displayAlign:with:clippingBox:
Display the border and region of the receiver on the Display so that its
position at aPoint1 is aligned with position aPoint2. The displayed
information should be clipped so that only information with the area
determined by aRectangle is displayed.
displayOn:
Display the border and insideRegion of the receiver.
displayOn:align:with:clippingBox:
Display the border and region of the receiver so that its position at
aPoint1 is aligned with position aPoint2. The displayed information
should be clipped so that only information with the area determined by
aRectangle is displayed.
displayOn:transformation:clippingBox:
Display the border and region of the receiver so that it is scaled and
translated with respect to aWindowingTransformation. The displayed
information should be clipped so that only information with the area
determined by aRectangle is displayed.
displayOnPort:at:
Display the border and insideRegion of the receiver.
displayTransformation:clippingBox:
Display the border and region of the receiver on the Display so that it
is scaled and translated with respect to aWindowingTransformation. The
displayed information should be clipped so that only information with
the area determined by aRectangle is displayed.
initialize
Initialize the region to a null Rectangle, the borderWidth to 1, the
borderColor to black, and the insideColor to white.
inside
Answer a Rectangle that is the receiver inset by the borderWidth.
insideColor
Answer the form that is the insideColor of the receiver.
insideColor:
Set the insideColor of the receiver to aColor, a Form.
intersect:
Answer a new Quadrangle whose region is the intersection of the
receiver's area and aRectangle.
5/24/96 sw: removed hard-coded class name so subclasses can gain same functionality.
origin:corner:
region
Answer a Rectangle that defines the area of the receiver.
region:
Set the rectangular area of the receiver to aRectangle.
region:borderWidth:borderColor:insideColor:
scaleBy:
Answer a new Quadrangle scaled by aPoint.
5/24/96 sw: removed hard-coded class name so subclasses can gain same functionality.
setHeight:
Set the receiver's height
setLeft:
Move the receiver so that its left edge is given by aNumber. An example of a setter to go with #left
setRegion:borderWidth:borderColor:insideColor:
setRight:
Move the receiver so that its right edge is given by aNumber. An example of a setter to go with #right
setWidth:
Set the receiver's width
translateBy:
Answer a new Quadrangle translated by aPoint.
5/24/96 sw: removed hard-coded class name so subclasses can gain same functionality.
Rectangle
I represent a rectangular area of the screen. Arithmetic functions take points as arguments and carry out scaling and translating operations to create new instances of me. Rectangle functions create new instances by determining intersections of rectangles with rectangles.
=
Answer true if the receiver's species, origin and corner match aRectangle's.
aboveCenter
Answer the point slightly above the center of the receiver.
adjustTo:along:
Return a copy adjusted to fit a neighbor that has changed size.
align:with:
Answer a Rectangle that is a translated by aPoint2 - aPoint1.
allAreasOutsideList:do:
Enumerate aBlock with all areas of the receiver not overlapping
any rectangle in the given collection
allAreasOutsideList:startingAt:do:
Enumerate aBlock with all areas of the receiver not overlapping
any rectangle in the given collection
amountToTranslateWithin:
Answer a Point, delta, such that self + delta is forced within aRectangle.
area
Answer the receiver's area, the product of width and height.
areasOutside:
Answer an Array of Rectangles comprising the parts of the receiver not
intersecting aRectangle.
bordersOn:along:
bottom
Answer the position of the receiver's bottom horizontal line.
bottom:
bottomCenter
Answer the point at the center of the bottom horizontal line of the
receiver.
bottomLeft
Answer the point at the left edge of the bottom horizontal line of the
receiver.
bottomRight
Answer the point at the right edge of the bottom horizontal line of the
receiver.
boundingBox
ceiling
Answer the integer rectange to the bottom right of receiver.
Return reciever if it already and integerRectange.
center
Answer the point at the center of the receiver.
center:extent:
centeredBeneath:
Move the reciever so that its top center point coincides with the bottom center point of aRectangle. 5/20/96 sw:
compressTo:
Answer a Rectangle whose origin and corner are rounded to grid x and grid y.
Rounding is done by upper value on origin and lower value on corner so that
rounded rectangle is inside self.
compressed
Answer a Rectangle whose origin and corner are rounded to integers.
Rounding is done by upper value on origin and lower value on corner so that
rounded rectangle is inside self.
containsPoint:
Answer whether aPoint is within the receiver.
containsRect:
Answer whether aRect is within the receiver (OK to coincide).
corner
Answer the point at the bottom right corner of the receiver.
corners
Return an array of corner points in the order of a quadrilateral spec for WarpBlt.
deltaToEnsureInOrCentered:extra:
encompass:
Answer a Rectangle that contains both the receiver and aPoint. 5/30/96 sw
encompassing:
expandBy:
Answer a Rectangle that is outset from the receiver by delta. delta is a
Rectangle, Point, or scalar.
expandTo:
Answer a Rectangle whose origin and corner are rounded to grid x and grid y.
Rounding is done by upper value on origin and lower value on corner so that
self is inside rounded rectangle.
expanded
Answer a Rectangle whose origin and corner are rounded to integers.
Rounding is done by upper value on origin and lower value on corner so that
self is inside rounded rectangle.
extendBy:
Answer a Rectangle with the same origin as the receiver, but whose corner is offset by delta. delta is a
Rectangle, Point, or scalar.
extent
Answer with a rectangle with origin 0@0 and corner the receiver's
width @ the receiver's height.
flipBy:centerAt:
Return a copy flipped #vertical or #horizontal, about aPoint.
floor
Answer the integer rectange to the topleft of receiver.
Return reciever if it already and integerRectange.
forPoint:closestSideDistLen:
Evaluate the block with my side (symbol) closest to aPoint,
the approx distance of aPoint from that side, and
the length of the side (or 0 if aPoint is beyond the side)
fromUser
fromUser:
hasPositiveExtent
hash
Hash is reimplemented because = is implemented.
height
Answer the height of the receiver.
innerCorners
Return an array of inner corner points,
ie, the most extreme pixels included,
in the order of a quadrilateral spec for WarpBlt
insetBy:
Answer a Rectangle that is inset from the receiver by delta. delta is a
Rectangle, Point, or scalar.
insetOriginBy:cornerBy:
Answer a Rectangle that is inset from the receiver by a given amount in
the origin and corner.
interpolateTo:at:
Interpolate between the instance and end after the specified amount has been done (0 - 1).
intersect:
Answer a Rectangle that is the area in which the receiver overlaps with
aRectangle. Optimized for speed; old code read:
^Rectangle
origin: (origin max: aRectangle origin)
corner: (corner min: aRectangle corner)
intersects:
Answer whether aRectangle intersects the receiver anywhere.
isIntegerRectangle
Answer true if all component of receiver are integral.
isRectangle
isSelfEvaluating
isTall
isWide
isZero
left
Answer the position of the receiver's left vertical line.
left:
left:right:top:bottom:
leftCenter
Answer the point at the center of the receiver's left vertical line.
merge:
Answer a Rectangle that contains both the receiver and aRectangle.
merging:
newRectButtonPressedDo:
Track the outline of a new rectangle until mouse button
changes. newFrameBlock produces each new rectangle from the
previous. Only tracks while mouse is down.
newRectFrom:
Track the outline of a new rectangle until mouse button changes.
newFrameBlock produces each new rectangle from the previous
origin
Answer the point at the top left corner of the receiver.
origin:corner:
origin:extent:
originFromUser:
originFromUser:grid:
outsetBy:
Answer a Rectangle that is outset from the receiver by delta. delta is a
Rectangle, Point, or scalar.
pointAtSideOrCorner:
Answer the point represented by the given location.
pointNearestTo:
Return the point on my border closest to aPoint
printOn:
Refer to the comment in Object|printOn:.
propertyListOn:
{x=a; y=b; width=c; height=d}
quickMerge:
Answer the receiver if it encloses the given rectangle or the merge of the two rectangles if it doesn't. THis method is an optimization to reduce extra rectangle creations.
quickMergePoint:
Answer the receiver if it encloses the given point or the expansion of the
receiver to do so if it doesn't.
rectanglesAt:height:
right
Answer the position of the receiver's right vertical line.
right:
rightCenter
Answer the point at the center of the receiver's right vertical line.
rotateBy:centerAt:
Return a copy rotated #right, #left, or #pi about aPoint
roundTo:
Answer a Rectangle whose origin and corner are rounded to grid x and grid y.
rounded
Answer a Rectangle whose origin and corner are rounded.
scaleBy:
Answer a Rectangle scaled by scale, a Point or a scalar.
scaleFrom:to:
Produce a rectangle stretched according to the stretch from rect1 to rect2
scaledAndCenteredIn:
Answer a new rectangle that fits into aRectangle and is centered
but with the same aspect ratio as the receiver.
setOrigin:corner:
sideNearestTo:
squishedWithin:
Return an adjustment of the receiver that fits within aRectangle by reducing its size, not by changing its origin.
storeOn:
printed form is good for storing too
top
Answer the position of the receiver's top horizontal line.
top:
topCenter
Answer the point at the center of the receiver's top horizontal line.
topLeft
Answer the point at the top left corner of the receiver's top horizontal line.
topRight
Answer the point at the top right corner of the receiver's top horizontal
line.
translateBy:
Answer a Rectangle translated by factor, a Point or a scalar.
translatedAndSquishedToBeWithin:
Return an adjustment of the receiver that fits within aRectangle by
- translating it to be within aRectangle if necessary, then
- reducing its size, if necessary
translatedToBeWithin:
Answer a copy of the receiver that does not extend beyond aRectangle. 7/8/96 sw
truncateTo:
Answer a Rectangle whose origin and corner are truncated to grid x and grid y.
truncated
Answer a Rectangle whose origin and corner have any fractional parts removed. Answer the receiver if its coordinates are already integral.
width
Answer the width of the receiver.
withBottom:
Return a copy of me with a different bottom y
withHeight:
Return a copy of me with a different height
withLeft:
Return a copy of me with a different left x
withRight:
Return a copy of me with a different right x
withSide:setTo:
return a copy with side set to value
withSideOrCorner:setToPoint:
Return a copy with side set to newPoint
withSideOrCorner:setToPoint:minExtent:
Return a copy with side set to newPoint
withSideOrCorner:setToPoint:minExtent:limit:
Return a copy with side set to newPoint
withTop:
Return a copy of me with a different top y
withWidth:
Return a copy of me with a different width
SegmentScanner
A SegmentScanner is xxxxxxxxx.
Instance Variables
setFont
Set the font and other emphasis.
StaticForm
An optimization for Nebraska - a StaticForm does not change once created so it may be cached on the remote end.
isStatic
StrikeFont
I represent a compact encoding of a set of Forms corresponding to characters in the ASCII character set. All the forms are placed side by side in a large form whose height is the font height, and whose width is the sum of all the character widths. The xTable variable gives the left-x coordinates of the subforms corresponding to the glyphs. Characters are mapped to glyphs by using the characterToGyphMap.
Subclasses can have non-trivial mapping rules as well as different representations for glyphs sizes (e.g., not using an xTable). If so, these classes should return nil when queried for xTable and/or the characterToGlyphMap. This will cause the CharacterScanner primitive to fail and query the font for the width of a character (so that a more programatical approach can be implemented).
For display, fonts need to implement two messages:
#installOn: aDisplayContext foregroundColor: foregroundColor backgroundColor: backgroundColor
This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of it's subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
#displayString: aString on: aDisplayContext from: startIndex to: stopIndex at: aPoint kern: kernDelta
This method is called for each subsequent run of characters in aString which is to be displayed with the (previously installed) settings.
aComment
To read Mac font resources.
1) Use ResEdit in the Fonts folder in the System Folder. Open the file of the Font you want. (A screen font, not a TrueType outline font).
2) Open the FOND resource and scroll down to the list of sizes and resource numbers. Note the resource number of the size you want.
3) Open the NFNT resource. Click on the number you have noted.
4) Choose 'Open Using Hex Editor' from the resource editor.
5) Copy all of the hex numbers and paste into a text editor. Save the file into the Smalltalk folder under the name 'FontName 12 hex' (or other size).
6) Enter the fileName below and execute:
TextStyle default fontAt: 8 put: (StrikeFont new readMacFontHex: 'fileName').
Select text and type Command-7 to change it to your new font.
(There is some problem in the ParagraphEditor with the large size of Cairo 18. Its line heights are not the right.)
actualFamilyNames
alter:formBlock:
ascent
Answer the receiver's maximum extent of characters above the baseline.
ascentKern
Return the kern delta for ascenders.
ascentOf:
baseKern
Return the base kern value to be used for all characters.
bonk:with:
Bonking means to run through the glyphs clearing out black pixels
between characters to prevent them from straying into an adjacent
character as a result of, eg, bolding or italicizing
buildFromForm:data:name:
buildfontNamed:fromForms:startingAtAscii:ascent:descent:maxWid:
This builds a StrikeFont instance from existing forms.
characterForm:pixelValueAt:put:
characterFormAt:
Answer a Form copied out of the glyphs for the argument, character.
characterFormAt:put:
Copy characterForm over the glyph for the argument, character.
characterFormAtMulti:
Answer a Form copied out of the glyphs for the argument, character.
characterToGlyphMap
Return the character to glyph mapping table. If the table is not provided the character scanner will query the font directly for the width of each individual character.
characterToGlyphMap:
characters:in:displayAt:clippedBy:rule:fillColor:kernDelta:on:
Simple, slow, primitive method for displaying a line of characters.
No wrap-around is provided.
checkCharacter:
Answer a Character that is within the ascii range of the receiver--either
character or the last character in the receiver.
convertFontsNamed:
createCharacterToGlyphMap
Private. Create the character to glyph mapping for a font that didn't have any before. This is basically equivalent to what the former setStopCondition did, only based on indexes.
createDejaVu:
deepCopy
there is a circular reference from the derivative fonts back to the receiver. It is therefore not possible to make a deep copy. We make a sahllow copy. The method postCopy can be used to modify the shallow copy.
dejaVuSansBold12Data
dejaVuSansBold12Form
dejaVuSansBold7Data
dejaVuSansBold7Form
dejaVuSansBold9Data
dejaVuSansBold9Form
dejaVuSansBoldOblique12Data
dejaVuSansBoldOblique12Form
dejaVuSansBoldOblique7Data
dejaVuSansBoldOblique7Form
dejaVuSansBoldOblique9Data
dejaVuSansBoldOblique9Form
dejaVuSansBook12Data
dejaVuSansBook12Form
dejaVuSansBook7Data
dejaVuSansBook7Form
dejaVuSansBook9Data
dejaVuSansBook9Form
dejaVuSansOblique12Data
dejaVuSansOblique12Form
dejaVuSansOblique7Data
dejaVuSansOblique7Form
dejaVuSansOblique9Data
dejaVuSansOblique9Form
derivativeFont:at:
derivativeFonts
descent
Answer the receiver's maximum extent of characters below the baseline.
descentKern
Return the kern delta for descenders.
descentOf:
displayChar:form:
Convenience utility used during conversion of BitFont files
displayLine:at:
Display the characters in aString, starting at position aPoint.
displayMultiString:on:from:to:at:kern:baselineY:
displayString:on:from:to:at:kern:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) BitBlt.
displayString:on:from:to:at:kern:baselineY:
Draw the given string from startIndex to stopIndex
at aPoint on the (already prepared) BitBlt.
displayStringR2L:on:from:to:at:kern:
You are screwed if you reach this method.
emphasis
Answer the integer code for synthetic bold, italic, underline, and
strike-out.
emphasis:
Set the integer code for synthetic bold, itallic, underline, and strike-out,
where bold=1, italic=2, underlined=4, and struck out=8.
emphasized:
Answer a copy of the receiver with emphasis set to include code.
ensureCleanBold
This ensures that all character glyphs have at least one pixel of white space on the right
so as not to cause artifacts in neighboring characters in bold or italic.
example
extendMaxAsciiTo:
Extend the range of this font so that it can display glyphs up to newMax.
fallbackFont
fallbackFont:
familyName
Answer the name to be used as a key in the TextConstants dictionary.
familyName:pointSize:
familyName:pointSize:emphasized:
familyName:size:
familyName:size:emphasized:
familyNames
familySizeFace
Answer an array with familyName, a String, pointSize, an Integer, and
faceCode, an Integer.
fillZeroWidthSlots
Note: this is slow because it copies the font once for every replacement.
fixAscent:andDescent:head:
(a + d) = (ascent + descent) ifTrue: [
fixForISO8859From:
fixKerning:
Insert one pixel (extraWidth) between each character. And add the bits for the space character
fixOneWideChars
This fixes all 1-wide characters to be 2 wide with blank on the right
so as not to cause artifacts in neighboring characters in bold or italic.
fixXTable
fontDisplay
TextStyle default defaultFont fontDisplay.
fontNameWithPointSize
fromHostFont:size:flags:weight:
fromStrike:
fromUser
fromUser:
fromUser:allowKeyboard:
glyphInfoOf:into:
Answer the width of the argument as a character in the receiver.
glyphOf:
Answer the width of the argument as a character in the receiver.
glyphs
Answer a Form containing the bits representing the characters of the
receiver.
hasGlyphOf:
height
Answer the height of the receiver, total of maximum extents of
characters above and below the baseline.
heightOf:
hostFontFromUser
installDejaVu
installOn:
installOn:foregroundColor:backgroundColor:
Install the receiver on the given DisplayContext (either BitBlt or Canvas) for further drawing operations.
isSynthetic
isSynthetic:
isSyntheticItalic
isSyntheticItalic:
leftAndRighOrNilFor:
limitTo16Bits
lineGrid
Answer the relative space between lines
listFont:
listFontNames
localeChanged
makeAssignArrow
Replace the underline character with an arrow for this font
makeBoldGlyphs
Make a bold set of glyphs with same widths by ORing 1 bit to the right
(requires at least 1 pixel of intercharacter space)
makeCarriageReturnsWhite
Some larger fonts have a gray carriage return (from the zero wide fixup) make it white so it doesn't show
makeCondensedGlyphs
Make a condensed set of glyphs with same widths.
NOTE: this has been superceded by kerning -- should not get called
makeControlCharsVisible
makeItalicGlyphs
Make an italic set of glyphs with same widths by skewing left and right.
In the process, characters would overlap, so we widen them all first.
makeLfInvisible
makeLfVisible
makeReturnArrow
Replace the caret character with an arrow
makeStruckOutGlyphs
Make a struck-out set of glyphs with same widths
makeTabInvisible
makeTabVisible
makeUnderlinedGlyphs
Make an underlined set of glyphs with same widths
maxAscii
Answer the integer that is the last Ascii character value of the receiver.
maxWidth
Answer the integer that is the width of the receiver's widest character.
minAscii
Answer the integer that is the first Ascii character value of the receiver.
name
Answer the receiver's name.
name:
Set the receiver's name.
newForJapaneseFromEFontBDFFile:name:overrideWith:
newForKoreanFromEFontBDFFile:name:overrideWith:
newFromBDFFile:name:
newFromEFontBDFFile:name:ranges:
newFromEFontBDFFile:name:startRange:endRange:
newFromF12File:
newFromStrike:
Build an instance from the strike font file name. The '.strike' extension
is optional.
objectForDataStream:
I am about to be written on an object file. Write a reference to a known Font in the other system instead.
passwordFontSize:
pointSize
pointSize:
postCopy
the receiver is a just created shallow copy. This method gives it the final touch.
primitiveCreateFont:size:flags:weight:
primitiveDestroyFont:
primitiveFont:glyphOfChar:into:
primitiveFont:widthOfChar:
primitiveFontAscent:
primitiveFontDescent:
primitiveFontEncoding:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
raster
Answer an integer that specifies the layout of the glyphs' form.
readBDFFromFile:name:
This builds a StrikeFont instance by reading the X11 Binary
Distribution Format font source file. See the BDFFontReader class
comment.
readBFHeaderFrom:
readCharacter:from:
readEFontBDFForJapaneseFromFile:name:overrideWith:
readEFontBDFForKoreanFromFile:name:overrideWith:
readEFontBDFFromFile:name:rangeFrom:to:
readEFontBDFFromFile:name:ranges:
readF12FromStream:
readFromBitFont:
This builds a StrikeFont instance by reading the data file format
produced by BitFont, a widely available font conversion utility
written by Peter DiCamillo at Brown University
readFromStrike2:
StrikeFont new readFromStrike2: 'Palatino14.sf2'
readFromStrike2Stream:
Build an instance from the supplied binary stream on data in strike2 format
readMacFontHex:
Read the hex version of a Mac FONT type resource. See the method aComment for how to prepare the input file. 4/26/96 tk
readStrikeFont2Family:
readStrikeFont2Family:fromDirectory:
releaseCachedState
reset
Reset the cache of derivative emphasized fonts
restOfLine:from:
Utility method to assist reading of BitFont data files
saveSpace
setGlyphs:
Replace the glyphs form. Used to make a synthetic bold or italic font quickly.
setGlyphsDepthAtMost:
setupDefaultFallbackFont
shutDown
strikeFromHex:width:height:
read in just the raw strike bits from a hex file. No spaces or returns. W is in words (2 bytes), h in pixels.
stripHighGlyphs
Remove glyphs for characters above 128
subscript
Answer an integer that is the further vertical offset relative to the
baseline for positioning characters as subscripts.
superscript
Answer an integer that is the further vertical offset relative to the
baseline for positioning characters as superscripts.
textStyle
useLeftArrow
useUnderscore
useUnderscoreIfOver1bpp
veryDeepCopyWith:
Return self. I am shared. Do not record me.
widen:by:
widthOf:
Answer the width of the argument as a character in the receiver.
widthOfString:from:to:
Measure the length of the given string between start and stop index
writeAsStrike2On:
Write me onto a file in strike2 format.
fileName should be of the form: <family name><pointSize>.sf2
writeAsStrike2named:
Write me onto a file in strike2 format.
fileName should be of the form: <family name><pointSize>.sf2
xTable
Answer an Array of the left x-coordinate of characters in glyphs.
xTable:
xTableFromHex:
TextLineInterval
My instances specify the starting and stopping points in a String of a composed line. The step is always 1.
=
Answer true if the receiver is equivalent to the otherCollection.
First test for identity, then rule out different species and sizes of
collections. As a last resort, examine each element of the receiver
and the otherCollection.
baseline
internalSpaces
Answer the number of spaces in the line.
internalSpaces:
Set the number of spaces in the line to be spacesInteger.
internalSpaces:paddingWidth:
justifiedPadFor:
Compute the width of pad for a given space in a line of justified text.
justifiedPadFor:font:
Compute the width of pad for a given space in a line of justified text.
justifiedTabDeltaFor:
Compute the delta for a tab in a line of justified text, so tab falls
somewhere plausible when line is justified.
lineHeight
lineHeight:baseline:
paddingWidth
Answer the amount of space to be added to the font.
paddingWidth:
Set the amount of space to be added to the font to be padWidthInteger.
slide:
Change the starting and stopping points of the line by delta.
start:stop:internalSpaces:paddingWidth:
stop:
Set the stopping point in the string of the line to be stopInteger.
TextPrinter
A TextPrinter is xxxxxxxxx.
Instance Variables
columns: <Object>
depth: <Object>
docTitle: <Object>
form: <Object>
landscape: <Object>
noFooter: <Object>
noHeader: <Object>
offset: <Object>
paperSize: <Object>
para: <Object>
resolution: <Object>
columns
- xxxxx
depth
- xxxxx
docTitle
- xxxxx
form
- xxxxx
landscape
- xxxxx
noFooter
- xxxxx
noHeader
- xxxxx
offset
- xxxxx
paperSize
- xxxxx
para
- xxxxx
resolution
- xxxxx
bestColor
Set the reproduction quality to true color
blackAndWhite
Set the reproduction quality to black and white
columnRect:
Return a rectangle describing the n-th column
columnSkip
Return the separating space between two columns in inches
columnWidth
columns
columns:
defaultPaperSize
Return the default paper size (inches) for printing
defaultPaperSize:
defaultResolution
Return the default resolution (DPI) for printing
defaultTextPrinter
documentTitle
documentTitle:
flushPage
The current page has been set up. Send it to the printer.
footerHeight
Return the (additional) height of the footer in inches.
footerParagraph
Return a paragraph for the footer
formatColumn:startingWith:
Format a new column starting at the given string index. Return the string index indicating the start of the next column or nil if no more columns need printing.
formatPage:startingWith:
Format a new page starting at the given string index. Return the string index indicating the start of the next page or nil if no more pages need printing.
goodColor
Set the reproduction quality to 8 bit color depth
headerHeight
Return the (additional) height of the header in inches.
headerParagraph
Return a paragraph for the footer
in2mm:
Convert aPoint from millimeters to inches
in2pix:
Convert aPoint from inches to actual pixels
initialize
Subclasses should redefine this method to perform initializations on instance creation
landscape
landscape:
mm2in:
Convert aPoint from millimeters to inches
mm2pix:
Convert aPoint from millimeters to actual pixels
noFooter
noFooter:
Turn off footer printing
noHeader
noHeader:
Turn off header printing
offsetRect
offsetRect:
Set the offset rectangle
paperSize
paperSize10x14
paperSize11x17
paperSize:
paperSizeA3
paperSizeA4
paperSizeA5
paperSizeB4
paperSizeB5
paperSizeCSheet
paperSizeDSheet
paperSizeESheet
paperSizeEnvelope10
paperSizeEnvelope11
paperSizeEnvelope12
paperSizeEnvelope14
paperSizeEnvelope9
paperSizeEnvelopeB4
paperSizeEnvelopeB5
paperSizeEnvelopeB6
paperSizeEnvelopeC3
paperSizeEnvelopeC4
paperSizeEnvelopeC5
paperSizeEnvelopeC6
paperSizeEnvelopeC65
paperSizeFanfoldGerman
paperSizeFanfoldLegalGerman
paperSizeFanfoldUS
paperSizeFolio
paperSizeLegal
paperSizeLetter
paperSizeNote
paperSizeTabloid
pix2in:
Convert aPoint from a pixel value to inches
pix2mm:
Convert aPoint from a pixel value to millimeters
pixelSize
Return the size of the page in pixels
printFooter:
Print the footer for the given page number
printHeader:
Print the header for the given page number
printParagraph
printText:
Print aText
realPaperSize
resolution
resolution:
textArea
textWidth
TextStyle
A textStyle comprises the formatting information for composing and displaying a unit (usually a paragraph) of text. Typically one makes a copy of a master textStyle (such as TextStyle default), and then that copy may get altered in the process of editing. Bad things can happen if you do not copy first.
Each of my instances consists of...
fontArray An array of StrikeFonts
fontFamilySize unused
lineGrid An integer; default line spacing for paragraphs
baseline An integer; default baseline (dist from line top to bottom of an 'a')
alignment An integer; text alignment, see TextStyle alignment:
firstIndent An integer; indent of first line in pixels
restIndent An integer; indent of remaining lines in pixels
rightIndent An integer; indent of right margin rel to section
tabsArray An array of integers giving tab offsets in pixels
marginTabsArray An array of margin tabs
leading An integer giving default vertical line separation
For a concrete example, look at TextStyle default copy inspect
=
Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.
actualTextStyles
addLinedIfTT
addNewFontSize:
Add a font in specified size to the array of fonts.
addNewFontSizeDialog:
This is called from a modal menu and call back the menu with entered argument.
alignment
Answer the code for the current setting of the alignment.
alignment:
Set the current setting of the alignment to be anInteger:
0=left flush, 1=right flush, 2=centered, 3=justified.
alignmentSymbol
Answer the symbol for the current setting of the alignment.
baseline
Answer the distance from the top of the line to the bottom of most of the
characters (by convention, bottom of the letter 'A').
baseline:
Set the distance from the top of the line to the bottom of most of the
characters.
centered
chooseTTCFontSize:
clearIndents
Reset all the margin (index) settings to be 0.
collectionFromCompressedMIMEString:
collectionFromFileNamed:
Read the file. It is an TextStyle whose StrikeFonts are to be added to the system. (Written by fooling SmartRefStream, so it won't write a DiskProxy!) These fonts will be added to the master TextSytle for this font family.
To write out fonts:
| ff | ff _ ReferenceStream fileNamed: 'new fonts'.
TextConstants at: #forceFontWriting put: true.
ff nextPut: (TextConstants at: #AFontName).
'do not mix font families in the TextStyle written out'.
TextConstants at: #forceFontWriting put: false.
ff close.
To read: (TextStyle default collectionFromFileNamed: 'new fonts')
*** Do not remove this method ***
compressedMIMEEncodedStream
Answer a ReadWriteStream with my compressed, stored representation as Base64
consistOnlyOf:
consolidate
If this style includes any fonts that are also in the default style,
then replace them with references to the default ones.
decodeStyleName:
default
defaultFamilyNames
defaultFont
defaultFontIndex
defaultFontIndex:
discardOtherSizes
This method trys to discard the fonts in non-standard size. If the size is still in use, there will be a problem.
emphasisMenuForFont:target:selector:highlight:
firstIndent
Answer the horizontal indenting of the first line of a paragraph in the
style of the receiver.
firstIndent:
Set the horizontal indenting of the first line of a paragraph in the style
of the receiver to be the argument, anInteger.
flushFonts
Clean out the fonts, an aid when snapshotting claims too many are
holding onto Display.
fontArray
Only for writing out fonts, etc. 8/16/96 tk
fontArray:
fontArrayForStyle:
fontAt:
This is private because no object outside TextStyle should depend on the
representation of the font family in fontArray.
fontAt:put:
Automatically grow the array. 8/20/96 tk
fontIndexOf:
fontIndexOfPointSize:
Returns an index in fontArray of the font with pointSize <= desiredPointSize
fontIndexOfSize:
Returns an index in fontArray of the font with height <= desiredHeight
fontMenuForStyle:target:selector:
fontMenuForStyle:target:selector:highlight:
fontNamed:
TextStyle default fontNamed: 'TimesRoman10'
fontNames
TextStyle default fontNames
fontNamesAndSizes
TextStyle default fontNames
fontNamesWithPointSizes
fontOfPointSize:
fontOfSize:
See fontIndexOfSize.
Returns the actual font. Leading not considered.
fontPointSizesFor:
fontSizesFor:
fontWidthsFor:
fonts
Return a collection of fonts contained in this text style
gridForFont:withLead:
Force whole style to suit one of its fonts. Assumes only one font referred
to by runs.
hash
#hash is re-implemented because #= is re-implemented
importFontsFromStyleFiles
initDefaultFontsAndStyle
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeStyleDecoder
isTTCStyle
justified
knownTextStyles
knownTextStylesWithoutDefault
leading
Leading (from typographers historical use of extra lead (type metal))
is the extra spacing above and beyond that needed just to accomodate
the various font heights in the set.
leading:
leftFlush
leftMarginTabAt:
Set the 'nesting' level of left margin indents of the paragraph in the
style of the receiver to be the argument, marginIndex.
lineGrid
Answer the relative space between lines of a paragraph in the style of
the receiver.
lineGrid:
Set the relative space between lines of a paragraph in the style of the
receiver to be the argument, anInteger.
looseFontsFromFamily:
makeArrows
TextStyle default makeArrows.
marginTabAt:side:
The marginTabsArray is an Array of tuples. The Array is indexed
according to the marginIndex, the 'nesting' level of the requestor.
sideIndex is 1 for left, 2 for right.
modalStyleSelectorWithTitle:
named:
new
newFontArray:
Currently there is no supporting protocol for changing these arrays. If an editor wishes to implement margin setting, then a copy of the default should be stored with these instance variables.
, Make size depend on first font.
nextTabXFrom:leftMargin:rightMargin:
Tab stops are distances from the left margin. Set the distance into the
argument, anX, normalized for the paragraph's left margin.
pixelsPerInch
pixelsPerInch:
pixelsToPoints:
pointSizes
pointSizesFor:
pointsToPixels:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
promptForFont:andSendTo:withSelector:
promptForFont:andSendTo:withSelector:highlight:
replaceFontsIn:with:
replaceStyle:with:
restIndent
Answer the indent for all but the first line of a paragraph in the style
of the receiver.
restIndent:
Set the indent for all but the first line of a paragraph in the style of the
receiver to be the argument, anInteger.
rightFlush
rightIndent
Answer the right margin indent for the lines of a paragraph in the style
of the receiver.
rightIndent:
Answer the right margin indent for the lines of a paragraph in the style
of the receiver to be the argument, anInteger.
rightMarginTabAt:
Set the 'nesting' level of right margin indents of the paragraph in the
style of the receiver to be marginIndex.
setDefault:
species
Answer the preferred class for reconstructing the receiver. For example,
collections create new collections whenever enumeration messages such as
collect: or select: are invoked. The new kind of collection is determined by
the species of the original collection. Species and class are not always the
same. For example, the species of Interval is Array.
storeDataOn:
The shared arrays in tabsArray and marginTabsArray are the globals DefaultTabsArray and DefaultMarginTabsArray. DiskProxies will be substituted for these in (Array objectForDataStream:).
styleDecoder
tabWidth
Answer the width of a tab.
veryDeepCopyWith:
All inst vars are meant to be shared
writeSF2FamilyNamed:inDirectory:toChangeSet:
writeStyle:named:toChangeSet:
TranslucentColor
A TranslucentColor behaves just like a normal color, except that it will pack its alpha value into the high byte of a 32-bit pixelValue. This allows creating forms with translucency for use with the alpha blend function of BitBlt. An alpha of zero is transparent, and 1.0 is opaque.
alpha
Return my alpha value, a number between 0.0 and 1.0 where 0.0 is completely transparent and 1.0 is completely opaque.
alpha:
Answer a new Color with the given amount of opacity ('alpha').
asNontranslucentColor
balancedPatternForDepth:
Return an appropriate bit pattern or stipple. This will almost never be meaningful for tranlucentColors, except for the degenerate case of tranparency.
bitPatternForDepth:
Return an appropriate bit pattern or stipple. This will almost never be meaningful for tranlucentColors, except for the degenerate case of tranparency.
hash
Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =
isOpaque
isTranslucent
isTranslucentColor
This means: self isTranslucent, but isTransparent not
isTransparent
pixelValueForDepth:
Return the pixel value for this color at the given depth. Translucency only works in RGB; this color will appear either opaque or transparent at all other depths.
pixelWord32
Returns an integer representing the bits that appear in a single pixel of this color in a Form of depth 32.
Transparency: The pixel value zero is reserved for transparent. For depths greater than 8, black maps to the darkest possible blue.
Just a little quicker if we are dealing with RGBA colors at 32 bit depth.
pixelWordForDepth:
Return the pixel value for this color at the given depth. Translucency only works in RGB; this color will appear either opaque or transparent at all other depths.
privateAlpha
Return my raw alpha value, an integer in the range 0..255. Used for fast equality testing.
scaledPixelValue32
Return the alpha scaled pixel value for depth 32
setRgb:alpha:
Set the state of this translucent color. Alpha is represented internally by an integer in the range 0..255.
storeArrayValuesOn:
storeOn:
Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.
WarpBlt
WarpBlt is a little warp-drive added on to BitBlt. It takes a quadrilateral as its source specification, while its destination is traversed and combined just like any other call to copyBits.
The source quadrilateral is specified as an array of points starting with the corner that wants to end up in the topLeft, and proceding to the successive points that want to follow CCW around the destination rectangle. Note that in specifying a plain old rectangle source, its non topLeft points must be actual pixels, not outside by 1, as with rectangle bottmRight, eg. See the method Rectangle asQuad.
WarpBlt does a fast job of rotation, reflection and scaling, and it can even produce a semblance of perspective. Depth parameters are included for future improvements in this direction. but the primitve does not support this yet.
cellSize
cellSize:
copyQuad:toRect:
current
deltaFrom:to:nSteps:
Utility routine for computing Warp increments.
x1 is starting pixel, x2 is ending pixel; assumes n >= 1
mixPix:sourceMap:destMap:
Average the pixels in array pix to produce a destination pixel.
First average the RGB values either from the pixels directly,
or as supplied in the sourceMap. Then return either the resulting
RGB value directly, or use it to index the destination color map.
rgbMap:from:to:
NOTE: This code is copied verbatim from BitBltSimulation so that it
may be removed from the system
rotate:degrees:center:scaleBy:smoothing:
sourceForm:destRect:
Set up a WarpBlt from the entire source Form to the given destination rectangle.
sourceQuad:destRect:
startFrom:to:offset:
Utility routine for computing Warp increments.
test1
test12
test3
test4
test5
toForm:
warpBits
Move those pixels!
warpBitsSmoothing:sourceMap: