[CANTOO] Re: A new default look for Squeak, revisited

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Mon Jul 3 17:43:44 UTC 2000


Bob Arning wrote:

> Well, the enclosed snippet looks close to my eye. Could be faster with a
> specialized BitBlt rule, but isn't that always the case?

Very nice Bob! Of course I knew it could be done, plus how to make someone
else do it for me ;) In fact, I see it is very similar to how I remove color
artifacts from sub-pixel rendered bitmaps, also by "smoothing" out sharp
edges. Makes the menus just a bit too slow though... To try this, I turned
it into a method that can be called by any drawOn: method, like this:


!FormCanvas methodsFor: 'drawing' stamp: 'hg 7/3/2000 09:51'!
blurRectangle: rect color: color amount: amount
    "amount specifies the degree of blurring as a value between 0 and 1.
>From an example by Bob Arning."

    | f blt |
    f _ Form extent: rect extent depth: 32.
    f fillColor: color.
    blt _ BitBlt 
        destForm: f
        sourceForm: self form
        fillColor: nil
        combinationRule: 30
        destOrigin: 0 at 0
        sourceOrigin: rect origin
        extent: rect extent
        clipRect: f boundingBox.
    {0 at 0},(0 at 0) eightNeighbors do: [ :pt |
        blt 
            destOrigin: pt;
            copyBitsTranslucent: ((1 - amount) * 255) truncated.
    ].
    self paintImage: f at: rect origin
! !

Henrik






More information about the Squeak-dev mailing list