SWT.IMAGE

Interfaces 
Drawable
ImageLoaderListener
Classes 
Color
Cursor
Device
DeviceData
Font
FontData
FontMetrics
GC
GCData
Image
ImageData
ImageLoader
ImageLoaderEvent
PaletteData
Point
Rectangle
Region
RGB

Images类使用介绍:
There are two primary ways to use Images.
1:直接调用
      Image i = new Image(device, "C://graphic.bmp");
      //device有2种设备,Display和Printer,写null,默认使用当前的Display来做显示设备。
2:控制颜色分配
    ImageData data = new ImageData("C://graphic.bmp");
    RGB[] rgbs = data.getRGBs();
    // At this point, rgbs contains specifications of all
    // the colors contained within this image. You may
    // allocate as many of these colors as you wish by
    // using the Color constructor Color(RGB), then
    // create the image:
    Image i = new Image(device, data);

相对路径:
Image i = new Image(device, "icons/graphic.bmp");   //项目根目录下

插件自带图像
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages():
Image image = sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);

ImageLoader类使用介绍:保存图片
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] {imageData};                 
//The reason the data field is an array of ImageData is to support
//image file formats with more than one frame such as animated GIFs or interlaced JPEG files.

imageLoader.save("C:/temp/Idea_PureWhite.jpg",SWT.IMAGE_JPEG);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值