BitBlt help?

David Faught dave.faught at gmail.com
Mon Sep 18 13:39:30 UTC 2006


Here is a method that I thought would be really simple, but I can't
get it to work properly.  I am obviously not understanding something
about how BitBlt works for this situation.  Using the statement in the
comment at the top to test, it appears from the result that maybe
mask2 is being painted white instead of a very dark grey.  Any clue to
understanding would be appreciated.

'From Croquet1.0beta of 11 April 2006 [latest update: #2] on 17
September 2006 at 4:29:52 pm'!

!Form methodsFor: 'converting' stamp: 'daf 9/17/2006 16:26'!
makeNeighborMap: dist
	"Answer a form made by calculating how many non-background neighbors
each pixel has, which is useful as a heightmap.

	( (Form fromFileNamed: 'Sketches\Goat.gif') makeNeighborMap: 5 )
asMorph openInWorld.

"
	| mask map mask2 |
	mask := Form extent: self extent depth: 1.
	(WarpBlt toForm: mask)
		sourceForm: self destRect: mask boundingBox;
		combinationRule: Form over;
		cellSize: 1;
		colorMap: (Color maskingMap: depth);
		warpBits.
mask reverse.
	mask2 := Form extent: self extent depth: 32.
	(BitBlt toForm: mask2)
		sourceForm: mask;
		fillColor: (Color fromString: '#010101');
		destOrigin: 0 at 0;
		combinationRule: 25;
		copyBits.

	map := Form extent: self extent depth: 32.
	(dist negated) to: dist do: [ :xi |
		(dist negated) to: dist do: [ :yi |
			(BitBlt toForm: map)
				sourceForm: mask2;
				destOrigin: xi at yi;
				combinationRule: 19;
				copyBits.
		].
	].
	^ map
! !



More information about the Squeak-dev mailing list