1/14 多媒體安全作業 - paint brush 指導教授 :黃文楨 老師 報告人 : 9624710...

14
1/14 多多 多多多多 - Paint Brush 多多多多 多多多 多多 多多多 9624710 多多多 9624714 多多多 9724709 多多多

Upload: philip-mcbride

Post on 13-Dec-2015

239 views

Category:

Documents


5 download

TRANSCRIPT

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

1/14

多媒體安全作業 - Paint Brush

指導教授 :黃文楨 老師報告人 : 9624710 楊棋閔

9624714 劉秉昕9724709 沈福財

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

2/6

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.

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

3/6

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.

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

4/6

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.

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

5/6

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).

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

6/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.

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

7/6

ij.plugin.filter.PlugInFilter

• public int setup(String arg, ImagePlus imp)

檢查 JDK 版本

Returns the ImageWindow that is being used to display this image.

Returns the ImageCanvas being used to display this image, or null.

The currently active image

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

8/6

ij.plugin.filter.PlugInFilter

• public void run(ImageProcessor ip)

如果目前 Canvas 已有舊有的Toggle_paintbrush mouse listener ,則仍保留舊有的

移除 Canvas 所有的MouseListener ,只listen 目前的Toggle_paintbrush class

應是remove

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

9/6

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.

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

10/6

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

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

11/6

java.awt.event.MouseListener

• public void mouseExited(MouseEvent e)• public void mouseClicked (MouseEvent e)• public void mouseEntered (MouseEvent e)

Do nothing

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

12/6

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).

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

13/6

java.awt.event.MouseMotionListener

• public void mouseDragged(MouseEvent e)• public void mouseMoved(MouseEvent e)

從螢幕座標轉成 Canvas 座標

畫線

Keep 目前滑鼠所在的位置

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

14/14

Demo