paint application in java clark jayson cacal aveline germar jose sison christopher valera

8
Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

Upload: arthur-burke

Post on 13-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

Paint Application in Java

Clark Jayson CacalAveline Germar

Jose SisonChristopher Valera

Page 2: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher 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)

Page 3: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

Image Processing

Processor

Monitor

Memory

Page 4: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

Java Graphics Packages

GraphicsMethods:Point (Abstract)LineRectfillRectOvalfillOval

Graphics2DClasses:Point (Abstract)LineRectangle2DEllipse2D

Page 5: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

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)

Page 6: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

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

Page 7: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

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

Page 8: Paint Application in Java Clark Jayson Cacal Aveline Germar Jose Sison Christopher Valera

Draw Area

Paint Program