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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnVect - Magnify a section of image

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
stwizard Posted - May 02 2014 : 07:21:38
Greetings All,

ImageEn v5.0.5
Delphi XE5

I use a TImageEnVect component to display a 8.5" x 11" document (The entire document). Doing so of course makes the font small on the entire document making it readable, but just barely.

In the lower left corner of all documents if a unique identification code. Is it possible to add a rectangular magnifier in the lower left corner of the image of a size I specify to magnify this portion of the document? I want to be able to turn this feature on or off, but will automatically display if turned on.

Any sample code would be wonderful.

Thanks,
Mike
2   L A T E S T    R E P L I E S    (Newest First)
stwizard Posted - May 05 2014 : 04:53:48
Thank you for the quick reply.

I have tested many variants of your code in my project and it just does not work as expected for my purposes, so I cam up with another idea and will ask it in a separate thread.

Thanks,
Mike
w2m Posted - May 02 2014 : 08:12:28
The only way to magnify a portion of the image is with a magnify layer. See the Layers Demo.
procedure TForm1.MagnifyLayer1Click(Sender: TObject);
{ Create a magnify layer. }
{ Note: This only works if LayersSync is False }
var
  iLayer: Integer;
begin
  with ImageEnView1 do
  begin
    iLayer := LayersAdd;    { Make the layers box visible and selectable and draw a box around the layer }
Note: If you do not want the layer to be selectable or moveable because it will always be at the same position then comment the next 3 lines or set all 3 to False. } 
    CurrentLayer.VisibleBox := True;
    CurrentLayer.Selectable := True;
    LayersDrawBox := True;
    { Give the layer a name }
    Layers[iLayer].name := 'Magnifier';
    { Set the layers dimensions }
    Layers[iLayer].Width := 320;
    Layers[iLayer].Height := 240;
    { Set the layers position }
    Layers[iLayer].PosX := 0;
    Layers[iLayer].PosY := Layers[0].Bitmap.Height - Layers[iLayer].Height;
    CurrentLayer.Magnify.Source := iemBackgroundLayer;
    { Enable a magnified layer }
    CurrentLayer.Magnify.Enabled := MagnifiedEnabled1.EditValue;
    { Set the Magnification }
    CurrentLayer.Magnify.Rate := Magnification1.EditValue;
    { Set magnify style }
    CurrentLayer.Magnify.Style := iemRectangle;
    { Optional }
    { Allow selecting layers }
    SelectLayers1.Down := True;
    MouseInteract := [miMoveLayers, miResizeLayers];
    Gestures.Pan.Enabled := False;
    Gestures.Zoom.Enabled := False;
    Gestures.LayerRotate.Enabled := False;
    Gestures.LayerMove.Enabled := True;
    Update;
  end;
end;


To turn the magnifier off then remove the layer:
{ Remove the layer from ImageEnView }
{ Get the layer to be deleted }
  iLayer := ImageEnView1.LayersCurrent;
  ImageEnView1.LayersRemove(iLayer);
  ImageEnView1.Update;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom Commercial ImageEn Development