嘟嘟

            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
          主站蜘蛛池模板: 信丰县| 金华市| 莆田市| 凤庆县| 云霄县| 大同市| 济阳县| 仁化县| 成安县| 报价| 虞城县| 白朗县| 镇安县| 富民县| 巴马| 高陵县| 离岛区| 喀喇| 山阳县| 万宁市| 嵊州市| 乌兰浩特市| 建宁县| 平山县| 田林县| 靖江市| 榆中县| 邳州市| 赤城县| 邛崃市| 将乐县| 苍溪县| 乐都县| 奉节县| 韩城市| 屏东市| 淳安县| 通山县| 淮滨县| 台前县| 册亨县|