Problem with gflSetColorAt - always GFL_Error=50

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

reggi
Posts: 16
Joined: Thu Sep 16, 2004 1:32 pm

Problem with gflSetColorAt - always GFL_Error=50

Post 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?
reggi
Posts: 16
Joined: Thu Sep 16, 2004 1:32 pm

Re: Problem with gflSetColorAt - always GFL_Error=50

Post 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).
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by xnview »

Your picture is 8bits or 24?
Pierre.
reggi
Posts: 16
Joined: Thu Sep 16, 2004 1:32 pm

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by reggi »

Every picture is 24 bit
User avatar
xnview
Author of XnView
Posts: 36318
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by xnview »

reggi wrote:Every picture is 24 bit
With C/C++, i have no problem...
Pierre.