Squeak Class Documentation category index | class index  
 
SketchMorph
  category: Morphic-Basic
  superclass: Morph
  subclasses: MorphThumbnail MultiuserTinyPaint TinyPaint StickySketchMorph FlexMorph BookPageThumbnailMorph JoystickMorph FatBitsPaint ColorPickerMorph MPEGImageMorph Thumbnail PopUpImageMorph

The morph that results when the user draws a color bitmap using the PaintBox (SketchEditorMorph and PaintBoxMorph).

forwardDirection is the angle at which the object will go forward. When the rotationStyle is not #normal, then forwardDirection is any angle, while the rotation is highly restricted. If flexed, this is remembered by the Transform morph. For non-normal rotationStyle, it is rotationDegrees.

setupAngle (a property) is where the user put the green arrow to indicate which direction on the picture is forward. When #normal, draw the morph initially at (0.0 - setupAngle). The enclosing TransformationMorph then rotates it to the true angle.

rotationDegrees In a #normal object, rotationDegrees is constant an equal to setupAngle.
For non-normal, it is the direction the object is going.

When repainting, set it back to its original state. The green arrow is set to setupAngle, and the sketch is shown as drawn originally (rotationDegrees = 0).

rotationStyle = normal (turns), leftRight, upDown, fixed.
When leftRight upDown or fixed, bit map has severe restrictions.

instance methods
  accessing
  form
form:
forwardDirection:
framesToDwell
framesToDwell:
heading:
originalForm:
rotatedForm
rotationStyle
rotationStyle:
scalePoint
scalePoint:
setNewFormFrom:
useInterpolation
useInterpolation:
wearCostume:

  change reporting
  layoutChanged

  drawing
  canBeEnlargedWithB3D
drawHighResolutionOn:in:
drawInterpolatedImage:on:
drawOn:
drawPostscriptOn:
generateInterpolatedForm
generateRotatedForm
wantsRoundedCorners

  e-toy support
  acquirePlayerSimilarTo:
appearsToBeSameCostumeAs:
asWearableCostume
wantsRecolorHandle

  geometry
  containsPoint:
extent:

  initialization
  couldHaveRoundedCorners
initialize
initializeWith:

  menu
  addBorderToShape:
addCustomMenuItems:hand:
addFillStyleMenuItems:hand:
addToggleItemsToHaloMenu:
collapse
editDrawing
editDrawingIn:forBackground:
erasePixelsOfColor:
insertIntoMovie:
recolorPixelsOfColor:
reduceColorPalette:
setRotationStyle
toggleInterpolation
useInterpolationString
wantsDirectionHandles
wantsDirectionHandles:

  object fileIn
  convertToCurrentVersion:refStream:

  other
  basicType
canDrawAtHigherResolution
canSetColor
couldHoldSeparateDataForEachInstance
currentDataValue
isLikelyRecipientForMouseOverHalos
newForm:
releaseCachedState
replaceSelfWithMovie
variableDocks

  parts bin
  initializeToStandAlone

  pen support
  clearExtent:fillColor:
penOnMyForm
revealPenStrokes

class methods
  instance creation
  exampleBackgroundSketch
fromFile:
fromStream:
withForm:

  new morph menu
  includeInNewMorphMenu

  scripting
  additionsToViewerCategories

instance methods
  accessing top  
 

form


 

form:


 

forwardDirection:

If not rotating normally, update my rotatedForm


 

framesToDwell


 

framesToDwell:


 

heading:

If not rotating normally, change forward direction rather than heading


 

originalForm:


 

rotatedForm


 

rotationStyle

Return the 'rotation style' of the receiver


 

rotationStyle:

Set my rotation style to #normal, #leftRight, #upDown, or #none. Styles mean:
#normal -- continuous 360 degree rotation
#leftRight -- quantize angle to left or right facing
#upDown -- quantize angle to up or down facing
#none -- do not rotate


 

scalePoint


 

scalePoint:


 

setNewFormFrom:

Set the receiver's form as indicated. If nil is provided, then a default form will be used, possibly retrieved from the receiver's defaultValue property


 

useInterpolation


 

useInterpolation:


 

wearCostume:


  change reporting top  
 

layoutChanged

Update rotatedForm and compute new bounds.


  drawing top  
 

