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

Author Topic: Image.createMaskFromColor  (Read 3909 times)

0 Members and 1 Guest are viewing this topic.

nihohit

  • Newbie
  • *
  • Posts: 37
    • View Profile
Image.createMaskFromColor
« on: May 08, 2012, 05:34:08 pm »
When I try to use the command, I get the error message "Unable to find an entry point named 'sfImage_createMaskFromColor' in DLL 'csfml-graphics-2'.". This happens with the 2.0 RC version.

this happens even with

        static int Main(string[] args)
        {
            SFML.Graphics.Image img= new SFML.Graphics.Image(10, 10, SFML.Graphics.Color.White);
            img.CreateMaskFromColor(SFML.Graphics.Color.White);
            return 1;
        }

for now I just iterate over the pixels, but if the function could be fixed, it'll help. Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Image.createMaskFromColor
« Reply #1 on: May 08, 2012, 07:01:52 pm »
You're right, the function is missing from the DLL. But to be honest, I don't know why: the function is properly defined and exported in CSFML. I can't see the difference between this function and the others.

 ???
Laurent Gomila - SFML developer

nihohit

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Image.createMaskFromColor
« Reply #2 on: May 09, 2012, 10:34:53 am »
is this function a reasonable replacement, or is there a more efficient way?

            for (uint i = 0; i < img.Size.X; i++)
            {
                for (uint j = 0; j < img.Size.Y; j++)
                {
                    if (img.GetPixel(i, j).Equals(Color.White))
                    {
                        img.SetPixel(i,j,new Color(0,0,0,0));
                    }
                }

            }

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Image.createMaskFromColor
« Reply #3 on: May 09, 2012, 10:43:38 am »
Retrieving the whole array of pixels, working on it and then setting it back would probably be much faster.
Laurent Gomila - SFML developer

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
Re: Image.createMaskFromColor
« Reply #4 on: May 09, 2012, 10:46:09 am »
Yeah, you need to lock bitmap bits and work on that to perform with any reasonable speed.

nihohit

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Image.createMaskFromColor
« Reply #5 on: May 11, 2012, 01:26:10 pm »
thank you very much.

laurent - how can UI set it back? Image.Pixels is readonly, and the array doesn't have x,y coordinates to use in Image.setPixel.

omeg - I'm not certain I know what you're talking about. Can you please explain?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Image.createMaskFromColor
« Reply #6 on: May 11, 2012, 01:34:04 pm »
There's no setter for the whole pixel array, just create a new Image instance with the modified array.
Laurent Gomila - SFML developer