Page 1 of 1

Problem with gflSetColorAt - always GFL_Error=50

Posted: Thu Aug 06, 2009 10:12 am
by reggi
Hi

I have next problem with new version of the library. Look into the code below (it's simplistic version of my code, but error occur):

Code: Select all

        for x:=10 to gfl_bmp.Width-10 do
        begin
            for y:=10 to gfl_bmp.Height-10 do
            begin
                     
                 gflGetColorAt(gfl_bmp, x, y, colorSrc);
                 
                 colorSrc.Blue := colorSrc.Blue div 2;
                 colorSrc.Green := colorSrc.Green div 2;
                 colorSrc.Red :=   colorSrc.Red div 2;
                          
                 E := gflSetColorAt(gfl_bmp, x, y, colorSrc); // HERE IS THE POBLEM
            end;
        end;
Every iteration E is equal 50 (GFL_ERROR_BAD_PARAMETERS). Why? The code is correct, gflGetColorAt works correctly, image is correct (program show it but without changes). Maybe the parameters in libgfl.pas are wrongs, but how they should be?

Re: Problem with gflSetColorAt - always GFL_Error=50

Posted: Thu Aug 06, 2009 11:04 am
by reggi
Curious issue. I tried to change declaration of this function to the form:

Code: Select all

function gflSetColorAt(src: PGFL_BITMAP; x, y: GFL_INT32; var color: int64): GFL_ERROR; stdcall; 
and then will use it in the loop like below:

Code: Select all

color := 255; // color is int64 type
gflSetColorAt(gfl_bmp, x, y, color);
it will be working correctly (fill th rectangle with red color).

Re: Problem with gflSetColorAt - always GFL_Error=50

Posted: Mon Aug 10, 2009 12:05 pm
by xnview
Your picture is 8bits or 24?

Re: Problem with gflSetColorAt - always GFL_Error=50

Posted: Mon Aug 10, 2009 12:47 pm
by reggi
Every picture is 24 bit

Re: Problem with gflSetColorAt - always GFL_Error=50

Posted: Mon Aug 10, 2009 12:55 pm
by xnview
reggi wrote:Every picture is 24 bit
With C/C++, i have no problem...