ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Floating point division by zero in ImageEnProc
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ksv1991

Ukraine
5 Posts

Posted - Aug 20 2011 :  02:40:20  Show Profile  Reply
Hello,

I have tried ImageEnProc.Rotate procedure, but i receive message "Floating point division by zero" in module ImageEnProc on row:
per := 100 / (dst.Height);

Why can it happen?

fab

1310 Posts

Posted - Aug 20 2011 :  04:02:54  Show Profile  Reply
Hello,
please add other details:

1) is the TImageEnProc component attached to another component like TImageEnView, TIEBitmap, etc...?

2) which is the size of the image? How have you loaded it?
Go to Top of Page

ksv1991

Ukraine
5 Posts

Posted - Aug 20 2011 :  05:14:43  Show Profile  Reply
Problem was solved independently. It was not working, because wrong image was loaded in the ImageEnProc.

But now there's another problem:
I can not change the background color of the rotated image. I put the value of: 0, 255, 1, clWhite, but background is always black.
Go to Top of Page

fab

1310 Posts

Posted - Aug 20 2011 :  05:38:06  Show Profile  Reply
Rotate method allows to specify the color of the new area necessary to make rotated image.
For example, this...

ImageEnView.Proc.Rotate(45, false, ierFast, clRed);

...will fill the added angles with clRed.

If you want to change the background of the image then there are other options, depending by the image (has it alpha channel? has it a specific previous background color?).

Please add details, code and images if possible.
Go to Top of Page

ksv1991

Ukraine
5 Posts

Posted - Aug 20 2011 :  06:43:21  Show Profile  Reply
The sample of code:


Proc:=TImageEnProc.CreateFromBitmap(Image);
Proc.Rotate(45,false,ierFast,clWhite);



The image is in binary format (PixelFormat:=ie1g). Image not has alpha channel.
But result is here:

Go to Top of Page

fab

1310 Posts

Posted - Aug 20 2011 :  08:33:58  Show Profile  Reply
Please execute this:
Proc:=TImageEnProc.CreateFromBitmap(Image);
Proc.Rotate(45, true, ierFast, clWhite);  // << "true" instead of "false"

For optimization reasons Rotate, with antialias disabled, sets always background to black.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: