Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, August 7, 2012 3:34:52 AM(UTC)

Groups: Registered
Posts: 9


I am using WPF SDK for loading the TIF files. I am using 17.5 version.

I want to achieve a functionality, in which I want to render a particular part of the TIF image (using a rectangle using x,y screen coordinates).

Please let me know whether it is achievable through lead tools or not.

Attached is the image which will give you more insight.

rkishore attached the following image(s):

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, August 7, 2012 10:29:32 AM(UTC)


Groups: Tech Support
Posts: 367

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)


There are at least two different ways this can be accomplished. The first would be to use the CopyRectangleCommand. Since you know the coordinates of the area you want to display, you can use this image processing command copy that specific area. The command will create a new image of just that rectangle, which you can then use to display.

Another alternative would be to do some image processing on the source image directly. With the AlphaBlendCommand, you can create another image that is the same size as your source image. You would then use the FillCommand to make the area you do not want displayed to be white. The area you want to be displayed will be black. Then combine the two images with AlphaBlend.

Here is some pseudo-code (Note: this will not compile):

//Get a handle the image
RasterImage srcImage = rasterImageViewer1.Image;

//Make copy
RasterImage maskImage = new RasterImage(srcImage);

FillCommand fillCmd = new FillCommand(white);

//Fill the whole image with white

LeadRect rect = new LeadRect(100, 100, 100, 200);

//Create a rectangle in the image to only be filled
maskImage.AddRectangleToRegion(rect, RasterRegionCombineMode.Set);

//Fill the area we want to remain visible with black
fillCmd.Color = new RasterColor(black);

//get rid of the prior set rectangle

//Combine the images
AlphaBlendCommand alphaBlendCmd = new AlphaBlendCommand();
alphaBlendCmd.DestinationRectangle = new LeadRect(0, 0, maskImage.Width, maskImage.Height);
alphaBlendCmd.SourceImage = maskImage;
alphaBlendCmd.Opacity = 255;

There may be other ways to accomplish this, but I think these two would be the easiest depending on which resultant output you would prefer.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#3 Posted : Wednesday, August 8, 2012 4:52:17 AM(UTC)

Groups: Registered
Posts: 9

Thanks for Reply,
First approached worked :)

Edited by moderator Thursday, November 24, 2016 9:58:16 AM(UTC)  | Reason: Not specified

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.146 seconds.