Results 1 to 2 of 2

Thread: PNG Alpha Channel Issue

  1. #1
    Serf
    Join Date
    Jan 2010
    Posts
    1

    Default PNG Alpha Channel Issue

    There seems to be an issue with the alpha channel.

    Here some examples (on the left how it should look like [created with image editor] and on the right how it actually looks like):


    The differences are minimal, but still visible.

    The sprite images are loaded from several large PNGs with the through a resource XML file where the image positions are given by the <grid> tags.

    Clanlib 2.1.1 with MSVC 2008 is used.
    Last edited by doon; 01-20-2010 at 02:40 PM.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    ClanLib's 2.1.1 CL_BlendMode default is not set at the ideal.

    Have a look at the Blend Example in ClanLib 2.1.1.. See - http://www.rtsoft.com/forums/showthread.php?t=2946

    ClanLib 2.2.0 (Development) CL_BlendMode default has changed to:
    src_func = cl_blend_src_alpha
    dest_func = cl_blend_one_minus_src_alpha
    src_alpha_func = cl_blend_one
    dest_alpha_func = cl_blend_one_minus_src_alpha

    I cannot remember the details, but the options are:
    1) Premultiply the alpha channel. Unfortunately, ClanLib 2.1.1 does not support this very well (but see the Blend Example).
    2) Use CL_BlendMode to set the blend mode stated above. However in ClanLib 2.1.1, this is not supported in the GL1 and GDI display targets (only works in the GL target)
    3) Use ClanLib 2.2, which is in Development and the API is in flux, and could change. ClanLib 2.2 supports both alpha blending methods.

    Option 2 is the preferred option.

    (All comments are my own opinion )

Similar Threads

  1. ClanLib 2.1.1 - Alpha Test Release (Linux)
    By rombust in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 11-30-2009, 11:26 AM
  2. Premultiplication of RGB by Alpha.
    By rombust in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 11-12-2009, 03:15 PM
  3. problem to launch Novashell 0.32 alpha
    By Planescape in forum Novashell Game Creation System
    Replies: 3
    Last Post: 12-06-2008, 09:36 PM
  4. Canvas and alpha
    By marcr in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 02-09-2008, 04:36 AM
  5. Weirdness with alpha
    By madmark in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 12-12-2007, 11:08 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •