Squeak Class Documentation category index | class index  
 
WarpBlt
  category: Graphics-Primitives
  superclass: BitBlt
  subclasses:

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.

instance methods
  primitives
  copyQuad:toRect:
deltaFrom:to:nSteps:
sourceForm:destRect:
sourceQuad:destRect:
startFrom:to:offset:
warpBits
warpBitsSmoothing:sourceMap:

  setup
  cellSize
cellSize:

  smoothing
  mixPix:sourceMap:destMap:
rgbMap:from:to:

  system simulation
  warpBitsSimulated
warpBitsSimulated:sourceMap:

class methods
  examples
  test1
test12
test3
test4
test5

  form rotation
  rotate:degrees:center:scaleBy:smoothing:

  initialization
  toForm:

  instance creation
  current

instance methods
  primitives top  
 

copyQuad:toRect:


 

deltaFrom:to:nSteps:

Utility routine for computing Warp increments.
x1 is starting pixel, x2 is ending pixel; assumes n >= 1


 

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.


 

warpBits

Move those pixels!


 

warpBitsSmoothing:sourceMap:


  setup top  
 

cellSize


 

cellSize:


  smoothing top  
 

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


  system simulation top  
 

warpBitsSimulated

Simulate WarpBlt


 

warpBitsSimulated:sourceMap:

Simulate WarpBlt


class methods
  examples top  
 

test1

Display restoreAfter: [WarpBlt test1]


 

test12

Display restoreAfter: [WarpBlt test12]


 

test3

Display restoreAfter: [WarpBlt test3]


 

test4

Display restoreAfter: [WarpBlt test4]


 

test5

Display restoreAfter: [WarpBlt test5]


  form rotation top  
 

rotate:degrees:center:scaleBy:smoothing:

Rotate the given Form the given number of degrees about the given center and scale its width and height by x and y of the given scale point. Smooth using the given cell size, an integer between 1 and 3, where 1 means no smoothing. Return a pair where the first element is the rotated Form and the second is the position offset required to align the center of the rotated Form with that of the original. Note that the dimensions of the resulting Form generally differ from those of the original.


  initialization top  
 

toForm:

Default cell size is 1 (no pixel smoothing)


  instance creation top  
 

current

Return the class currently to be used for WarpBlt