Problem with gflSetColorAt - always GFL_Error=50

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

Moderators: XnTriq, xnview

Post Reply
User avatar
reggi
Posts: 16
Joined: Thu Sep 16, 2004 1:32 pm
Contact:

Problem with gflSetColorAt - always GFL_Error=50

Post by reggi » Thu Aug 06, 2009 10:12 am

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?

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

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by reggi » Thu Aug 06, 2009 11:04 am

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: 32055
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by xnview » Mon Aug 10, 2009 12:05 pm

Your picture is 8bits or 24?
Pierre.

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

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by reggi » Mon Aug 10, 2009 12:47 pm

Every picture is 24 bit

User avatar
xnview
Author of XnView
Posts: 32055
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Problem with gflSetColorAt - always GFL_Error=50

Post by xnview » Mon Aug 10, 2009 12:55 pm

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

Post Reply