[squeak-dev] The Trunk: MorphicExtras-ms.254.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 22 13:18:55 UTC 2019


David T. Lewis uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-ms.254.mcz

==================== Summary ====================

Name: MorphicExtras-ms.254
Author: ms
Time: 22 March 2019, 1:48:31.043664 pm
UUID: d7b3adea-c5be-47f1-8247-7c5ae1ad7f34
Ancestors: MorphicExtras-kfr.253

Adds a preview morph for results of all BitBlt rules. 

When first using BitBlt, it wasn't easy to understand the effects of the possible rules on pixel combinating for me. 
I implemented two example methods which preview the effects of rule 0 to 41 (these are all, I believe) on quadratic existing forms with colors and 1 bit alpha channel (previewAllBitBltRules uses ToolIcons flag/collection) plus Forms with more alpha values (previewAllBitBltRulesWithAlpha uses ToolIcons flag and a Color red + 0.4 alpha preview). They generate a combined morph for all rules applied on these forms (scaled, because icons are small) and opens it in your hand. 
Internally, this morph can be generated for any rule, forms and scale. Rules which throw exceptions are replaced with a fallback form. 

Now in the correct package (see http://forum.world.st/The-Inbox-Graphics-ms-407-mcz-td5097206.html ).
Thank you for your feedback!

=============== Diff against MorphicExtras-kfr.253 ===============

Item was added:
+ ----- Method: BitBlt class>>previewAllBitBltRules (in category '*MorphicExtras') -----
+ previewAllBitBltRules
+ 
+ 	(self previewBitBltRules: (0 to: 41)
+ 		on: ToolIcons flag
+ 		and: ToolIcons collection
+ 		fallback: ToolIcons exception
+ 		scaledTo: 32) openInHand.!

Item was added:
+ ----- Method: BitBlt class>>previewAllBitBltRulesWithAlpha (in category '*MorphicExtras') -----
+ previewAllBitBltRulesWithAlpha
+ 
+ 	(self previewBitBltRules: (0 to: 41)
+ 		on: ToolIcons flag
+ 		and: ((Color red alpha: 0.4) iconOrThumbnailOfSize: 12)
+ 		fallback: ToolIcons exception
+ 		scaledTo: 32) openInHand.!

Item was added:
+ ----- Method: BitBlt class>>previewBitBltRules:on:and:fallback:scaledTo: (in category '*MorphicExtras') -----
+ previewBitBltRules: rules on: aForm1 and: aForm2 fallback: fallbackForm scaledTo: aNumberOrPoint
+ 	"Returns a combined morph of the result of each rule applied on aForm1 combined with 
+ 	aForm2 scaled to aNumberOrPoint. If the combination faild with a rule, fallbackForm is 
+ 	shown instead. The number of each rule is appended at the bottom of each result."
+ 
+ 	| resultMorph tileExtent |
+ 	tileExtent := aNumberOrPoint asPoint.
+ 	resultMorph := Morph new
+ 		color: Color transparent;
+ 		extent: (rules size * tileExtent x)@tileExtent y;
+ 		yourself.
+ 
+ 	rules withIndexDo: [ :rule :index | | form formMorph numberLabel |
+ 		form := aForm1 copy.
+ 		[aForm2 copy displayOn: form at: 0 at 0 rule: rule]
+ 			on: Exception 
+ 			do: [form := fallbackForm].
+ 		formMorph := (form scaledToSize: tileExtent) asMorph
+ 			position: (index*tileExtent x)@0;
+ 			yourself.
+ 		resultMorph addMorph: formMorph.
+ 	
+ 		numberLabel := rule asString asMorph
+ 	      	center: ((index+0.5)*tileExtent x)@tileExtent y;
+ 			yourself.
+ 		resultMorph addMorph: numberLabel].
+ 
+ 	^ resultMorph!



More information about the Squeak-dev mailing list