Total members 11609 |It is currently Tue Feb 21, 2017 3:49 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka

All times are UTC [ DST ]



  Shearing in java
Tue Nov 11, 2008 9:15 pm 

Shearing in java graphics
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class 
ShearWithTransform extends JComponent {
  
Shape shape;
  
   public 
ShearWithTransform() {
    
shape create();
  }
  private 
Shape create() {
    return new 
Ellipse2D.Double(1005010050);
  }
  public 
void paint(Graphics g) {
    
Graphics2D g2d = (Graphics2Dg;
    
AffineTransform affineTransform1 AffineTransform.
          
getTranslateInstance(00);
    
g2d.transform(affineTransform1);
    
g2d.setPaint(Color.red);
    
g2d.draw(shape);

    
AffineTransform affineTransform2 AffineTransform.
          
getTranslateInstance(00);
      
affineTransform2.shear(-.80);
      
g2d.transform(affineTransform2);
      
g2d.transform(AffineTransform.getTranslateInstance(100100));
      
    
Stroke stroke = new BasicStroke(1BasicStroke.CAP_BUTT,
        
BasicStroke.JOIN_BEVEL0, new float[] { 3}, 0);
    
g2d.setStroke(stroke);
    
g2d.draw(shape);
  }
  public static 
void main(String[] a) {
    
JFrame frame = new JFrame("Shear the oval");
    
frame.getContentPane().add(new ShearWithTransform());
    
frame.setSize(300250);
    
frame.show();
  }




Attachments:
File comment: shear in java
shear.gif
shear.gif [ 4.96 KiB | Viewed 4628 times ]

_________________
Please recommend / share my post if you found it helpful.
Author:
Mastermind
User avatar Posts: 2702
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Shearing in java
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 java     -  
 Java course     -  
 Using FTP in java     -  
 What is Java API?!!!     -  
 java or .net     -  
 need help in java     -  
 what is java     -  
 java Clipping     -  
 Java Blog     -  

All times are UTC [ DST ]



Topic Tags

Java Graphics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team