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

Author Topic: Image Feathering  (Read 1234 times)

0 Members and 2 Guests are viewing this topic.

Skate1168

  • Newbie
  • *
  • Posts: 2
    • MSN Messenger - Skate1168@live.com
    • View Profile
    • http://s4.zetaboards.com/GJS_studios/index
    • Email
Image Feathering
« on: October 30, 2011, 12:03:01 am »
So I was just writing a simple program to display an image. My image is a pixel tile. I noticed when I run the program it looked a little fuzzy. I took a screenshot and took a closer look..

Original Image (Transparent Background):



Original Image Closeup (on white background so you can see the pixelness):



"Fuzzy" Image Closeup:



As you can see, the program apparently "feathered" my image, even though I just told it to directly display it. Below is my code:

Code: [Select]
#include <SFML/Graphics.hpp>

int main() {

    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Image Feathering");

    // Load a sprite to display
    sf::Image Img;
    if(!Img.LoadFromFile("image.png"))
        return EXIT_FAILURE;
    sf::Sprite Tile(Img);

    // Start the game loop
    while(App.IsOpened()) {
        // Process events
        sf::Event Event;
        while(App.GetEvent(Event)) {

            // Close window : exit
            if(Event.Type == sf::Event::Closed) {

                App.Close();

            }

        }

        // Clear screen
        App.Clear();

        // Draw the sprite
        App.Draw(Tile);

        // Update the window
        App.Display();

    }

    return EXIT_SUCCESS;
}


Is there a way to directly display the image? Thanks.  :)
If at first you don't succeed..

DO IT AGAIN!!1

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Image Feathering
« Reply #1 on: October 30, 2011, 01:36:30 am »
Img.SetSmooth(false);
This isn't "feathering," it's a bilinear filter. It's disabled by default in SFML2.
I use the latest build of SFML2

Skate1168

  • Newbie
  • *
  • Posts: 2
    • MSN Messenger - Skate1168@live.com
    • View Profile
    • http://s4.zetaboards.com/GJS_studios/index
    • Email
Image Feathering
« Reply #2 on: October 30, 2011, 04:31:33 pm »
Thanks! This fixed the problem perfectly.

Bilinear filter. Good to know. I will try to get my graphics terms right. ^_^
If at first you don't succeed..

DO IT AGAIN!!1

 

anything