<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        +1 Graphics must not depend on Morphic. Put it into an extension category such as "*MorphicExtras".<div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 21.03.2019 17:22:17 schrieb Levente Uzonyi <leves@caesar.elte.hu>:</p><div style="font-family:Arial,Helvetica,sans-serif">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><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, commits@source.squeak.org wrote:<br>>> A new version of Graphics was added to project The Inbox:<br>>> http://source.squeak.org/inbox/Graphics-ms.407.mcz<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></div></blockquote></div>