<div dir="ltr"><div dir="ltr">There is a quite obscure paint tool, SpookyPaint, that one can experiment with and use the combination rules.</div><div dir="ltr"><br></div><div dir="ltr"><div><a href="http://www.languagegame.org:8080/zoo/241">http://www.languagegame.org:8080/zoo/241</a><br></div><div><br></div><div>Cheers,</div><div>Karl</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 21, 2019 at 9:14 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 21, 2019 at 9:22 AM Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I haven't tried the code yet, but based on the commit message, this is a <br>
great contribution. Perhaps it would be worth to create a complete tool <br>
showing the actual results.<br>
I think this code belongs to Morphic/MorphicExtras rather than Graphics. <br>
Graphics doesn't depend on Morphic, and it shouldn't, but these changes <br>
would introduce that dependency.<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Levente<br>
<br>
On Thu, 21 Mar 2019, David T. Lewis wrote:<br>
<br>
> Hi Maximilian,<br>
><br>
> This looks like a good addition. It is small and useful, and it aids<br>
> understanding.<br>
><br>
> I am not very knowledgeable about the BitBlt rules, so maybe someone<br>
> else can look at it also? To me, this looks like a good contribution<br>
> for trunk.<br>
><br>
> Dave<br>
><br>
><br>
> On Wed, Mar 20, 2019 at 12:51:46PM +0000, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
>> A new version of Graphics was added to project The Inbox:<br>
>> <a href="http://source.squeak.org/inbox/Graphics-ms.407.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Graphics-ms.407.mcz</a><br>
>> <br>
>> ==================== Summary ====================<br>
>> <br>
>> Name: Graphics-ms.407<br>
>> Author: ms<br>
>> Time: 20 March 2019, 1:51:42.768596 pm<br>
>> UUID: 40a66bd7-815f-43f7-bbd0-31dc8da3a483<br>
>> Ancestors: Graphics-mt.406<br>
>> <br>
>> Adds a preview morph for results of all BitBlt rules.<br>
>> <br>
>> When first using BitBlt, it wasn't easy to understand the effects of the possible rules on pixel combinating for me.<br>
>> 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.<br>
>> Internally, this morph can be generated for any rule, forms and scale. Rules which throw exceptions are replaced with a fallback form.<br>
>> <br>
>> =============== Diff against Graphics-mt.406 ===============<br>
>> <br>
>> Item was added:<br>
>> + ----- Method: BitBlt class>>previewAllBitBltRules (in category 'examples') -----<br>
>> + previewAllBitBltRules<br>
>> + <br>
>> +    (self previewBitBltRules: (0 to: 41)<br>
>> +            on: ToolIcons flag<br>
>> +            and: ToolIcons collection<br>
>> +            fallback: ToolIcons exception<br>
>> +            scaledTo: 32) openInHand.!<br>
>> <br>
>> Item was added:<br>
>> + ----- Method: BitBlt class>>previewAllBitBltRulesWithAlpha (in category 'examples') -----<br>
>> + previewAllBitBltRulesWithAlpha<br>
>> + <br>
>> +    (self previewBitBltRules: (0 to: 41)<br>
>> +            on: ToolIcons flag<br>
>> +            and: ((Color red alpha: 0.4) iconOrThumbnailOfSize: 12)<br>
>> +            fallback: ToolIcons exception<br>
>> +            scaledTo: 32) openInHand.!<br>
>> <br>
>> Item was added:<br>
>> + ----- Method: BitBlt class>>previewBitBltRules:on:and:fallback:scaledTo: (in category 'examples') -----<br>
>> + previewBitBltRules: rules on: aForm1 and: aForm2 fallback: fallbackForm scaledTo: aNumberOrPoint<br>
>> +    "Returns a combined morph of the result of each rule applied on aForm1 combined with <br>
>> +    aForm2 scaled to aNumberOrPoint. If the combination faild with a rule, fallbackForm is <br>
>> +    shown instead. The number of each rule is appended at the bottom of each result."<br>
>> + <br>
>> +    | resultMorph tileExtent |<br>
>> +    tileExtent := aNumberOrPoint asPoint.<br>
>> +    resultMorph := Morph new<br>
>> +            color: Color transparent;<br>
>> +            extent: (rules size * tileExtent x)@tileExtent y;<br>
>> +            yourself.<br>
>> + <br>
>> +    rules withIndexDo: [ :rule :index | | form formMorph numberLabel |<br>
>> +            form := aForm1 copy.<br>
>> +            [aForm2 copy displayOn: form at: 0@0 rule: rule]<br>
>> +                    on: Exception <br>
>> +                    do: [form := fallbackForm].<br>
>> +            formMorph := (form scaledToSize: tileExtent) asMorph<br>
>> +                    position: (index*tileExtent x)@0;<br>
>> +                    yourself.<br>
>> +            resultMorph addMorph: formMorph.<br>
>> + <br>
>> +            numberLabel := rule asString asMorph<br>
>> +            center: ((index+0.5)*tileExtent x)@tileExtent y;<br>
>> +                    yourself.<br>
>> +            resultMorph addMorph: numberLabel].<br>
>> + <br>
>> +    ^ resultMorph!<br>
>> <br>
>><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-2692748233002780296gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
<br>
</blockquote></div>