paint application in java clark jayson cacal aveline germar jose sison christopher valera
TRANSCRIPT
Paint Application in Java
Clark Jayson CacalAveline Germar
Jose SisonChristopher Valera
Image Processing
• The image is colored per pixel.
• Each pixel has a RGB Valueo 1 Byte Red Valueo 1 Byte Green Valueo 1 Byte Blue Valueo Others have ARGB w/ 1
Byte Alpha Value (Transparency)
(0,0) (14,0)
(0,18) (14,18)
Image Processing
Processor
Monitor
Memory
Java Graphics Packages
GraphicsMethods:Point (Abstract)LineRectfillRectOvalfillOval
Graphics2DClasses:Point (Abstract)LineRectangle2DEllipse2D
Graphics in Java
• Point (Graphics2D): o An abstract class- cannot be instantiatedo Instead a very short line can be made
• Line Method (Graphics): o g.drawLine(x1, y1, x2, y2);
• Line Class (Graphics2D): o g.draw(new Line(x1, y1, x2, y2));
(x2, y2)(x1, y1)
Graphics in Java
• Rectangle Method (Graphics):o g.drawRect(posX, posY, width, height)
• Rectangle2D Class (Graphics2D):o g.draw(new Rectangle(posX, posY, width, height))
(posX, posY)
width
(posX, posY)
height
Graphics in Java
• Oval Method (Graphics):o g.drawRect(posX, posY, width, height)
• Ellipse2D Class (Graphics2D):o g.draw(new Ellipse2D.Double(posX, posY, width, height))
(posX, posY)
width
(posX, posY)
height
Draw Area
Paint Program