Komputer Grafik Informatika

  • Upload
    sicha

  • View
    230

  • Download
    0

Embed Size (px)

Citation preview

  • 8/17/2019 Komputer Grafik Informatika

    1/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    1

    Komputer Grafik – Kelas : E

    Anggota Kelompok:Nama Mohamad Ardiansyah Rofi’i  Nama Mohamad Ardiansah

    N.P.M 1461505114 N.P.M 1461505177

    Nama Bayu Setyo Aji Utomo

    N.P.M 1461505069

    LAPORAN

    TUGAS Evaluasi Tengah Semester(ETS)

    PEMROGRAMAN BENTUK – Grid

    -  PENGOLAHAN CITRA – Citra Warna Negatif

    -  TRANSFORMASI GEOMETRI 

  • 8/17/2019 Komputer Grafik Informatika

    2/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    2

    PEMROGRAMAN BENTUK – Grid

    SOURCE CODE :

    void setup(){size(800, 300);background(0);

    }

    void grid(float ukuranKotak, float warnaGaris){

    stroke(warnaGaris);strokeWeight(1);float baru = ukuranKotak;while (ukuranKotak < width){

    line(ukuranKotak, 0, ukuranKotak, height);ukuranKotak = ukuranKotak + baru;

    }

    ukuranKotak = baru;while (ukuranKotak < height){

    line(0, ukuranKotak, width, ukuranKotak);ukuranKotak = ukuranKotak + baru;

    }}

    void draw(){grid(20, 152);

    }

  • 8/17/2019 Komputer Grafik Informatika

    3/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    3

    Hasil Eksekusi Program :

  • 8/17/2019 Komputer Grafik Informatika

    4/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    4

    PENGOLAHAN CITRA – Citra Warna Negatif  

    SOURCE CODE :

    size(600, 400);

    PImage fotoAsli = loadImage("blender.jpg");

    fotoAsli.resize(300, 400);

    PImage fotoOlahan = createImage(fotoAsli.width, fotoAsli.height, RGB);

    for (int i = 0; i < fotoAsli.width; i++)

    {

    for (int j = 0; j < fotoAsli.height; j++)

    {

    int p = fotoAsli.get(i, j);

    int a = (p >> 24) &0xff;

    int r = (p >> 16) &0xff;

    int g = (p >> 8) &0xff;

    int b = p &0xff;

    r = 255 - r;

    g = 255 - g;

    b = 255 - b;

    p = (a

  • 8/17/2019 Komputer Grafik Informatika

    5/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    5

    Hasil Eksekusi Program : 

  • 8/17/2019 Komputer Grafik Informatika

    6/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    6

    TRANSFORMASI GEOMETRI

    Flip Horizontal (Membalik Gambar secara Horizontal  ) 

    SOURCE CODE :

    Void setup()

    {size(600, 400);

    }

    void horizontal()

    {

    PImage fotoAsli = loadImage("b.jpg");

    fotoAsli.resize(300, 400);

    PImage fotoOlahan = createImage( fotoAsli.width, fotoAsli.height, RGB);

    for (int i = 0; i < fotoAsli.width; i++)

    {

    for (int j = 0; j < fotoAsli.height; j++)

    {

    color warnaOlah = fotoAsli.get(i,j);

    fotoOlahan.set(fotoAsli.width-1-i, j, warnaOlah);

    }

    }

    image(fotoAsli, 0,0);

    image(fotoOlahan, 300, 0);

    fill(ARGB, 100);

    rect(0, 360, 600, 40);

    fill(255);

    textSize(30);

    text("ASLI", 120, 390);

    fill(255);

    textSize(30);

    text("OLAHAN", 400, 390);

    }

    Void draw(){

    horizontal();}

  • 8/17/2019 Komputer Grafik Informatika

    7/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    7

    Hasil Eksekusi Program :

  • 8/17/2019 Komputer Grafik Informatika

    8/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    8

    Flip Vertical (Membalik Gambar secara Vertical  )

    SOURCE CODE :

    Void setup(){

    size(600, 400);}

    void vertikal()

    {

    PImage fotoAsli = loadImage("b.jpg");

    fotoAsli.resize(300, 400);

    PImage fotoOlahan = createImage( fotoAsli.width, fotoAsli.height, RGB);

    for (int i = 0; i < (fotoAsli.width); i++)

    {

    for (int j = 0; j < fotoAsli.height; j++)

    {

    color warnaOlah = fotoAsli.get(i,j);

    fotoOlahan.set(i, fotoAsli.height-1-j, warnaOlah);

    }

    }

    image(fotoAsli, 0,0);

    image(fotoOlahan, 300, 0);

    fill(ARGB, 100);

    rect(0, 360, 600, 40);

    fill(255);

    textSize(30);

    text("ASLI", 120, 390);

    fill(255);

    textSize(30);

    text("OLAHAN", 400, 390);

    }

    Void draw(){

    vertical();}

  • 8/17/2019 Komputer Grafik Informatika

    9/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    9

    Hasil Eksekusi Program :

  • 8/17/2019 Komputer Grafik Informatika

    10/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    10

    Putar gambar 90° searah jarum jam

    SOURCE CODE :

    void setup()

    {

    size(700, 400);

    }

    void searahJarumJam()

    {

    PImage fotoAsli = loadImage("c.jpg");

    fotoAsli.resize(300, 400);

    PImage fotoOlahan = createImage( fotoAsli.height, fotoAsli.width, RGB);

    for (int i = 0; i < fotoAsli.width; i++) {

    for (int j = 0; j < fotoAsli.height; j++) {

    color warnaOlah = fotoAsli.get(i,j);

    fotoOlahan.set(fotoAsli.height-1-j,i,warnaOlah);

    }

    }

    image(fotoAsli, 0,0);

    image(fotoOlahan, 300, 0);

    fill(ARGB, 100);

    rect(0, 360, 700, 40);

    fill(255);

    textSize(30);

    text("ASLI", 120, 390);

    fill(255);

    textSize(30);

    text("OLAHAN", 450, 390);

    }

    void draw()

    {

    searahJarumJam();

    }

  • 8/17/2019 Komputer Grafik Informatika

    11/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    11

    Hasil Eksekusi Program :

  • 8/17/2019 Komputer Grafik Informatika

    12/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    12

    Putar gambar 90° melawan jarum jam

    SOURCE CODE :

    void setup()

    {

    size(700, 400);

    }

    void berlawanJarumJam()

    {

    PImage fotoAsli = loadImage("c.jpg");

    fotoAsli.resize(300, 500);

    PImage fotoOlahan = createImage( fotoAsli.height, fotoAsli.width, RGB);

    for (int i = 0; i < fotoAsli.width; i++)

    {

    for (int j = 0; j < fotoAsli.height; j++)

    {

    color warnaOlah = fotoAsli.get(i,j);

    fotoOlahan.set(j,fotoAsli.width -1-i, warnaOlah);

    }

    }

    image(fotoAsli, 0,0);

    image(fotoOlahan, 300, 0);

    fill(ARGB, 100);

    rect(0, 360, 700, 40);

    fill(255);

    textSize(30);

    text("ASLI", 120, 390);

    fill(255);

    textSize(30);

    text("OLAHAN", 450, 390);

    }

    void draw()

    {

    berlawanJarumJam();

    }

  • 8/17/2019 Komputer Grafik Informatika

    13/13

    Tugas Evaluasi Tengah Semester (ETS) – Komputer

    Grafik   Universitas 17 Agustus 1945 SurabayaTeknik Informatika – Semester Genap 2015/2016

    13

    Hasil Eksekusi Program :