PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Alpha Blitting

I have an image surface and an alpha surface. How can i blit these together to another surface so that the alpha smoothing shows up. There is no AlphaBlt function in Edge right?

I'm wondering if there's a recommended way to achieve this.

Thanks.
Hi,

I recommend combining your two images as a PNG image (with alpha channel) and using RGBA surfaces for alpha smoothing.
That's what i've done for images on disk but during runtime my text engine uses a separate alpha surface to achieve smooth text, for example. So in that case i cant make a png out of it.

Also, there are cases where even with pngs, i want to separate the alpha channel out so i can create some shapes based on the alpha.

Any way to do this easily - i only ask because i dont see an easy way to do it immediately.

Thanks!
i suppose i can use 1 rgba surface and putpixel with opacity on it rather than putting it to a separate surface.
Hi,

Currently it's not possible to opacity blit using two surfaces. The PutPixel method may work, but is slow. I recommend not using it in time critical situations.
Thanks - is it possible to stretch blt RGBA surfaces? I assume not based on the doc but I want to make sure.

Are these features planned for future releases?

thanks
Hi,

Yes, we're planning to add stretched (and rotated) RGBA blitting to one of our future releases. Also, alpha blitting (using two surfaces) is on our radar.
Thanks - is it possible to stretch blt RGBA surfaces? I assume not based on the doc but I want to make sure.

Are these features planned for future releases?

thanks
Hi,

Please refer to my previous reply. This is currently not possible, but will be added to one of our future releases.
I need this features too. Especially to make cache for TTF fonts with alpha channel.

I 'am curious is this (AlphaBltFast from 2 Surfaces) possible now ?
Hi Villy,

For fonts we recommend using RGBA surfaces and make your characters white. Then you can use the EFX_COLORFILL effect to draw fonts in several colors.
TTF Font cache already work in GapiDraw version. Now I deciding, is there any way to move from GapiDraw to EDGELIB without 100% rewrite code.

And as I understand Font Cache can't be done without waste +50% of memory to current realization.

Now: Draw black TTF char (Antialiased Font) to surface (Native surface). Use this surface as alpha surface for temp small surface (only one letter. filled with any Color) and draw all this to screen. In this case we store in memory only alpha.

You advice to draw TTF char to surface (Native surface) and then manually copy surface content to internal memory of other RGBA surface an draw it to screen.

As I suppose there is no other way to draw TTF Antialiased letter to surface.
Hi Villy,

Yes, right now it's only possible to use RGBA. Do you have all the characters in a sheet, or do you generate them one by one as you draw? The first method may be better for performance.
Yes I use dynamically created surfaces for several letters.

How may time you need to add AlphaBlt from 2 surfaces feature to EDGELIB ?

Of course I can make my own function for this but I spend a bit more time for this then you. And It's harder to explain to my boss why we need to buy EDGELIB :)
Answer please?
Currently alpha blitting of 2 surfaces is not planned for future releases. Also, we can't give an estimate at the moment.