mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.5.1
This commit is contained in:
@@ -22,11 +22,12 @@ import java.awt.Image;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
public class IconAdp {
|
||||
public Icon UnderIcon() {return icon;} final Icon icon;
|
||||
public Icon UnderIcon() {return icon;} private final Icon icon;
|
||||
public Image XtoImage() {return ((ImageIcon)icon).getImage();}
|
||||
public Io_url Url() {return url;} Io_url url = Io_url_.Empty;
|
||||
public Io_url Url() {return url;} private Io_url url = Io_url_.Empty;
|
||||
IconAdp(Icon icon) {this.icon = icon;}
|
||||
public static IconAdp new_(Icon icon) {return new IconAdp(icon);}
|
||||
public static IconAdp file_or_blank(Io_url url) {return file_(url);}
|
||||
public static IconAdp file_(Io_url url) {
|
||||
Icon icon = new ImageIcon(url.Xto_api());
|
||||
IconAdp rv = new IconAdp(icon);
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.awt.image.BufferedImage;
|
||||
import javax.imageio.ImageIO;
|
||||
public class ImageAdp_ {
|
||||
public static ImageAdp as_(Object obj) {return obj instanceof ImageAdp ? (ImageAdp)obj : null;}
|
||||
public static ImageAdp cast_(Object obj) {try {return (ImageAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ImageAdp.class, obj);}}
|
||||
public static ImageAdp cast(Object obj) {try {return (ImageAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ImageAdp.class, obj);}}
|
||||
public static final ImageAdp Null = new_(10, 10);
|
||||
public static ImageAdp new_(int width, int height) {
|
||||
// BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // JAVA: must be TYPE_INT_RGB or else ImageIO.write("bmp") will fail
|
||||
@@ -44,7 +44,7 @@ public class ImageAdp_ {
|
||||
SizeAdp size = null;
|
||||
if (String_.Eq(raw, "")) size = SizeAdp_.Zero;
|
||||
else if (String_.Eq(url.Ext(), ".svg")) size = SizeOf_svg(url);
|
||||
else size = SizeAdp_.parse_(raw);
|
||||
else size = SizeAdp_.parse(raw);
|
||||
return new ImageAdp_txt(url, size);
|
||||
}
|
||||
public static SizeAdp SizeOf_svg(Io_url url) {return Gfui_svg_util.QuerySize(url);}
|
||||
@@ -121,6 +121,6 @@ class Gfui_svg_util {
|
||||
if (px != -1) end = px;
|
||||
String str = String_.Mid(xml, bgn, end);
|
||||
pos_ref.Val_(end);
|
||||
return Double_.parse_(str);
|
||||
return Double_.parse(str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ import java.awt.Toolkit;
|
||||
public class ScreenAdp_ {
|
||||
public static final ScreenAdp Primary = screen_(0);
|
||||
public static ScreenAdp as_(Object obj) {return obj instanceof ScreenAdp ? (ScreenAdp)obj : null;}
|
||||
public static ScreenAdp cast_(Object obj) {try {return (ScreenAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ScreenAdp.class, obj);}}
|
||||
public static ScreenAdp parse_(String raw) { // ex: {screen{1}
|
||||
public static ScreenAdp cast(Object obj) {try {return (ScreenAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ScreenAdp.class, obj);}}
|
||||
public static ScreenAdp parse(String raw) { // ex: {screen{1}
|
||||
try {
|
||||
raw = String_.Replace(raw, "{screen{", "");
|
||||
raw = String_.Replace(raw, "}", "");
|
||||
return ScreenAdp_.screen_(Int_.parse_(raw));
|
||||
return ScreenAdp_.screen_(Int_.parse(raw));
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(exc, ScreenAdp.class, raw);}
|
||||
}
|
||||
public static ScreenAdp from_point_(PointAdp pos) {// NOTE: not using FromPoint b/c of plat_wce
|
||||
|
||||
Reference in New Issue
Block a user