GDI+ Alpha Blending

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GDI+ Alpha Blending

Esteban A. Maringolo-2
Hi,

    I'm trying to blend two GdiplusBitmap's, but i can't achieve that
(because I don't know how).
    With Bitmap's i use #alphaBlend..., as the Dolphin splash does, but i
can't do it with GdiplusBitmap's.
    Can anybody give a clue on this?

    There is one example, using a Fish and a Line, but i'm not quite smart
today, and can't figure how to translate that to be used on two
GdiplusBitmaps.

    Louis?

ps: In my MSDN Library copy (five years), doesn't appears GDI+, what makes
me suppose that GDI+ is newer than October'99. Is this correct?

Best regards.


Reply | Threaded
Open this post in threaded view
|

Re: GDI+ Alpha Blending

Louis Sumberg-2
Hi Esteban,

>     I'm trying to blend two GdiplusBitmap's ...
>     There is one example, using a Fish and a Line ...

That example provides the clues, i.e., using a color matrix and image
attributes.  How it works, I'm not sure myself, but the example at the
bottom of this post (file it in) shows how to blend one image on top of the
other.

As for GDI+'s age, it's at least a few years old.  Recent MSDN docs show
that there's a newer version of the classes, but the flat api that we've
used has not yet been updated by Microsoft.

-- Louis

!GdiplusImage class methodsFor!

exampleGdipIAlphaBlending

"

self exampleGdipIAlphaBlending showExample

"

| bitmap image colorMatrix imageAtt |

image := GdiplusBitmap fromFile: self fileResource pafSeattleNightJpg.

bitmap := GdiplusBitmap extent: image extent.

bitmap graphics drawImage: image.

image := GdiplusImage fromFile: 'Resources/Dolphin1.bmp'

usingLocator: FileLocator installRelative.

"Initialize the color matrix and change the value at row 4 column 4."

colorMatrix := GpColorMatrix identity atPoint: 4 @ 4 put: 0.8.

"Create an ImageAttributes object and set its color matrix. "

imageAtt := GdiplusImageAttributes new colorMatrix: colorMatrix.

bitmap graphics

drawImage: image

at: 0 @ 250

extent: image extent

from: 0 @ 0

extent: image extent

unit: UnitPixel

attributes: imageAtt.

^bitmap! !

!GdiplusImage class categoriesFor:
#exampleGdipIAlphaBlending!examples!public!sunit! !


Reply | Threaded
Open this post in threaded view
|

Re: GDI+ Alpha Blending

Esteban A. Maringolo-2
"Louis Sumberg" <[hidden email]> wrote in message
news:[hidden email]...

> Hi Esteban,
>
>>     I'm trying to blend two GdiplusBitmap's ...
>>     There is one example, using a Fish and a Line ...
>
> That example provides the clues, i.e., using a color matrix and image
> attributes.  How it works, I'm not sure myself, but the example at the
> bottom of this post (file it in) shows how to blend one image on top of
> the
> other.

Thanks Louis, it worked fine.

--
Esteban.