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

invalid floating point operation

Started by wchris, 15 December 2012, 19:25:59

Previous topic - Next topic

wchris

15 December 2012, 19:25:59 Last Edit: 16 December 2012, 15:37:54 by wchris
hello,

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 !

wchris

17 December 2012, 11:37:40 #1 Last Edit: 18 December 2012, 22:31:07 by wchris
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

  Image1.Picture.Graphic.Assign(MainImage);
  Image1.Picture.Graphic.Assign(MainImage);

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

:o

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.Graphic.Assign(MainImage);
  Image1.Picture.Bitmap.Free;
  Image1.Picture.Bitmap := TImagingBitmap.Create;
  Image1.Picture.Graphic.Assign(MainImage);

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.Graphic.Assign(MainImage);
  ...
  Image1.Picture.Free;
  Image1.Picture := Tpicture.Create;
  Image1.Picture.Bitmap := TImagingBitmap.Create;
  Image1.Picture.Graphic.Assign(MainImage);

Quite sure there's a direct faster way, but can't figure it out.

Galfar

Hi,

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) Select
// app start
ImagingGraphic := TImagingBitmap.Create;
Image.Picture.Graphic := FBitmap;
...
// image was updated
ImagingGraphic.Assign(MainImage);
Image.Picture.Assign(nil);
Image.Picture.Assign(ImagingGraphic);
...
// app exit
Image.Picture.Assign(nil);
ImagingGraphic.Free;

wchris

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)

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk