Results 1 to 10 of 10

Thread: ColorKeying with ClanLib 2.0

  1. #1

    Default ColorKeying with ClanLib 2.0

    Hi,

    i have a Sprite with green background..



    I want to use the add_alphaclipped_frames for the sprite description, but i don't know what the last argument stands for..

    Does anybody have an idea how to cut this picture with ColorKeying in frames ?

    I use ClanLib 2.0

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    My best tip would be to load it up in some paint application (photoshop, gimp, paint.net) and convert it to a 32 bit image using proper alpha channel.

    Otherwise, look into CL_PixelBuffer::set_colorkey - it might help you.

  3. #3

    Default

    You mean that i convert it to gif or png for example with transparent background ?

  4. #4

    Default

    What is the second parameter for set_colorkey ?

    I tried it with Cl_Colorf but it doesn't work ..

  5. #5

    Default

    can someone help ???

  6. #6

    Default

    Ok i decided to make the background transparent ..

    But now i have a problem, not all my cell-images can be read i have a 96x128px picture 3x4 cells and add_gridclipped_frames online take the parameters 3x3 , when i choose higher i get an error "outside pixelbuffer bounds" ..

  7. #7
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    "What is the second parameter for set_colorkey ? "

    I don't know what the second parameter does. Either I spend time looking it up in the sourcecode (and I've never looked at this code before), or you can do it. I suggest the second approach.

    "But now i have a problem, not all my cell-images can be read i have a 96x128px picture 3x4 cells and add_gridclipped_frames online take the parameters 3x3 , when i choose higher i get an error "outside pixelbuffer bounds"

    Sorry, I don't understand what you mean here..?

  8. #8

    Default



    I mean that , you can see there 3x4 Cells , 12 Sprites ..

    Code:
    desc.add_gridclipped_frames(CL_PNGProvider::load("images/player_walk.png"),0,0,32,32,3,3,0,0,true);
    with this code i get only 9 Sprites , but when i change the "3" to "4" i get an error ..

  9. #9
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    I tried with your image and

    Code:
    desc.add_gridclipped_frames(CL_PNGProvider::load("Images/player_walk.png"),0,0,32,32,3,4,0,0,0);
    and it worked fine...

    The error you do is the last parameter - which you set to true.

    According to the docs, the last parameter is not a bool. So you're actually setting the yspacing to 1, and therefore it goes out of bounds.

  10. #10

    Default

    Ahh ok, thank you very much

    Now it works fine =)

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
  •