Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Clarity_IV

Pages: [1]
1
Graphics / Scale without anti-aliasing?
« on: February 26, 2012, 03:34:57 am »
Quote from: "Weeve"
can't tell if your C or C++, or some odd language, but, try using curly bracketing for anything past one indent, example:


I'm using C++. I've tried both bracketed and unbracketed, it makes no difference.

Quote
that may be your problem, but it also looks like your doing more work than you need to, just scale the image with a matrix, and loop into the image and replace each empty pixel with the one before it :)


That's basically what I'm doing now, how are you saying to do it?

Thanks!

2
Graphics / Scale without anti-aliasing?
« on: February 24, 2012, 01:16:21 am »
Hello,

I was wondering if there was a way to scale an image with SFML without any form of anti-aliasing. I'm not talking about turning anti-aliasing off for the window, but instead scaling an image so it doesn't look blurry.

I tried to write my own scale function to suit the purpose, but it always comes out as a white box covering the full image.

If someone could tell me if there's a function that does this, or what's wrong with my function, that would be great.

Thanks!

Code: [Select]
class AREA{
   
    public:

        Image   img;                            //Area image
        Sprite  spr;                            //Area sprite
        Color   bnd_clr;                        //Boundary color
        int     x,  y;                          //Image size
        bool    bnd[MAX_AREA_X][MAX_AREA_Y];    //Boundaries

}area[MAX_AREA];


Code: [Select]

bool    spr_scale(  int scale,
                    int index   ){

    //Create temporary variables
    int     atmp, btmp, ctmp, dtmp; //Temporary counter integers
    Image   tmp_img;                //Temporary image


    //Create temporary image
    tmp_img.Create( area[index].x * scale,  //Old image's x size * scale value
                    area[index].y * scale,  //Old image's y size * scale value
                    Color(0, 0, 0)      );  //Make the image 100% black


    //Fill new image with scaled old image
    for ( atmp = 1 ; atmp < area[index].y ; ++atmp )        //Original image y counter
        for ( btmp = 1 ; btmp < area[index].x ; ++btmp )    //Original image x counter
            for ( ctmp = 0 ; ctmp < scale ; ++ctmp )        //New image y counter
                for ( dtmp = 0 ; dtmp < scale ; ++dtmp )    //New image x counter
                    //Set the pixel
                    tmp_img.SetPixel(   ( btmp * scale ) + dtmp,                    //x position of pixel
                                        ( atmp * scale ) + ctmp,                    //y position of pixel
                                        area[index].spr.GetPixel( btmp, atmp ) );   //Get old image color


    //Set old image to the new scaled image
    area[index].spr.Resize( ( area[index].x * scale ),      //Set new x size...
                            ( area[index].y * scale ) );    //...set new y size...
    area[index].spr.SetImage( tmp_img );                    //...and make it so


    //Everything went alright
    return true;

}

Pages: [1]
anything