PocketMatrix forums

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

GapiRGBASurface != GapiSurface?

So is it not possible to "draw into" an RGBA surface the same way you can draw into GapiSurface?

I was hoping to "build up" RGBA surfaces by blitting images with alpha channels and drawing lines and such, then keep them around for fast blitting later.

It looks like my only option is to access the pixels directly?
Narin wrote:So is it not possible to "draw into" an RGBA surface the same way you can draw into GapiSurface?


Well. GapiRGBASurface does not have the drawing toolkit of CGapiSurface, such as line drawing and font rendering. But you can draw into a CGapiRGBASurface yourself using GetBuffer() to write pixels manually.

Narin wrote:I was hoping to "build up" RGBA surfaces by blitting images with alpha channels and drawing lines and such, then keep them around for fast blitting later.


You can do this! Use one CGapiSurface as "color" texture, and one CGapiSurface as "alpha" texture. You can then draw as you want to these CGapiSurfaces, either modifying alpha, color channel, or both. Then call the CGapiSurface::AlphaBlt that takes two CGapiSurface pointers as source (one CGapiSurface for color and one CGapiSurface for alpha).

Sincerely
Johan
Johan wrote:You can do this! Use one CGapiSurface as "color" texture, and one CGapiSurface as "alpha" texture.


Wonderful! I can definitely work with that.

Is there a prescribed set of operations for "adding" two of these color+alpha surface pairs together? Like add the color and multiply the alpha or something?
By default you can only do a regular source + 1-source blending.

But if you get the source code license you can very easily add things like this yourself. GapiDraw has a very flexible architecture inside.

Sincerely
Johan