Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Started by lazycoder at 07-18-2008 14:05. Topic has 14 replies.

Print Search « Previous Thread Next Thread »
  07-18-2008, 14:05
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I am using C# on .net 3.5 and Leadtools v15.

I have a simple method that does rotation using the RotateCommand. After rotating the image I call refresh on the RasterImageViewer. It all works fine until I make any call to CreateGdiPlusGraphics.

After calling CreateGdiPlusGraphics, any rotation to 90 or 270 degrees causes the image to be displayed on the viewer with its content stretched vertically beyond the surfact of the image. In otherwards, the image is stretched and, basically, truncated. If I save the image it saves fine, so it is just the display in the RasterImageViewer after any call to CreateGdiPlusGraphics that I am having problems with.

Any suggestions?

   Report 
  07-18-2008, 17:14
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
You have to dispose the RasterImageGdiPlusGraphicsContainer once you are done with it.  Are you doing that?

LEADTOOLS Technical Support
   Report 
  07-18-2008, 17:31
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Yes, I'm disposing. It's in a using block.
   Report 
  07-18-2008, 17:43
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Can you post some sample code on what you are doing with it?  Are you accessing the Graphics object of RasterImageGdiPlusGraphicsContainer?  Maybe try calling Dispose() on that Graphics object and then call Dispose() on RasterImageGdiPlusGraphicsContainer.
LEADTOOLS Technical Support
   Report 
  07-18-2008, 18:18
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I'm attaching a sample app that reproduces the issue. Please note that rotation works fine until I call my RenderBorders method. Lead file versions used are: Leadtools.dll 15.0.0.31 Leadtools.Codecs.dll 15.0.0.18 Leadtools.ImageProcessing.Core.dll 15.0.0.9 Leadtools.Winforms.dll 15.0.0.15
   Report 
  07-18-2008, 18:22
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I also tried as you suggested, disposing of the Graphics object before disposing the RasterImageGdiPlusGraphicsContainer object. Problem still exists.
   Report 
  07-21-2008, 10:08
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I'm on the most recent build (15.0.1.x) and the issue is not occurring with me.  I ran your demo app and I hit the Render Border button first.  Then when I hit the Rotate button, it worked fine.  Then I added a gc.Dispose() call and it worked without any problems.  Send an email to support@leadtools.com with your serial number and company name and I will send you the latest patches.  Then you can confirm it on your end.

BTW, I deleted the attachment from you post because it contained an unlock code.  Since the forums are public you should make sure you don't post the unlock codes, serial numbers, or DLLs on the forums.

Thanks.

LEADTOOLS Technical Support
   Report 
  07-21-2008, 11:42
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Oops, sorry about the unlock codes. Completely forgot about those.

I'm downloading the latest patches, etc. Will let you know if it's resolved.

Thanks
   Report 
  07-21-2008, 17:01
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Ok, we downloaded latest patches and I'm still having the issue.

I've attached a couple of screenshots that demonstrate exactly what I'm seeing. If you look at the image before borders are rendered the image is rotated and scaled correctly. If you look at the other image (with_border.jpg) you will see that it is stretched vertically and the right side of the image has been truncated (the mountains in the background are not on the image).

My file versions are:
Leadtools.dll 15.0.1.17
Leadtools.Codecs.dll 15.0.1.11 Leadtools.ImageProcessing.Core.dll 15.0.1.0 Leadtools.Winforms.dll 15.0.1.1

Thanks in advance

   Report 
  07-21-2008, 17:06
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I just noticed something. If I render the borders while the image is at 90 or 270 degrees rotation, then the same stretching problem exists when the image is rotated to 0 or 180 degrees.

Also, I've verified that rendering the borders doesn't even need to happen for the problem to occur. Just making the call to CreateGdiPlusGraphics is enough to cause the problem.
   Report 
  07-22-2008, 11:02
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Oh, I see.  I get that effect.  I was looking at something else before.  Can you post your email address so I can report this issue to our engineers?  If you don't want to post your email just send and email to support@leadtools.com with a link to this post.  Thanks.

LEADTOOLS Technical Support
   Report 
  07-22-2008, 12:16
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I forgot to mention a workaround.  You can use a region to get a border effect.  I would recommended this solution over using the GDI graphics because it can get nasty releasing Graphics objects and such.

int border = 20;    // border size in pixels.
Rectangle viewable = new Rectangle(border, border, _rasterImage.Width - (border * 2), _rasterImage.Height - (border * 2));

// Add border region.
_rasterImage.AddRectangleToRegion(null, viewable, RasterRegionCombineMode.AndNotRegion);

// Fill the region with White color.
FillCommand fillCmd = new FillCommand();
fillCmd.Color = new RasterColor(Color.White);
fillCmd.Run(_rasterImage);

// Clear the region.
_rasterImage.MakeRegionEmpty();


LEADTOOLS Technical Support
   Report 
  07-22-2008, 12:50
lazycoder is not online. Last active: 7/18/2008 6:58:15 PM lazycoder

Not Ranked
Joined on 07-18-2008
Posts 13
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
Thanks for the workaround! It works perfectly.

Unfortunately, this is only one part of the problem for me as I have to do a bunch of text rendering, etc. onto the image. Can you provide any links on how to do text measuring/rendering on an in-memory rasterimage without using the .net graphics object?
   Report 
  07-22-2008, 15:31
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
The only other option for the text rendering is to use Annotations.  Do you have the Document toolkit?  If not then you have to use Leadtools.SpecialEffects.SpecialEffectsProcessor (which still needs a Graphics handle).  There is a method called Draw3dText.  You can draw 2D or 3D text with it.  If you search that method in the help you will find an example for it.

LEADTOOLS Technical Support
   Report 
  07-23-2008, 16:51
jigar is not online. Last active: 10/3/2008 1:08:01 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 421
Re: Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics
Reply Quote
I've reported the incident for the CreateGdiPlusGraphics()/Rotate problem.  The number is 7165IDT.  I'll update this post when it is fixed.

LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Image Display » Veritical rotation (90 or 270) does not display correctly after any call to CreateGdiPlusGraphics

Powered by Community Server, by Telligent Systems