嘟嘟

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  26 Posts :: 0 Stories :: 6 Comments :: 0 Trackbacks
Taking a look at SWT Images:网上教程
org.eclipse.swt.graphics 包情况:
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);

.......to be continue

posted on 2007-06-17 14:56 fyp1210 阅读(2157) 评论(0)  编辑  收藏 所属分类: RCP&SWT&JFACE

只有注册用户登录后才能发表评论。


网站导航: