0% found this document useful (0 votes)
21 views5 pages

Computer Graphics Record

The document describes a Java program that implements the Sutherland-Hodgman algorithm for polygon clipping and fill. The program imports graphics libraries and creates a JFrame window. It draws two images - a background image and a moving image. In a for loop, the moving image is redrawn at increasing x coordinates to simulate movement across the screen, with a 10 millisecond delay between redraws. The program successfully implements the Sutherland-Hodgman algorithm for polygon clipping and fill.

Uploaded by

pinky p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

Computer Graphics Record

The document describes a Java program that implements the Sutherland-Hodgman algorithm for polygon clipping and fill. The program imports graphics libraries and creates a JFrame window. It draws two images - a background image and a moving image. In a for loop, the moving image is redrawn at increasing x coordinates to simulate movement across the screen, with a 10 millisecond delay between redraws. The program successfully implements the Sutherland-Hodgman algorithm for polygon clipping and fill.

Uploaded by

pinky p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

OUTPUT:-

Enter the Choice:1


Enter the Choice:2

Enter the Choice:3

RESULT:

Thus the program implementation of Midpoint algorithm for line, circle and ellipse drawing is done
successfully
OUTPUT:-
RESULT:

Thus the program implementation of Sutherland Hodgeman algorithm for polygon fill and clip the polygon is
done successfully
PROGRAM:

import javax.swing.*;
import java.awt.*;
import java.util.concurrent.TimeUnit;
public class Park extends JFrame {
private int frameWidth = 700, frameHeight = 500;
private Image image = new ImageIcon("F:/abc.jpg").getImage();

private Image image1 = new ImageIcon("C:/Users/91807/Desktop/cd.gif").getImage();

public Park() {
setBounds(100, 100, frameWidth, frameHeight);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}

public void paint(Graphics g) {

g.drawImage(image, 0,0,getWidth(),getHeight(),this);
for(int i=0;i<=getWidth();i++)
{
g.drawImage(image, 0,0,getWidth(),getHeight(),this);
g.drawImage(image1, i,getHeight()-100,100,100,this);
try
{
Thread.sleep(10);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
}
}
public static void main(String args[]) {
new Park();
}
}

You might also like