Page 1 of 1

AddText on 16-bit files

Posted: Tue Feb 26, 2008 5:42 pm
by pber
Hello,
I'm trying to write text with the gflAddText function, on a 16-bit image (16 bits per color).
Whatever the depth of my pasted color (8 or 16 bits), gflAddText returns GFL_ERROR_BAD_PARAMETERS.

Is it normal?

[I'm using my C# wrapper upon the dll]

Code: Select all

            GFL_FILE_INFORMATION info = new GFL_FILE_INFORMATION();
            GFL_BITMAP bmp = new GFL_BITMAP();
            GFL_BITMAP bmp2 = new GFL_BITMAP();
            GFL_ERROR err = new GFL_ERROR();
            GFL_LOAD_PARAMS ldp;
            GFL_COLOR clr = new GFL_COLOR();
            GFL_SAVE_PARAMS svp = new GFL_SAVE_PARAMS();

            GFL_COLOR clr2 = new GFL_COLOR();
            clr2.Alpha = 0;
            clr2.Blue = 157;
            clr.Green = 250;
            clr2.Red = 54;

            gflGetDefaultLoadParams(out ldp);
            ldp.Flags |= GFL_LOAD_FLAGS.GFL_LOAD_ORIGINAL_DEPTH;
            ldp.FormatIndex = gflGetFormatIndexByName("tiff");
            Console.WriteLine("lformat index: " + ldp.FormatIndex);

            err = gflLoadBitmap("16bit.tif", out bmp, ref ldp, ref info);
            Console.WriteLine("load: " + err);

            err = gflGetColorAt(ref bmp, 1200, 825, ref clr);
            Console.WriteLine("color: " + err);
            Console.WriteLine(clr.Alpha + "\t" + clr.Blue + "\t" + clr.Green + "\t" + clr.Red);

            err = gflAddText(ref bmp, "Hello", "Arial", 150, 150, 25, 330, true, true, false, true, false, ref clr2); // same with ref clr
            Console.WriteLine("addtext: " + err);

            svp.FormatIndex = gflGetFormatIndexByName("tiff");

            err = gflSaveBitmap("Result.tif", ref bmp, ref svp);
            Console.WriteLine("Save: " + err);

Re: AddText on 16-bit files

Posted: Tue Feb 26, 2008 7:14 pm
by xnview
pber wrote:Hello,
I'm trying to write text with the gflAddText function, on a 16-bit image (16 bits per color).
Whatever the depth of my pasted color (8 or 16 bits), gflAddText returns GFL_ERROR_BAD_PARAMETERS.

Is it normal?
Yes currently gflAddText works only on 8bits picture