11.04.2013 Views

Grafik Bitmap & Vektor

Grafik Bitmap & Vektor

Grafik Bitmap & Vektor

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GAME<br />

WARNA<br />

DISPLAY<br />

GRAFIK<br />

GAMBAR


#3b<br />

#2<br />

#4<br />

#5b<br />

#5a<br />

#6<br />

#3a<br />

#8…


WARNA


Cahaya putih disusun dari semua komponen cahaya<br />

White light<br />

Prism<br />

White light components


RGB - Red, Green, Blue?


Layar Monitor jika diperbesar<br />

LCD monitor<br />

1 pixel<br />

CRT monitor


CMYK?


CMYK print


MONITOR


Monitor CRT


Cathode Ray Tube<br />

sinar dalam tabung<br />

diarahkan<br />

11


Monitor LCD LED


Plasma Monitor


SISTEM KOORDINAT LAYAR


Display Adapter & Resolution<br />

15


Sistem Koordinat<br />

Dalam sistem komputer untuk menampilkan grafik atau gambar,<br />

digunakan Screen Coordinate.<br />

Perbedaan dengan Cartesian Coordinate lihat gambar berikut:


GAMBAR (CITRA)


Jenis Gambar<br />

Dari Gambar <strong>Vektor</strong> ke Sistem Tampilan Raster


Jenis Gambar<br />

Gambar secara umum dapat dibagi menjadi dua format:<br />

<strong>Bitmap</strong> atau gambar Raster<br />

Vector atau gambar Metafile<br />

Gambar bitmap disimpan sebagai array pixel. Ini<br />

merupakan gambar sebagai array dari titik-titik, yang<br />

disebut piksel<br />

Vector grafis disimpan sebagai bentuk (persamaan)<br />

geometris untuk mewakili gambar<br />

19


<strong>Bitmap</strong>ped vs. Vector<br />

• <strong>Bitmap</strong>ped<br />

+/-<br />

• Vector<br />

+/-


Converting image formats<br />

Text<br />

<strong>Bitmap</strong>ped font<br />

Optical Character<br />

Recognition (OCR)<br />

<strong>Bitmap</strong>ped image<br />

Render as bitmap<br />

Contour trace<br />

Vector image


JAVA 2D CLASS:<br />

IMAGE<br />

SHAPE


Graphic Objects Methods


Point (x,y)<br />

Line (pt1,pt2)<br />

PolyLine (pt list)<br />

Arc<br />

Ellipse(pt, w,h)<br />

Rectangle (pt, w,h)<br />

RoundRectangle<br />

Polygon (pt list)<br />

Image (file, x,y)<br />

Text (string, x,y) label<br />

Graphics Primitives<br />

Draw Fill


Graphics Primitives


Color<br />

Font<br />

Stroke attributes:<br />

Graphics Attributes<br />

Line width, dash, end caps, joins, miter<br />

Paint attributes:<br />

Color, gradient, texture<br />

Composite:<br />

Blending<br />

Transforms:<br />

Translate, rotate, flip, shear, scale


paint Method<br />

paint method takes a Graphic object as an argument.<br />

This argument is passed to the paint method when<br />

drawing operation is required for a Component.<br />

When Java is implemented on different platform, a<br />

derived Graphics class is created for each platform<br />

which in fact implements all the drawing capabilities.


Example:<br />

public void paint (Graphics g) {<br />

super.paint(g);<br />

g.setColor(Color.blue);<br />

g.drawsString(“Java”, 10, 10);<br />

…<br />

paint Method


drawString<br />

For drawing text<br />

g.drawString("Hello", 10, 10);<br />

drawImage<br />

For drawing images<br />

Drawing methods<br />

g.drawImage(img, 0, 0, width, height, 0, 0, imageWidth,<br />

imageHeight, null);<br />

drawLine, drawArc, drawRect, drawOval,drawPolygon<br />

For drawing geometric shapes<br />

g2.drawLine(0, 0, 30, 40);


General Path


Constructive Area Geometry<br />

Constructive Area Geometry (CAG) is the process of creating new<br />

geometric shapes by performing boolean operations on existing<br />

ones.<br />

Union<br />

Intersection<br />

Subtraction<br />

XOR<br />

A pear shape<br />

from several ellipses


Bagaimana cara kerjanya? Daun<br />

Setiap bagian daun dibentuk dengan<br />

mengaplikasikan sebuah intersection pada dua<br />

lingkaran yang saling overlapping.<br />

イメージ図


Bagaimana cara kerjanya? Batang<br />

Lingkaran yang overlapping juga digunakan untuk<br />

mengkonstruksi batang melalui sebuah operasi<br />

subtraction.<br />

イメージ図


Bagaimana cara kerjanya? Buah<br />

Tampilan buah pear disusun dengan<br />

mengaplikasikan sebuah operasi union pada<br />

lingkaran dan oval.<br />

イメージ図


実行例<br />

(パイナップル?)


Screen is like a painter’s canvas<br />

Re-Paint buffer & animation<br />

All windows paint on the same surface!<br />

Windows don’t “remember” whats under them<br />

Need to re-paint when portions are newly exposed<br />

Receive Repaint events<br />

Open, resize, bring to front<br />

When other windows in front move, resize, close


MyApp


Open WinExp & Notepad


Close WinExplorer<br />

Repaint event sent to: MyApp, Desktop


Desktop gets repaint event


MyApp gets repaint event<br />

MyApp JPanel gets repaint event


MyApp gets repaint event<br />

MyApp JPanel forwards repaint event to JButton


TAMBAH GAK NGERTI?<br />

MUMET?<br />

cari sumber lain<br />

pelajari lagi..

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!