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
 How to calculate Opacity properly
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
728 Posts

Posted - Jan 04 2014 :  08:28:58  Show Profile  Reply
Hello,

I am attaching an image with this post which contains a few layers whose Opacity is set at 99 but ImageEn reports 0.988235294117647 (Layer 1 & 4)

In the same way if the Opacity is set at 98 ImageEn reports 0.980392156862745 (Layer 6)

Again Opacity 91 is reported as 0.909803921568627 (Layer 3)

Now trying to multiply above value by 100 would give me 98 in case of Layer 1, 4 & 9.

How to get the exact value of 99 and 99?

TIA

Yogi Yang

Download Attachment: 20141482733_SampleImage_008.zip

w2m

USA
1990 Posts

Posted - Jan 04 2014 :  09:03:15  Show Profile  Reply
var
iLayerOpacity: double;
iLayerOpacityString: string;
iLayerOpacity := ImageEnView.Layers[i].Opacity * 100;
iLayerOpacityString := FormatFloat('0',iLayerOpacity); //show 98
... or ...
iLayerOpacityString := FormatFloat('###',iLayerOpacity); //show 98

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

yogiyang

India
728 Posts

Posted - Jan 04 2014 :  23:14:10  Show Profile  Reply
William,

Thanks for the suggestion.

I think I have found a solution to this problem.

Round(Layers[I].Opacity * 100)


If you feel this is wrong please do correct me.

Regards,


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: