?? image.java
字號:
package com.mc.svg.shape.basicshape;
import org.w3c.dom.Document;
import com.mc.svg.SVGCanvas;
import com.mc.svg.shape.AbstractShape;
public class Image extends AbstractShape {
public Image(Document doc,String imagePath) {
this.doc = doc;
root = doc.createElementNS(SVGCanvas.svgNS, "image");
root.setAttributeNS(null, "xlink:href", imagePath);
}
public Image(Document doc) {
this.doc = doc;
root = doc.createElementNS(SVGCanvas.svgNS, "image");
}
public void setImagePath(String imagePath) {
root.setAttributeNS(null, "xlink:href", imagePath);
}
public void addOnClick(String str){
String tmp = "locationUrl('"+str+"')";
root.setAttributeNS(null,"onclick",tmp);
}
public void setSize(int width, int height) {
root.setAttributeNS(null, "width", width + "");
root.setAttributeNS(null, "height", height + "");
}
public int getWidth() {
String widthStr = root.getAttribute("width");
int width = 0;
try {
width = Integer.parseInt(widthStr);
} catch (Exception ex) {
}
return width;
}
public int getHeight() {
String heightStr = root.getAttribute("width");
int height = 0;
try {
height = Integer.parseInt(heightStr);
} catch (Exception ex) {
}
return height;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -