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
 Functionality searched

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
PStadler Posted - Jul 18 2011 : 22:57:38
Hello
In an image database, to avoid multiple copies of the same image, I would need the following functionality:

These images have many details, which should be visible separately. I would like to have the possibility to zoom a rectangular part of the image. Maybe this could be achieved by defining a rectangular part of the image with help of annotations. But if I show thumbnails in an ImageNMView, also only those rectangular sectors should be seen in the thumbnails. I want this without cutting it out from the original image.
What would be the best way to achieve such functionality?

Any ideas appreciated!
Sincerely
Peter
2   L A T E S T    R E P L I E S    (Newest First)
PStadler Posted - Jul 19 2011 : 23:19:48
Hello Fabrizio,

Thanks a lot. I'll give it a try!

Sincerely

Peter
fab Posted - Jul 19 2011 : 14:37:30
Please look this code. It uses the event OnImageIDRequestEx of TImageEnMView to show a thumbnail only when requested.
Actually the requested rectangle is copied two times from the main image (one in the shared object MyBitmap and one inside TImageEnMView), but only when it needs to be displayed. Non-visible thumbnails aren't copied at all.
There aren't other ways using TImageEnMView.


// declare a global TIEBitmap object that will be used in ImageEnMView1ImageIDRequestEx
var MyBitmap:TIEBitmap;

// subrectangles of "image.jpg" to show
const subrects:array [0..3] of TIERectangle = (
  (x:0;   y:0;   width:100; height:100),
  (x:120; y:200; width:80;  height:200),
  (x:0;   y:220; width:300; height:70),
  (x:0;   y:400; width:300; height:70)
);

// Load "image.jpg" and add rectangles defined in "subrects"
procedure TForm1.Button22Click(Sender: TObject);
var
  i:integer;
begin
  MyBitmap := TIEBitmap.Create(); // remember to Free!!
  imageenview1.io.loadfromfile('hongkong.jpg');
  for i:=0 to high(subrects) do
    ImageEnMView1.ImageID[ ImageEnMView1.AppendImage() ] := i;
end;

// copy the requested rectangle when necessary
procedure TForm1.ImageEnMView1ImageIDRequestEx(Sender: TObject; ID: Integer; var Bitmap: TIEBitmap);
begin
  Bitmap := MyBitmap;
  Bitmap.Allocate(subrects[ID].width, subrects[ID].height);
  ImageEnView1.IEBitmap.CopyRectTo(Bitmap, subrects[ID].x, subrects[ID].y, 0, 0, subrects[ID].width, subrects[ID].height);
end;