Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar...

39
Esther Wibowo - [email protected]

Transcript of Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar...

Page 1: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Esther Wibowo - [email protected]

Page 2: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Bentuk PrimitifPoint - TitikLine - GarisShape/Polygon - Bentuk bangunText - Teks

Page 3: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

TitikDirepresentasikan dengan koordinat (x,y)Biasanya tidak tampil sendiriMenjadi bagian dari bentuk yang lain

Page 4: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

GarisDidefinisikan oleh 2 titik atau lebih.Line : Garis lurusPolyline : sambungan beberapa garisCurve : kurva

CURVEPOLYLINELINE

Page 5: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Persamaan Garis (1)

12

12

1

1

xxyy

xxyy

−−

=−−

X

Y

X1 X2

Y1

Y2 bmxy +=

12

12

xxyym

−−

=

11 mxyb −=

(x,y)

Page 6: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Persamaan Garis (2)m = slope (kemiringan)b = perpotongan dengan sumbu Y bila x1=0

absisx

ordinaty

originO (0,0)

b

m

x

y

Page 7: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Line segment Segmen garis

x1 x2

y1

y2

Segmen garis dinyatakan dengan kedua titikujungnya

12

12

xxyym

−−

=

11 mxyb −=

Page 8: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Panjang Segmen Garis

x1 x2

y1

y2

p1

p2

A

212

212

2 )yy()xx(L −+−=

212

212 )()( yyxxL −+−=

Panjang segmen garis L

Dua titik ujung p1(x1,y1) dan p2(x2, y2)

Page 9: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Garis sejajar (paralel)

11 bxmy +⋅=

O

22 bxmy +⋅=

21 mm =

Page 10: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Garis tegaklurus

11 bxmy +⋅=

O

22 bxmy +⋅=

21

1m

m −=

Page 11: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Harga m

m = 0

m = 1

m = -1

m < 1

m > 1

Page 12: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Jarak antara Titik dan Garis

y=m1x+b

p(xp,yp)

Page 13: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Jarak antara Titik dan Garis

y=m1x+b

y=m2x+b

p(xp,yp)

q(xq,yq)

Page 14: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Citra Garis dalam Raster

Page 15: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Bentuk Bangun

SELF-OVERLAPPING

CONVEXNON-CONVEX(CONCAVE)

Beberapa garis sambung-menyambung yang memiliki titik awal dan titik akhir yang sama.Self-overlapping : memiliki sisi berpotonganNon-convex : ada sisi yang berada di dalam areaConvex : semua sisi di luar area bentuk bangun

Page 16: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Convex atau Concave?

Page 17: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Beberapa Jenis Polygon

SQUARE ELIPSE COMPLEXPOLYGON

Page 18: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Operasi Bentuk Bangun (1)UNIONmenggabungkan area kedua bentuk bangunINTERSECTmenampilkan area yang berpotongan, terdapat dalam dua area bentuk bangunDIFFERENCEmenghilangkan area 2 beserta yang area 1 yang berpotongan dengan area 2SYMMETRICAL DIFFERENCEmenghilangkan area yang berpotongan

Page 19: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Operasi Bentuk Bangun (2)

UNION INTERSECT DIFFERENCE SYMMETRICDIFFERENCE

Page 20: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Pencitraan Bentuk BangunOutline - (tebal) garis luarFill - berisi (warna)

OUTLINE FILL

Page 21: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Atribut OutlineAtribut : pengontrol penampilan objek primitifAtribut outline mis: width - lebar, style - gaya, color - warna

LINE WIDTH 15 pt

LINE STYLE DOT, DASH

LINE COLOR BLUE

Page 22: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

WarnaColor Space : referensi warna, mis: RGB, HSV, HLS, CMYK.Color Channel : komponen dari color space, mis: RGB memiliki 3 color channels yaitu Red, Green, Blue.RGB paling banyak digunakan dalam programming - cocok dengan hardwareTiap channel RGB dinyatakan dengan nilai 0-255, mis: warna putih = (255,255,255)

Page 23: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Contoh Color Space (1)

RGB CMYK

Berdasar sinar

Berdasar cat di kertas putih

Page 24: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Contoh Color Space (2)

HSV

Hue - Saturation - Value

Page 25: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Filling PolygonMengisi bentuk persegi panjang tidak sulit: tentukan nilai x di kedua tepi lalu set area di antaranya dengan warna yang diinginkan.Bagaimana dengan concave polygon?

Page 26: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Filling Convex & Concave PolygonLangkah algoritma pengisian:

Cari perpotongan scanline dengan semua tepi polygon.Urutkan perpotongan berdasar kenaikan koordinat x.Isi interior dari polygon dengan odd-parity rule: nilai awal “genap” - tiap menemui koordinat perpotongan berubah nilai menjadi “ganjil” - isi interior saat parity bernilai “ganjil”, jangan isi saat parity bernilai “genap”.

Page 27: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Odd-Parity Rule

scanline

Page 28: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Algoritma Lingkaran & Elips

0bayax),( 222222 =−+= byxF

-a a

-b

b

X

Y

Page 29: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

TeksAtribut teks mis:

Style/font - jenis huruf: Arial, Times, HelveticaAppearance - tampilan: roman, bold, italic, underlined, strikeout dll.

Size - besar: 20pt, 24pt, 32ptSpace - spasi: antar karakter, antar baris, dll.Angle - sudut kemiringan: horizontal, vertikal, kemiringan tertentuColor - warna

Page 30: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Tampilan Raster dari Teks

ORIGINAL ITALIC BOLD

Page 31: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

AliasingBentuk primitif yang ditampilkan di layar memiliki kekurangan : jaggies/staircasing.Hasil konversi scan dengan nilai 0 atau 1.Teknik mengurangi atau menghilangkan jaggies = ANTI-aliasing

Page 32: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Tampilan Aliasing

Page 33: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Tampilan Antialiasing

Page 34: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Metode Antialiasing (1)Teknik Menaikkan ResolusiGaris nampak lebih baik tapi belum bagus.

Page 35: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Metode Antialiasing (2)Teknik Unweighted Area SamplingBesar area perpotongan garis dengan piksel = intensitas piksel

Page 36: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Intensitas piksel di tengah garis seharusnya lebih besar daripada intensitas piksel di ujung garis. Adakah teknik yang lebih baik?

Page 37: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling

Metode Antialiasing (3)Teknik Weighted Area Sampling

Area di dekat titik tengah bentuk bangun intensitas piksel lebih tinggi.Makin jauh area dari titik tengah, intensitas makin rendah.

Page 38: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling
Page 39: Esther Wibowo - esther.visual@gmail · Contoh Color Space (1) RGB CMYK. Berdasar sinar. Berdasar cat di kertas putih. Contoh Color Space (2) HSV. Hue - Saturation - Value . Filling