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
 Rotate selected Image by program
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

dpp

Germany
3 Posts

Posted - Sep 20 2012 :  00:56:13  Show Profile  Reply
Rotation with mouse and [miRotateLayers] works perfect.
How can I use this by Program or with a Scrollbar or Trackbar
in the same way. I will rotate a selected circle-Range and then compare with a Mask to get the right position Angle and Maintain the size. If I try this with following Code:

IV3.CurrentLayer.Rotate:=AdvTrackBar1.Position;
IV3.LayersFixRotations();
IV3.Update;
IV3.Fit;
then It works slow and there ar distorsions.
Can someone help me

xequte

38610 Posts

Posted - Sep 20 2012 :  02:40:16  Show Profile  Reply
Hi

I think this code would cause too many updates. What you want to do is update it every second or so after the trackbar has changed.

So add a timer (Enabled=False, Interval=750) and in its OnTimer event:
procedure MyTimerTimer();
begin
  MyTimer.Enabled := False;
  IV3.CurrentLayer.Rotate := AdvTrackBar1.Position;
  IV3.LayersFixRotations;
  IV3.Update;
  IV3.Fit;
end;


And in the AdvTrackBar1 OnChange event:
procedure AdvTrackBar1Change();
begin
  // Reset the timer
  MyTimer.Enabled := False;
  MyTimer.Enabled := True;
end;



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

dpp

Germany
3 Posts

Posted - Sep 20 2012 :  09:44:18  Show Profile  Reply
Thank's for your quickly answer.
It solve not the Problem.
I use the following code:

IV2.LayersCurrent:=0;
IV2.SelectEllipse(center.x,center.y,2*Radius.Value,2*Radius.Value);
IV3.Bitmap.SetSize(2*Radius.Value,2*Radius.Value);
IV2.CopySelectionToIEBitmap(IV3.Layers[0].Bitmap);
IV2.CopySelectionToIEBitmap(IV3.Layers[1].Bitmap);
IV3.Update;
IV3.Fit;
IV2.DeSelect;
IV3.Zoom:=60

the Zoom is for have place for Mouse for rotating.
If I move the mouse even very quickly, the Rotation takes place
in high quality an speed.
But if i tray to use IV3.proc.rotate(..
or

Timer1.Enabled := False;
IV3.Proc.Rotate(AdvTrackBar1.Position,true,ierBicubic);
IV3.LayersFixRotations();
IV3.LayersFixSizes();
IV3.LayersFixBorders();

or

// IV3.CurrentLayer.Rotate := AdvTrackBar1.Position;
// IV3.LayersFixRotations;
IV3.Update;

then it is still very slow and after repeated rotation the Image
becomes distorted.
How can I do the same Rotation that takes place with Mouse by program?
with steps in 1.25° or 0.75° e.g.


Thanks for your answer
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: