tim Rowledge uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-tpr.645.mcz ==================== Summary ==================== Name: Morphic-tpr.645 Author: tpr Time: 25 March 2013, 2:12:47.714 pm UUID: 26d49d4a-210b-4691-b474-f1e1fe3c1e35 Ancestors: Morphic-fbs.644 Remove BitBlt|WarpBlt>current usage - it's a vestige of an old experiment =============== Diff against Morphic-fbs.644 =============== Item was changed: ----- Method: BalloonCanvas>>image:at:sourceRect:rule: (in category 'private') ----- image: aForm at: aPoint sourceRect: sourceRect rule: rule | warp dstRect srcQuad dstOffset center | (self ifNoTransformWithIn: sourceRect) & false ifTrue:[^super image: aForm at: aPoint sourceRect: sourceRect rule: rule]. dstRect := (transform localBoundsToGlobal: (aForm boundingBox translateBy: aPoint)). dstOffset := 0@0. "dstRect origin." "dstRect := 0@0 corner: dstRect extent." center := 0@0."transform globalPointToLocal: dstRect origin." srcQuad := transform globalPointsToLocal: (dstRect innerCorners). srcQuad := srcQuad collect:[:pt| pt - aPoint]. + warp := (WarpBlt toForm: form) - warp := (WarpBlt current toForm: form) sourceForm: aForm; cellSize: 2; "installs a new colormap if cellSize > 1" combinationRule: Form over. warp copyQuad: srcQuad toRect: (dstRect translateBy: dstOffset). self frameRectangle: (aForm boundingBox translateBy: aPoint) color: Color green. "... TODO ... create a bitmap fill style from the form and use it for a simple rectangle."! Item was changed: ----- Method: FormCanvas>>portClass (in category 'private') ----- portClass "Return the class used as port" + ^BitBlt asGrafPort! - ^Display defaultBitBltClass asGrafPort! Item was changed: ----- Method: FormCanvas>>privateWarp:transform:at:sourceRect:cellSize: (in category 'private') ----- privateWarp: aForm transform: aTransform at: extraOffset sourceRect: sourceRect cellSize: cellSize "Warp the given using the appropriate transform and offset." | globalRect sourceQuad warp tfm | tfm := aTransform. globalRect := tfm localBoundsToGlobal: sourceRect. sourceQuad := (tfm sourceQuadFor: globalRect) collect:[:p| p - sourceRect topLeft]. extraOffset ifNotNil:[globalRect := globalRect translateBy: extraOffset]. + warp := (WarpBlt toForm: port destForm) - warp := (WarpBlt current toForm: port destForm) combinationRule: Form paint; sourceQuad: sourceQuad destRect: (globalRect origin corner: globalRect corner+(1@1)); clipRect: port clipRect. warp cellSize: cellSize. warp sourceForm: aForm. warp warpBits! Item was changed: ----- Method: FormCanvas>>showAt:invalidRects: (in category 'other') ----- showAt: pt invalidRects: updateRects | blt | + blt := (BitBlt toForm: Display) - blt := (BitBlt current toForm: Display) sourceForm: form; combinationRule: Form over. updateRects do: [:rect | blt sourceRect: rect; destOrigin: rect topLeft + pt; copyBits]! Item was changed: ----- Method: FormCanvas>>warpFrom:toRect: (in category 'other') ----- warpFrom: sourceQuad toRect: destRect + ^ (WarpBlt toForm: port destForm) - ^ (WarpBlt current toForm: port destForm) combinationRule: Form paint; sourceQuad: sourceQuad destRect: (destRect translateBy: origin); clipRect: clipRect! Item was changed: ----- Method: Morph>>drawRolloverBorderOn: (in category 'drawing') ----- drawRolloverBorderOn: aCanvas | colorToUse offsetToUse myShadow newForm f | colorToUse := self valueOfProperty: #rolloverColor ifAbsent: [Color blue alpha: 0.5]. offsetToUse := self valueOfProperty: #rolloverWidth ifAbsent: [10 @ 10]. self hasRolloverBorder: false. myShadow := self shadowForm. self hasRolloverBorder: true. myShadow offset: 0 @ 0. f := ColorForm extent: myShadow extent depth: 1. myShadow displayOn: f. f colors: {Color transparent. colorToUse}. newForm := Form extent: offsetToUse * 2 + myShadow extent depth: 32. + (WarpBlt toForm: newForm) sourceForm: f; - (WarpBlt current toForm: newForm) sourceForm: f; cellSize: 1; combinationRule: 3; copyQuad: f boundingBox innerCorners toRect: newForm boundingBox. aCanvas translateBy: offsetToUse negated during: [:shadowCanvas | shadowCanvas shadowColor: colorToUse. shadowCanvas paintImage: newForm at: self position]! Item was changed: ----- Method: PasteUpMorph>>flashRects:color: (in category 'world state') ----- flashRects: rectangleList color: aColor "For testing. Flashes the given list of rectangles on the Display so you can watch incremental redisplay at work." "Details: Uses two reverses so that the display is restored to its original state. This is necessary when in deferred update mode." | blt | + blt := (BitBlt toForm: Display) - blt := (BitBlt current toForm: Display) sourceForm: nil; sourceOrigin: 0@0; clipRect: self viewBox; combinationRule: Form reverse. rectangleList do: [:r | | screenRect | screenRect := r translateBy: self viewBox origin. blt destRect: screenRect; copyBits. Display forceToScreen: screenRect; forceDisplayUpdate. (Delay forMilliseconds: 15) wait. blt destRect: screenRect; copyBits. Display forceToScreen: screenRect; forceDisplayUpdate]. ! Item was changed: ----- Method: PolygonMorph>>computeArrowFormAt:from: (in category 'private') ----- computeArrowFormAt: endPoint from: priorPoint "Compute a triangle oriented along the line from priorPoint to endPoint. Then draw those lines in a form and return that form, with appropriate offset" | p1 pts box arrowForm bb origin | pts := self arrowBoundsAt: endPoint from: priorPoint. box := ((pts first rect: pts last) encompass: (pts second)) expandBy: 1. arrowForm := Form extent: box extent asIntegerPoint. + bb := (BitBlt toForm: arrowForm) - bb := (BitBlt current toForm: arrowForm) sourceForm: nil; fillColor: Color black; combinationRule: Form over; width: 1; height: 1. origin := box topLeft. p1 := pts last - origin. pts do: [:p | bb drawFrom: p1 to: p - origin. p1 := p - origin]. arrowForm convexShapeFill: Color black. ^arrowForm offset: box topLeft! Item was changed: ----- Method: PolygonMorph>>filledForm (in category 'private') ----- filledForm "Note: The filled form is actually 2 pixels bigger than bounds, and the point corresponding to this morphs' position is at 1@1 in the form. This is due to the details of the fillig routines, at least one of which requires an extra 1-pixel margin around the outside. Computation of the filled form is done only on demand." | bb origin | closed ifFalse: [^ filledForm := nil]. filledForm ifNotNil: [^ filledForm]. filledForm := Form extent: bounds extent+2. "Draw the border..." + bb := (BitBlt toForm: filledForm) sourceForm: nil; fillColor: Color black; - bb := (BitBlt current toForm: filledForm) sourceForm: nil; fillColor: Color black; combinationRule: Form over; width: 1; height: 1. origin := bounds topLeft asIntegerPoint-1. self lineSegmentsDo: [:p1 :p2 | bb drawFrom: p1 asIntegerPoint-origin to: p2 asIntegerPoint-origin]. "Fill it in..." filledForm convexShapeFill: Color black. (borderColor isColor and: [borderColor isTranslucentColor]) ifTrue: ["If border is stored as a form, then erase any overlap now." filledForm copy: self borderForm boundingBox from: self borderForm to: 1@1 rule: Form erase]. ^ filledForm! Item was changed: ----- Method: ProjectViewMorph>>updateImageFrom: (in category 'drawing') ----- updateImageFrom: sourceForm + (WarpBlt toForm: image) - (WarpBlt current toForm: image) sourceForm: sourceForm; cellSize: 2; "installs a colormap" combinationRule: Form over; copyQuad: (sourceForm boundingBox) innerCorners toRect: image boundingBox. ! Item was changed: ----- Method: SketchMorph>>generateRotatedForm (in category 'drawing') ----- generateRotatedForm "Compute my rotatedForm and offsetWhenRotated." | scalePt smoothPix pair | scalePoint ifNil: [scalePoint := 1 @ 1]. scalePt := scalePoint x abs @ scalePoint y abs. rotationStyle == #none ifTrue: [scalePt := 1 @ 1]. smoothPix := (scalePt x < 1.0 or: [scalePt y < 1.0]) ifTrue: [2] ifFalse: [1]. rotationStyle = #leftRight ifTrue: [self heading asSmallAngleDegrees < 0.0 ifTrue: [scalePt := scalePt x negated @ scalePt y]]. rotationStyle = #upDown ifTrue: [self heading asSmallAngleDegrees abs > 90.0 ifTrue: [scalePt := scalePt x @ scalePt y negated]]. rotatedForm := scalePt = (1 @ 1) ifTrue: [originalForm] ifFalse: ["ar 11/19/2001: I am uncertain what happens in the case of rotationStyle ~~ normal" (rotationStyle == #normal and: [self useInterpolation]) ifTrue: [^self generateInterpolatedForm]. + pair := WarpBlt - pair := WarpBlt current rotate: originalForm degrees: 0 center: originalForm boundingBox center scaleBy: scalePt smoothing: smoothPix. pair first]! |
Free forum by Nabble | Edit this page |