1 / 14

多媒體安全作業 - Paint Brush

多媒體安全作業 - Paint Brush. 指導教授 : 黃文楨 老師 報告人 : 9624710 楊棋閔 9624714 劉秉昕 9724709 沈福財. Interface. ij.plugin.filter.PlugInFilter ImageJ plugins that process an image should implement this interface. java.awt.event.MouseListener

Télécharger la présentation

多媒體安全作業 - Paint Brush

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 多媒體安全作業 - Paint Brush 指導教授 :黃文楨 老師 報告人 :9624710 楊棋閔 9624714 劉秉昕 9724709 沈福財

  2. Interface • ij.plugin.filter.PlugInFilter • ImageJ plugins that process an image should implement this interface. • java.awt.event.MouseListener • The listener interface for receiving "interesting" mouse events (press, release, click, enter, and exit) on a component. • java.awt.event.MouseMotionListener • The listener interface for receiving mouse motion events on a component.

  3. Used Class List(1) • ImagePlus: • Description : This is an extended image class that supports 8-bit, 16-bit, 32-bit (real) and RGB images. • Function List: • Public ImageWindow getWindow() : • Returns the ImageWindow that is being used to display this image. • Public void setColor(java.awt.Color c) : • Sets current foreground color. • Public void updateAndDraw() : • Updates this image from the pixel data in its associated ImageProcessor, then displays it. • public void setCursor(Cursor c): • Sets the cursor based on the current tool and cursor location. • ImageWindow: • Description : Image window • Function List: • Public ImageCanvas getCanvas() : • Get Canvas used to display images in a Window. • Public String getTitle(): • Get Title name of the Image window. • Public void setTitle(String title): • Set Title name of the Image window.

  4. Used Class List(2) • ImageCanvas: • Description : This is a Canvas used to display images in a Window. • Function List: • Public EventListener[] getListeners(Class listenerType) : • Return an array of all the listeners that were added to the Choice with addXXXListener(), where XXX is the name of the listenerType argument. • Public Class getClass(): • Returns the runtime class of an object. • Public void removeMouseListener(MouseListener l) : • Removes the specified mouse listener • Public void removeMouseMotionListener(MouseMotionListener l) • Removes the specified mouse motion listener • Public void addMouseListener(MouseListener l) : • Adds the specified mouse listener • Public void addMouseMotionListener(MouseMotionListener l) • Adds the specified mouse motion listener • Public void offScreenX(int sx) : • Converts a screen x-coordinate to an offscreen x-coordinate. • Pulbic void offScreenY(int sy) : • Converts a screen y-coordinate to an offscreen y-coordinate.

  5. Used Class List(3) • ImageProcessor: • Function List: • abstract void snapshot() : • Makes a copy of this image's pixel data . • Public void moveTo(int x, int y) : • Sets the current drawing location. • Public void lineTo(int x2, int y2) : • Draws a line from the current drawing location to (x2,y2).

  6. ij.plugin.filter.PlugInFilter • Function List • public int java.lang.String arg, ImagePlus imp): • This method is called once when the filter is loaded. • public void run(ImageProcessor ip): •  Filters use this method to process the image.

  7. ij.plugin.filter.PlugInFilter • public int setup(String arg, ImagePlus imp) The currently active image 檢查JDK版本 Returns the ImageWindow that is being used to display this image. Returns the ImageCanvas being used to display this image, or null.

  8. ij.plugin.filter.PlugInFilter • public void run(ImageProcessor ip) 如果目前Canvas已有舊有的 Toggle_paintbrush mouse listener,則仍保留舊有的 應是remove 移除 Canvas所有的MouseListener,只listen 目前的Toggle_paintbrush class

  9. java.awt.event.MouseListener • Function List • public void mousePressed(MouseEvent e) : • Invoked when a mouse button has been pressed on a component. • public void mouseReleased(MouseEvent e) : • Invoked when a mouse button has been released on a component. • public void mouseClicked(MouseEvent e) : • Invoked when the mouse button has been clicked (pressed and released) on a component. • public void mouseEntered(MouseEvent e) : • Invoked when the mouse enters a component. • public void mouseExited(MouseEvent e) : • Invoked when the mouse exits a component.

  10. java.awt.event.MouseListener • public void mousePressed(MouseEvent e) • public void mouseReleased(MouseEvent e) Makes a copy of this image's pixel data 從螢幕座標轉成Canvas座標 ALT key to paint using the background color Sets the current drawing location

  11. java.awt.event.MouseListener • public void mouseExited(MouseEvent e) • public void mouseClicked (MouseEvent e) • public void mouseEntered (MouseEvent e) Do nothing

  12. java.awt.event.MouseMotionListener • Function List • Public void mouseDragged(MouseEvent e) : • Invoked when a mouse button is pressed on a component and then dragged. • Public void mouseMoved(MouseEvent e) : • Invoked when the mouse button has been moved on a component (with no buttons no down).

  13. java.awt.event.MouseMotionListener • public void mouseDragged(MouseEvent e) • public void mouseMoved(MouseEvent e) 從螢幕座標轉成Canvas座標 畫線 Keep目前滑鼠所在的位置

  14. Demo

More Related