Results 1 to 5 of 5

Thread: Is there some thing like a graphicspath or region?

  1. #1

    Question Is there some thing like a graphicspath or region?

    Hi there,

    I'm looking for a datastruct that can descript the non-transparent region/area of an ARGB bitmap.(png, gif etc).

    It's like GDI+ region/graphicspath class or some thing similar.

    Is there a exists way in clanlib or how can I do this?

    thanks for your help..

  2. #2
    Lesser Knight
    Join Date
    Jul 2011
    Posts
    57

    Default

    Why can't you just use images with alpha-channel? It's all the same from the point of rendering.

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Complex clipping regions are not directly supported by ClanLib. This is mostly because OpenGL and Direct3D does not support them.

    Conventional 2D scanline renderers (such as GDI) have rich support for stroking and filling paths and clipping then. However 3D scanline renderers (OpenGL and Direct3D) only have very simple line stroking capabilities and focus on drawing triangles really really fast.

    What this means is that you can typically not use the exact same approach as you would do with a 2D scanline renderer. But often you can get away with using some brute force techniques, such as generating a texture with a clipping region and then reject all fragments not in that texture. This requires you to write your own shaders - none of the standard shaders in ClanLib provides this sort of functionality.

    What exactly do you need a complex clipping region for? There might be some simpler way that was too slow with GDI (a scanline renderer so slow that it makes a modern PC feel like a ZX Spectrum).

  4. #4

    Default

    Quote Originally Posted by Magnus Norddahl View Post
    Complex clipping regions are not directly supported by ClanLib. This is mostly because OpenGL and Direct3D does not support them.

    Conventional 2D scanline renderers (such as GDI) have rich support for stroking and filling paths and clipping then. However 3D scanline renderers (OpenGL and Direct3D) only have very simple line stroking capabilities and focus on drawing triangles really really fast.

    What this means is that you can typically not use the exact same approach as you would do with a 2D scanline renderer. But often you can get away with using some brute force techniques, such as generating a texture with a clipping region and then reject all fragments not in that texture. This requires you to write your own shaders - none of the standard shaders in ClanLib provides this sort of functionality.

    What exactly do you need a complex clipping region for? There might be some simpler way that was too slow with GDI (a scanline renderer so slow that it makes a modern PC feel like a ZX Spectrum).
    I only hope that this effective on 2D graphics.

    As for why I need a graphicspath feature, is that :
    I want to build a window/form/control from an ARGB image, and get it function with mouse events of only the non-transparent region.

    I searched around, there's only two ways:
    1.when mouse events fired on point x, then get color of the point, and filter the transparents'.
    2.some thing like graphicspath.

    I don't know that if I think just wrong, or there's easy ways doing this..

    thanks.

  5. #5

    Default

    Quote Originally Posted by Noro View Post
    Why can't you just use images with alpha-channel? It's all the same from the point of rendering.
    thanks for your reply.

    my root problem is as what i said on #4. It's not a draw issue, but an event issue.

Similar Threads

  1. The Saddest Thing Ever in FQ
    By redink1 in forum Funeral Quest
    Replies: 1
    Last Post: 04-13-2013, 02:38 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
  •