ข่าวประชาสัมพันธ์

มาร่วมเป็นกำลังใจให้เว็บด้วยการสมัครสมาชิกวีไอพี ~~ เลือกปีที่ท่านต้องการได้โดยไม่ต้องเรียงปี ~~ ปีละ 350 บาท สมัคร 2 ปีลดเหลือ 600 บาท ~~ มีไลน์กลุ่ม VIP จำนวนหลายร้อยท่าน เอาไว้ปรึกษางานซ่อม ~~ เข้าถึงข้อมูลด้านเทคนิค ข้อมูลเชิงลึกมากมาย.....


ผู้เขียน หัวข้อ: How to blur an image under the mouse  (อ่าน 430 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ Auto Man

  • Administrator
  • หัวหน้าศูนย์ซ่อมสร้าง
  • *****
  • เจ้าของกระทู้
  • Joined: ก.ย. 2558
  • กระทู้: 37519
  • สมาชิกลำดับที่ : 1
  • เพศ: ชาย
  • มือผู้ให้ย่อมสูงกว่ามือผู้รับ
    • เว็บชุมชนคนรักช่างยนต์
    • อีเมล์
How to blur an image under the mouse
« เมื่อ: 12 ธันวาคม 2566, 18:50:27 »
  • ขึ้นบน
  • ลงล่าง
  •    How to blur an image under the mouse   

    โค๊ด: [Select]
    public void test(int x, int y){ // Here x and y are the parameter thrown by mouseDragged() function
    blur1 = displayImage; // blur1 is Image variable

    blur2 = new BufferedImage(blur1.getWidth(this), blur1 //blur2 is BufferedImage Variable
        .getHeight(this), BufferedImage.TYPE_INT_RGB);
    tst = blur2.createGraphics(); // tst is Graphics2D variable
    tst.drawImage(blur1, 0, 0, this);
    blur3 = new BufferedImage(blur1.getWidth(this), blur1 //blur3 is BufferedImage Variable
        .getHeight(this), BufferedImage.TYPE_INT_RGB);
    float data[] = { 0.0625f, 0.125f, 0.0625f, 0.125f, 0.25f, 0.125f,
        0.0625f, 0.125f, 0.0625f };
    Kernel kernel = new Kernel(3, 3, data);
    ConvolveOp convolve = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP,
        null);
    blur2 = OSC.getSubimage(x, y, 20, 20); // 20 is the size in pixels where the effect is applied
    blur3 = OSC.getSubimage(x, y, 20, 20);
    convolve.filter(blur2, blur3);   
      Graphics osg = OSC.getGraphics();
      osg.setColor(fillColor);
      osg.drawImage(blur3,x,y,null);
      osg.dispose();
      repaint();
    }
    สวัสดีคุณ...ผู้เยี่ยมชม  กด ❤ ถูกใจโพสท์นี้ หรือยัง...
    ต้องการสมัครสมาชิก VIP สมัครได้ที่นี่...   หรือทาง Line ID: k.sonchai

    How to blur an image under the mouse
    « เมื่อ: 12 ธันวาคม 2566, 18:50:27 »