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

H. Hirzel hannes.hirzel at gmail.com
Fri Mar 22 13:20:51 UTC 2019


The result of

      BitBlt previewAllBitBltRules

looks fine so far (see attachment).

However the questions is if other example forms than

     ToolIcons flag

and
     ToolIcons collection

could be chosen which show more clearly what is going on.
I remember that the blue book has a diagram about this.

--Hannes


the code

BitBlt class>>
previewAllBitBltRules

	(self previewBitBltRules: (0 to: 41)
		on: ToolIcons flag
		and: ToolIcons collection
		fallback: ToolIcons exception
		scaledTo: 64) openInHand.




On Fri, 22 Mar 2019 12:48:33 0000, commits at source.squeak.org
<commits at source.squeak.org> wrote:
> A new version of MorphicExtras was added to project The Inbox:
> http://source.squeak.org/inbox/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!
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BitBlt_previewAllBitRules_Screenshot_2019-03-22.png
Type: image/png
Size: 71333 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190322/dfd363cf/attachment-0001.png>


More information about the Squeak-dev mailing list