SDL2 texture blend help
Dave Jones
dave at jones.com
Mon Dec 11 16:36:19 UTC 2017
On Monday, 11 December 2017 at 04:57:44 UTC, Ivan Trombley wrote:
> Experimenting with compositing images in SDL2, I get a dark
> edge around my textures. In the image below, you can see the
> top example where I composite the cyan image on top of the
> blue/magenta image looks correct but the bottom example, which
> is done using SDL_RenderCopy is not correct.
>
> http://a4.pbase.com/o10/09/605909/1/166698494.lCoVTgcI.example.png
>
> I tried premultiplying the the colors in the cyan image and
> setting the blend function as such...
>
> SDL_SetTextureBlendMode(texture, SDL_ComposeCustomBlendMode(
> SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
> SDL_BlendFactor.SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
> SDL_BlendOperation.SDL_BLENDOPERATION_ADD,
> SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
> SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
> SDL_BlendOperation.SDL_BLENDOPERATION_ADD));
>
> ...but that produces the exact same thing.
>
>
> Any SDL experts out there that can give me a clue?
I dont know SDL but what your describing sounds like the cyan
image already has premultiplied alpha and the blend operation is
doubling down on that.
Have you tried the above blend op without premultiplying the cyan
image?
More information about the Digitalmars-d
mailing list