嘟嘟

            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 閱讀(2175) 評論(0)  編輯  收藏 所屬分類: RCP&SWT&JFACE
          主站蜘蛛池模板: 杭锦后旗| 明星| 会同县| 中牟县| 榆中县| 马鞍山市| 罗源县| 珠海市| 体育| 卢龙县| 宁德市| 长宁县| 讷河市| 渭源县| 普格县| 黄冈市| 泸西县| 舞阳县| 武汉市| 永泰县| 富川| 同心县| 西林县| 岢岚县| 西昌市| 揭阳市| 车致| 临夏县| 盖州市| 罗甸县| 绩溪县| 渭南市| 东宁县| 稻城县| 阿巴嘎旗| 凤台县| 灵山县| 思南县| 德江县| 吴旗县| 金沙县|