HighTechTalks DotNet Forums  

Draw warp image (perspective)

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Draw warp image (perspective) in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Andrew Deren
 
Posts: n/a

Default Draw warp image (perspective) - 05-09-2007 , 03:01 PM






Is there a way in GDI+ to draw image with perspective warp?
There is a way to have perspective warp on GraphicsPath, but I can't find a
way to draw image like that.
Thanks.

Reply With Quote
  #2  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Draw warp image (perspective) - 05-09-2007 , 03:18 PM






Hmm, here's a weird idea...

Create a GraphicsPath with as many points as you have pixels in the image.

Warp it.

Map the warped pixels back to the bitmap pixels and copy the image to a
second bitmap using LockBits.

It'd be fascinating if it worked...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Andrew Deren wrote:
Quote:
Is there a way in GDI+ to draw image with perspective warp?
There is a way to have perspective warp on GraphicsPath, but I can't find a
way to draw image like that.
Thanks.

Reply With Quote
  #3  
Old   
Andrew Deren
 
Posts: n/a

Default Re: Draw warp image (perspective) - 05-09-2007 , 03:52 PM



It would probably work, but the problem is that my images are about 3000x3000
pixels in size.
Also, with this I won't have any anti-aliasing, and the output image will
probably look bad.


"Bob Powell [MVP]" wrote:

Quote:
Hmm, here's a weird idea...

Create a GraphicsPath with as many points as you have pixels in the image.

Warp it.

Map the warped pixels back to the bitmap pixels and copy the image to a
second bitmap using LockBits.

It'd be fascinating if it worked...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Andrew Deren wrote:
Is there a way in GDI+ to draw image with perspective warp?
There is a way to have perspective warp on GraphicsPath, but I can't find a
way to draw image like that.
Thanks.


Reply With Quote
  #4  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Draw warp image (perspective) - 05-09-2007 , 04:17 PM



I bet you don't have a 3000 by 3000 screen to display them on and the
antialiasing after the warp would look pretty good I bet.

You could use displacement maps such as those used to define ripples ad
so-on.

You could also calculate the positions with a fairly simple scan-line
conversion.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Andrew Deren wrote:
Quote:
It would probably work, but the problem is that my images are about 3000x3000
pixels in size.
Also, with this I won't have any anti-aliasing, and the output image will
probably look bad.


"Bob Powell [MVP]" wrote:

Hmm, here's a weird idea...

Create a GraphicsPath with as many points as you have pixels in the image.

Warp it.

Map the warped pixels back to the bitmap pixels and copy the image to a
second bitmap using LockBits.

It'd be fascinating if it worked...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Andrew Deren wrote:
Is there a way in GDI+ to draw image with perspective warp?
There is a way to have perspective warp on GraphicsPath, but I can't find a
way to draw image like that.
Thanks.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.