• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Recent posts

Pages 1 ... 3 4 5 6 7 8 9 10
51
Help & Questions / Re: fpc compiler warnings in p...
Last post by heju - 2 December 2018, 11:54:18
Hi,

thanks for the fast response!

I gave ptr2int = ptruInt; a try: No obvious problems so far.
Would there be a kind of unit test for the library to confirm everything is ok after changing such small but maybe important things?

Btw I noticed another warning, this time in the jpeg code:
I always try to test run my code using all compiler checks on. I noticed that in the jpeg code a range check error is triggered in file imjdphuff.pas

Dec(entropy^.restarts_to_go); (several occurrences, the value to be decremented is zero)

Seems to be ok if
if entropy^.restarts_to_go >0 then

is added before these lines. However I did not have a closer look if this a good idea (maybe the underflow is somehow useful?


52
Help & Questions / Re: fpc compiler warnings in p...
Last post by Galfar - 2 December 2018, 02:23:44
Hi,

I think best would be to try PtrUInt and check if there are any problems (loading and saving PNGs is where zlib is ued in Imaging).
Keep in mind that the comment is maybe 20 years old now from the times of Delphi v3 or something like that.

Quick google search found some updated zlib -> Pascal translation where"ptr2int = NativeUInt"  and in FPC "NativeUInt = PtrUInt".
Also when I look where ptr2int is used and to the original C code, it looks it's really just used to do pointer arithmetics in
old Delphi versions.

53
Help & Questions / fpc compiler warnings in png d...
Last post by heju - 1 December 2018, 20:25:53
Hi,

when compiling I noticed a flood of compiler warnings similar to this one:

imzdeflate.pas(1121,40) Warning: Conversion between ordinals and pointers is not portable

Seems to originate from:

imzutil.pas

  ptr2int = uInt;
{ a pointer to integer casting is used to do pointer arithmetic.
  ptr2int must be an integer type and sizeof(ptr2int) must be less
  than sizeof(pointer) - Nomssi }

I was tempted to just change this to
  ptr2int = ptruInt;

However the comment explicitly advises to use a type smaller than sizeof(pointer).

Thanks in advance for any advice!




54
Open Discussion / Re: Blending destination canva...
Last post by Segator - 1 December 2018, 16:46:40
Thanks you a lot for the fix i attach other of this type of image.
55
Open Discussion / Re: Blending destination canva...
Last post by Galfar - 1 December 2018, 00:54:20
Thanks for the report.
I've just pushed the fix to the repository.
Nice "unusual" files to add to my test image suite :)
56
Bugs And Other Insects / Re: Premultiply and Unpremulti...
Last post by Galfar - 30 November 2018, 23:42:30
Thanks, that's indeed a bug.
Just pushed your fix to the repo.
57
Help & Questions / Re: Convert png with transpare...
Last post by Galfar - 30 November 2018, 23:37:21
Well, if you want to replace just one color (classic color keying) then you can use ReplaceColor function from Imaging.pas unit.
I somehow assumed that by transparency you mean full alpha channel.
58
Bugs And Other Insects / Premultiply and Unpremultiply
Last post by Patman - 30 November 2018, 17:32:25
ImagingCanvases.pas:

function TransformPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
begin
  Result.A := Pixel.A;
  Result.R := Result.R * Pixel.A;
  Result.G := Result.G * Pixel.A;
  Result.B := Result.B * Pixel.A;
end;

function TransformUnPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
begin
  Result.A := Pixel.A;
  if Pixel.A <> 0.0 then
  begin
    Result.R := Result.R / Pixel.A;
    Result.G := Result.G / Pixel.A;
    Result.B := Result.B / Pixel.A;
  end
  else
  begin
    Result.R := 0;
    Result.G := 0;
    Result.B := 0;
  end;
end;


IMHO the alpha operations on Result.R, Result.G and Result.B should be on Pixel.R, Pixel.G and Pixel.B:

function TransformPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
begin
  Result.A := Pixel.A;
  Result.R := Pixel.R * Pixel.A;
  Result.G := Pixel.G * Pixel.A;
  Result.B := Pixel.B * Pixel.A;
end;

function TransformUnPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
begin
  Result.A := Pixel.A;
  if Pixel.A <> 0.0 then
  begin
    Result.R := Pixel.R / Pixel.A;
    Result.G := Pixel.G / Pixel.A;
    Result.B := Pixel.B / Pixel.A;
  end
  else
  begin
    Result.R := 0;
    Result.G := 0;
    Result.B := 0;
  end;
end;


59
Open Discussion / Blending destination canvas ca...
Last post by Segator - 28 November 2018, 22:36:54
Hi Imaging users, first of all thanks to the creator for the great job of Vampyre Imaging Libray.

As the subject say (and i site the 922 line of ImagingCanvases.pas for the raised error create), my problem is with this type of image, specific MNG or APNG (Animated PNG), take the LCL Imager as example project (my project is other but i think if we can fix here, i can fix in my own), so when you try to load specific type of PNG animated this exception show and no image is show, i attach 2 imagen example below.

Test the issue with Lazarus 1.8.4, Lazarus trunk 2.1.0, Linux, Windows, 32 and 64bits.
60
Bugs And Other Insects / Re: Problem for 64bit
Last post by Phoenix - 15 October 2018, 10:47:41
Sorry for the late reply (I'm not registered on the site and I do not receive an email alert).

IMPORTANT NOTE
Even if you use Windows 64bit, if you compile for example with Lazarus 32bit you can not have this problem.

Unfortunately, the memory violation has unpredictable effects.

- You can try to change the two lines of suspicious code

  If you use Lazarus (32 / 64bit):
   uInt = NativeUInt
   ptr2int = PtrUInt

  If you use Delphi (depends on the version):
   http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.NativeUInt
   in theory for 64bit if you use "Int64" it's ok
   For ptr2int see my post

- RESTART the computer (in Windows 10, shut down the system should be similar to a hibernation) to "clean" the corrupted memory.
- Build the library (separately if you use it as a package) and the program

If you see differences with your problem you will have confirmation  ;).
Pages 1 ... 3 4 5 6 7 8 9 10
SMF spam blocked by CleanTalk