Problems Skewing Image (Trapezoid) with Graphics2D  
Author Message
Roland Poellinger





PostPosted: 2005-2-18 8:12:00 Top

java-programmer, Problems Skewing Image (Trapezoid) with Graphics2D hello!
right now i am working on a graphical output for a video projector. the
projection will be thrown on the wall from a little off center, so that i
will get the picture as a vertical trapezoid (the projectors i am using are
only able to correct horizontal trapezoids). my java program will have to
correct the effect. therefore i need to transform my graphics2d buffered
image NOT shearing the image, but genuinly skewing the image (that is two
parallel sides and two non parallel ones), as it would probably be possible
in java3d with the tilting of a plane.
how is it possible to skew rectangles with graphics2d?
thanks in advance!
roland

 
Martha Goys





PostPosted: 2005-2-18 13:11:00 Top

java-programmer >> Problems Skewing Image (Trapezoid) with Graphics2D Roland Poellinger wrote:
> hello!
> right now i am working on a graphical output for a video projector. the
> projection will be thrown on the wall from a little off center, so that
> i will get the picture as a vertical trapezoid (the projectors i am
> using are only able to correct horizontal trapezoids). my java program
> will have to correct the effect. therefore i need to transform my
> graphics2d buffered image NOT shearing the image, but genuinly skewing
> the image (that is two parallel sides and two non parallel ones), as it
> would probably be possible in java3d with the tilting of a plane.
> how is it possible to skew rectangles with graphics2d?
> thanks in advance!
> roland


I believe Graphics2d is limited to affine transformations (i.e. matrix),
which are not capable of performing the transformation you describe.
Please see the AffineTransform javadocs:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/AffineTransform.html

Sounds as if you would need to create your own transformation.

Best,

M

--
Remove BEFOREFLIGHT to email
 
Roland Poellinger





PostPosted: 2005-2-18 18:26:00 Top

java-programmer >> Problems Skewing Image (Trapezoid) with Graphics2D >
> Sounds as if you would need to create your own transformation.
>
thanks for answering - what were you thinking of as my "own transformation"?
would that be mapping the buffered image onto an array and performing
operations on that array? or did you have something else in mind?
greetings - roland