canBeEnlargedWithB3D


 

drawHighResolutionOn:in:


 

drawInterpolatedImage:on:

Draw the given form onto the canvas using the Balloon 3D engine


 

drawOn:


 

drawPostscriptOn:


 

generateInterpolatedForm

Draw the given form onto the canvas using the Balloon 3D engine


 

generateRotatedForm

Compute my rotatedForm and offsetWhenRotated.


 

wantsRoundedCorners

Default response is simple, fast, and false.
May be overridden to allow almost any morph to be rounded.


  e-toy support top  
 

acquirePlayerSimilarTo:

Retrofit into the receiver a player derived from the existing scripted player of a different morph. Works only between SketchMorphs. Maddeningly complicated by potential for transformations or native sketch-morph scaling in donor or receiver or both


 

appearsToBeSameCostumeAs:


 

asWearableCostume

Return a wearable costume for some player


 

wantsRecolorHandle

Answer whether the receiver would like a recolor handle to be put up for it. We'd want to disable this but for the moment that would cut off access to the button part of the properties sheet. So this remains a loose end.


  geometry top  
 

containsPoint:


 

extent:

Change my scale to fit myself into the given extent.


  initialization top  
 

couldHaveRoundedCorners

Answer whether the receiver could have rounded corners


 

initialize


 

initializeWith:


  menu top  
 

addBorderToShape:


 

addCustomMenuItems:hand:

Add custom menu items


 

addFillStyleMenuItems:hand:

Do nothing here - we do not allow changing the fill style of a SketchMorph yet.


 

addToggleItemsToHaloMenu:

Add toggle-items to the halo menu


 

collapse


 

editDrawing


 

editDrawingIn:forBackground:


 

erasePixelsOfColor:

Let the user specifiy a color such that all pixels of that color should be erased; then do the erasure


 

insertIntoMovie:


 

recolorPixelsOfColor:

Let the user select a color to be remapped, and then a color to map that color to, then carry it out.


 

reduceColorPalette:

Let the user ask for a reduced number of colors in this sketch


 

setRotationStyle


 

toggleInterpolation


 

useInterpolationString


 

wantsDirectionHandles


 

wantsDirectionHandles:


  object fileIn top  
 

convertToCurrentVersion:refStream:

subclasses should implement if they wish to convert old instances to modern ones


  other top  
 

basicType

Answer a symbol representing the inherent type I hold


 

canDrawAtHigherResolution


 

canSetColor

Answer true iff the receiver can meaningfully have its color changed


 

couldHoldSeparateDataForEachInstance

Answer whether this type of morph is inherently capable of holding separate data for each instance ('card data') SketchMorphs answer true, because they can serve as 'picture-holding' fields


 

currentDataValue

Answer the object which bears the current datum for the receiver


 

isLikelyRecipientForMouseOverHalos


 

newForm:


 

releaseCachedState

Clear cache of rotated, scaled Form.


 

replaceSelfWithMovie

Replace this SketchMorph in its owner with a MovieMorph containing this sketch as its only frame. This allows a SketchMorph to be turned into a MovieMorph by just insering additional frames.


 

variableDocks

Answer a list of VariableDock objects for docking up my data with an instance held in my containing playfield


  parts bin top  
 

initializeToStandAlone

Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.


  pen support top  
 

clearExtent:fillColor:

Make this sketch have the given pixel dimensions and fill it with given color. Its previous contents are replaced.


 

penOnMyForm

Support for experiments with drawing under program control. To get started, make a new SketchMorph in a morphic world. In an inspector, give it the desired pixel dimensions with clearExtent:fillColor:. Then use this method to get a pen to which you can send normal pen commands. Reveal the resulting drawing with revealPenStrokes.


 

revealPenStrokes

This message must be sent after a sequence of pen strokes to make the resulting changes visible.


class methods
  instance creation top  
 

exampleBackgroundSketch

Answer an instance suitable for serving as a prototype for a background-field incarnation of a sketch


 

fromFile:


 

fromStream:


 

withForm:

Note: 'SketchMorph withForm: zz' is MUCH faster
than 'SketchMorph new form: zz'.


  new morph menu top  
 

includeInNewMorphMenu

Not to be instantiated from the menu


  scripting top  
 

additionsToViewerCategories

Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories.