'From Squeak3.1alpha of 28 February 2001 [latest update: #4089] on 28 May 2001 at 5:53:39 pm'! "Change Set: Unnamed1 Date: 28 May 2001 Author: Andreas Raab Adds more tweaks for texture painting."! !WonderlandCameraMorph methodsFor: 'menu' stamp: 'ar 5/28/2001 17:20'! addCustomMenuItems: aCustomMenu hand: aHandMorph super addCustomMenuItems: aCustomMenu hand: aHandMorph. aCustomMenu addLine. aCustomMenu addUpdating: #firstPersonControlString action: #toggleFirstPersonControl. aCustomMenu addUpdating: #showControlsString action: #toggleCameraControls. aCustomMenu addUpdating: #getAcceleratorState action: #toggleAcceleratorState. aCustomMenu addLine. aCustomMenu addUpdating: #getAAPaintState action: #toggleAAPaintState. aCustomMenu addLine. aCustomMenu add: 'Stop/Go button' action: #attachStopGoButtons. aCustomMenu add: 'Load actor' action: #loadActor. ! ! !WonderlandCameraMorph methodsFor: 'menu' stamp: 'ar 5/28/2001 17:21'! getAAPaintState ^self aaPaintingEnabled ifTrue:['antialiased texture painting'] ifFalse:['antialiased texture painting'] ! ! !WonderlandCameraMorph methodsFor: 'menu' stamp: 'ar 5/28/2001 17:21'! toggleAAPaintState self aaPaintingEnabled: self aaPaintingEnabled not.! ! !WonderlandCameraMorph methodsFor: 'pooh-actions' stamp: 'ar 5/28/2001 17:18'! aaPaintingEnabled ^self valueOfProperty: #aaPaintingEnabled ifAbsent:[true]! ! !WonderlandCameraMorph methodsFor: 'pooh-actions' stamp: 'ar 5/28/2001 17:19'! aaPaintingEnabled: aBool aBool ifTrue:[self removeProperty: #aaPaintingEnabled] ifFalse:[self setProperty: #aaPaintingEnabled toValue: aBool]! ! !WonderlandCameraMorph methodsFor: 'pooh-actions' stamp: 'ar 5/28/2001 17:52'! paint: newEvent | bb newPosition dx firstY lastY dy py midX | newPosition _ newEvent getVertex texCoords * currentCanvas extent - (currentNib extent // 2). "Watch out for wrapping in y" (newPosition y - currentPosition y) abs > (currentCanvas form height // 2) ifTrue:[ "Go the other (shorter) way around" dx _ newPosition x - currentPosition x. newPosition y > currentPosition y ifTrue:[ firstY _ 0. lastY _ currentCanvas form height. dy _ currentCanvas form height - newPosition y + currentPosition y. py _ currentPosition y. ] ifFalse:[ firstY _ currentCanvas form height. lastY _ 0. dy _ currentCanvas form height - currentPosition y + newPosition y. py _ currentCanvas form height - currentPosition y. ]. midX _ currentPosition x + (dx * (py / dy)). midX _ midX asInteger. ]. bb _ BitBlt toForm: currentCanvas form. bb sourceForm: currentNib; sourceRect: currentNib boundingBox; colorMap: (currentNib colormapIfNeededFor: bb destForm); combinationRule: Form blend. midX == nil ifTrue:[ bb drawFrom: currentPosition asIntegerPoint to: newPosition asIntegerPoint. ] ifFalse:[ bb drawFrom: currentPosition asIntegerPoint to: midX @ firstY; drawFrom: midX @ lastY to: newPosition asIntegerPoint. ]. currentPosition _ newPosition.! ! !WonderlandCameraMorph methodsFor: 'pooh-actions' stamp: 'ar 5/28/2001 17:17'! prepareAction: newEvent | range palNib | currentColor _ palette getColor. palNib _ palette getNib. (currentNib notNil and:[currentNib extent = palNib extent and:[currentNib isColorForm and:[currentNib depth = 8 and:[currentNib colors last = currentColor]]]]) ifFalse:[ currentNib _ self roundNibOfSize: (palette getNib extent). self aaPaintingEnabled ifTrue:[currentNib colors:((0 to: 255) collect:[:i| currentColor alpha: i / 255.0])] ifFalse:[currentNib colors: ((Array new: 256) at: 1 put: Color transparent; from: 2 to: 256 put: currentColor; yourself)]. ]. currentActor _ newEvent getActor. currentCanvas _ (currentActor getTexturePointer getCanvas). range _ currentCanvas extent. currentPosition _ newEvent getVertex texCoords * range - (currentNib extent // 2).! ! !WonderlandCameraMorph methodsFor: 'pooh-palette' stamp: 'ar 5/28/2001 17:12'! clear currentActor ifNotNil: [ currentActor getTexturePointer fillColor: Color white. ].! !