码迷,mamicode.com
首页 > 其他好文 > 详细

Activator常用方法

时间:2015-08-28 19:32:26      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

1.获取图片

public static Image getImage(String key) {
        Image img = getDefault().getImageRegistry().get(key);
        if (img == null) {
            getDefault().getImageRegistry().put(key,
                    getImageDescriptor(key).createImage());
            img = getDefault().getImageRegistry().get(key);
        }

        return img;
    }

    /**
     * Returns an image descriptor for the image file at the given plug-in
     * relative path
     *
     * @param path
     *            the path
     * @return the image descriptor
     */
    public static ImageDescriptor getImageDescriptor(String path) {
        return imageDescriptorFromPlugin(PLUGIN_ID, path);
    }
    

2.获取颜色
    public static Color getColor(RGB rgb) {
        if (color == null) {
            color = ColorCache.open();
        }
        return color.getColor(rgb);
    }

Activator常用方法

标签:

原文地址:http://www.cnblogs.com/huadoumi/p/4767059.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!