Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

Alpha Blitting


Alpha Blitting

Postby eugraphics » Feb 4, 2008 @ 8:26pm

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.
eugraphics
pm Member
 
Posts: 56
Joined: Dec 3, 2006 @ 6:56pm


Postby edge » Feb 4, 2008 @ 8:55pm

Hi,

I recommend combining your two images as a PNG image (with alpha channel) and using RGBA surfaces for alpha smoothing.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby eugraphics » Feb 4, 2008 @ 9:30pm

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!
eugraphics
pm Member
 
Posts: 56
Joined: Dec 3, 2006 @ 6:56pm


Postby eugraphics » Feb 4, 2008 @ 10:03pm

i suppose i can use 1 rgba surface and putpixel with opacity on it rather than putting it to a separate surface.
eugraphics
pm Member
 
Posts: 56
Joined: Dec 3, 2006 @ 6:56pm


Postby edge » Feb 5, 2008 @ 11:31am

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby eugraphics » Feb 5, 2008 @ 9:49pm

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
eugraphics
pm Member
 
Posts: 56
Joined: Dec 3, 2006 @ 6:56pm


Postby edge » Feb 6, 2008 @ 8:59am

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby eugraphics » Feb 6, 2008 @ 10:09pm

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
eugraphics
pm Member
 
Posts: 56
Joined: Dec 3, 2006 @ 6:56pm


Postby edge » Feb 7, 2008 @ 9:50am

Hi,

Please refer to my previous reply. This is currently not possible, but will be added to one of our future releases.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Villy21 » Nov 1, 2008 @ 3:16pm

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 ?
User avatar
Villy21
pm Member
 
Posts: 23
Joined: Nov 1, 2008 @ 3:09pm


Postby edge » Nov 3, 2008 @ 11:39am

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Villy21 » Nov 5, 2008 @ 12:16pm

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.
User avatar
Villy21
pm Member
 
Posts: 23
Joined: Nov 1, 2008 @ 3:09pm


Postby edge » Nov 6, 2008 @ 10:16am

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Villy21 » Nov 6, 2008 @ 10:36am

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 :)
User avatar
Villy21
pm Member
 
Posts: 23
Joined: Nov 1, 2008 @ 3:09pm


Postby Villy21 » Nov 11, 2008 @ 11:52am

Answer please?
User avatar
Villy21
pm Member
 
Posts: 23
Joined: Nov 1, 2008 @ 3:09pm


Next

Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron