Results 1 to 4 of 4

Thread: Scale Images

  1. #1

    Default Scale Images

    Hi and Hello,

    1st: ClanLib is pretty cool.
    2nd: Sorry, if I post in the wrong Forum.
    May question.

    I try to load an image, it works fine.
    Now, I whant to scale it (resize)!

    How I realize this.

    I'm using ClanLib 2.1, WindowsXP.

    Greez...

    Ps.: sorry for my english!

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

    Default

    If you use CL_Image or CL_Sprite use you use both of following options:

    Code:
      image.set_scale(float x, float y); 
      Example:  image.set_scale(2.0f, 2.0f);  --> Scale * 2
      Then image.draw(gc, xpos, ypos);
    or
    Code:
      image.draw(CL_GraphicContext &gc, const CL_Rectf &dest)
      Example:  image.draw(gc, CL_Rectf(xpos, ypos, CL_Sizef(image.get_width() * 2.0f, image.get_height() * 2.0f))); --> Scale * 2

  3. #3

    Default

    Can you specify which scaling algorithm to use? Which algorithm is used by default?

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

    Default

    CL_Image or CL_Sprite both default to the "linear" method (smooth scaling).

    With CL_Sprite, you can use set_linear_filter(false), to switch to the "nearest" method (closest pixel)

    Advanced users can use CL_Texture instead, where you have: set_min_filter() and set_max_filter() for
    Code:
    cl_filter_nearest   
    cl_filter_linear   
    cl_filter_nearest_mipmap_nearest   
    cl_filter_nearest_mipmap_linear   
    cl_filter_linear_mipmap_nearest   
    cl_filter_linear_mipmap_linear

Similar Threads

  1. Images
    By attle in forum Novashell Game Creation System
    Replies: 0
    Last Post: 02-04-2008, 09:45 AM
  2. Corrupted images and random crashes with ClanLib 0.8 on Ubuntu Feisty
    By xmoby in forum Official ClanLib SDK Forums
    Replies: 18
    Last Post: 10-30-2007, 05:01 PM
  3. Broken images in tutorial page..
    By whisperstorm in forum Novashell Game Creation System
    Replies: 1
    Last Post: 02-26-2007, 11:28 AM
  4. [img] code in signatures or images
    By aGig in forum RTsoft Tavern
    Replies: 0
    Last Post: 01-31-2007, 02:52 AM

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
  •