Total members 11895 |It is currently Wed Dec 18, 2024 6:13 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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 8089 times ]

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada
Author:
Mastermind
User avatar Posts: 2715
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     -  
 need help in java     -  
 What is Java API?!!!     -  
 Using FTP in java     -  
 java or .net     -  
 what is java     -  
 Java course     -  
 XOR Mode in java     -  
 Java programmers     -  
 Suggestion for job in java     -  



Topic Tags

Java Graphics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com