Author Topic: invalid floating point operation  (Read 2053 times)

Offline wchris

  • Imaging User
  • *
  • Posts: 3
    • View Profile
invalid floating point operation
« on: 15 December 2012, 19:25:59 »

I have just discovered Vampyre Imaging Library a few weeks ago. Sofar i'm impressed by the work done. Congrats

So I'm a newbie, still learning, and maybe it's not a bug but my fault ? I don't know.

I have prepared a small demo of my code with 4 buttons.

The 2 first button draw an image with alpha transparancy on another image without transparancy and work ok.

The 2 last button attempt to draw the same image with alpha transparancy, but this time on another image WITH alpha transparancy. And I get an "invalid floating point operation".

I use Delphi XE2 Starter, on Windows 7 32bits, and VIL 0.26.4

I have included the required assets in the subdirectories \debug and \release

Cheers  :)

Edit : just found out about 0.78 ... maybe i'll give this version a try  8)

RE-EDIT: works perfectly with latest source code 0.78 !!! Nothing to do !  ;D I can go on, Thank you vervy much !
« Last Edit: 16 December 2012, 15:37:54 by wchris »

Offline wchris

  • Imaging User
  • *
  • Posts: 3
    • View Profile
Re: invalid floating point operation
« Reply #1 on: 17 December 2012, 11:37:40 »
Hello again,

I still have one stupid question. (I say stupid because I have the feeling there's a perfectly logical explanation, but I can't figure out why myself)

in 0.78 this time.

why if I do   Image1.Picture.Graphic.Assign(MainImage); once transparancy works.

but if I do it twice


I loose the transparancy of the main background image ? shouldn't it give the same result ?


If you pass by  ;)
Thank you

PS: the annoying thing is of course that in my own code (the real one, not the alpha example above) I must re-do assign when I dynamically change the image watermark.

EDIT: Ok finally got a workaround like this :

  Image1.Picture.Bitmap := TImagingBitmap.Create;

If there's a better way, please tell me  8)

EDIT : I seemed to work, but i get an AV later in my component when I free & recreate the bitmap. Will have to find another way to keep transparency when re-assigning.

Finally I ended up doing this :

  Image1.Picture := Tpicture.Create;
  Image1.Picture.Bitmap := TImagingBitmap.Create;

Quite sure there's a direct faster way, but can't figure it out.
« Last Edit: 18 December 2012, 22:31:07 by wchris »

Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 358
    • View Profile
    • Galfar's Homepage
Re: invalid floating point operation
« Reply #2 on: 3 January 2013, 20:36:17 »

of what type exactly is MainImage?

Basically you must make sure that
Image.Picture.Bitmap (Image.Picture.Graphic) is of TImagingBitmap type before assigning.
If regular VCL TBitmap is there then transparency won't work.

What works for me is this:
Code: Pascal
  1. // app start
  2. ImagingGraphic := TImagingBitmap.Create;
  3. Image.Picture.Graphic := FBitmap;
  4. ...
  5. // image was updated
  6. ImagingGraphic.Assign(MainImage);
  7. Image.Picture.Assign(nil);
  8. Image.Picture.Assign(ImagingGraphic);
  9. ...
  10. // app exit
  11. Image.Picture.Assign(nil);
  12. ImagingGraphic.Free;

Offline wchris

  • Imaging User
  • *
  • Posts: 3
    • View Profile
Re: invalid floating point operation
« Reply #3 on: 10 February 2013, 15:19:56 »
Hello there  :)

As I had a workaround I did not comme often here lately.

But now that I have spotted your answer I'll check it out.

Thank you very much  8)