當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageData類代碼示例

本文整理匯總了Java中org.eclipse.swt.graphics.ImageData的典型用法代碼示例。如果您正苦於以下問題:Java ImageData類的具體用法?Java ImageData怎麽用?Java ImageData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageData類屬於org.eclipse.swt.graphics包,在下文中一共展示了ImageData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawCompositeImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
@Override
protected void drawCompositeImage(int ignoredWidth, int ignoredHeight) {
	// base image, possibly shifted to accommodate decorators
	drawImage(getMainData(), shiftFromLeft(), shiftFromTop());
	// row of decorators
	int x = marginFromLeft();
	final int y = marginFromTop();
	for (ImageData decoData : getDecosData()) {
		drawImage(decoData, x, y);
		x += decoData.width;
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:13,代碼來源:N4JSDecoratorRow.java

示例2: processLoad

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
private void processLoad ( final String stringUrl ) throws Exception
{
    final ImageLoader loader = new ImageLoader ();

    final URL url = new URL ( stringUrl );

    final ImageData[] data;
    try ( InputStream is = url.openStream () )
    {
        data = loader.load ( is );
    }

    logger.debug ( "Image loaded" );

    Display.getDefault ().asyncExec ( new Runnable () {
        @Override
        public void run ()
        {
            showImage ( stringUrl, data );
        }
    } );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:URLImageLabel.java

示例3: drawCompositeImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
protected void drawCompositeImage(int width, int height) {

			drawImage(mBase.getImageData(), 0, 0);
			
			ImageData imageData = mOverlay.getImageData();
			switch (mCorner) {
				case TOP_LEFT :
					drawImage(imageData, 0, 0);
					break;
				case TOP_RIGHT :
					drawImage(imageData, mBase.getBounds().width - imageData.width, 0);
					break;
				case BOTTOM_LEFT :
					drawImage(imageData, 0, mBase.getBounds().height - imageData.height);
					break;
				case BOTTOM_RIGHT :
					drawImage(imageData, mBase.getBounds().width - imageData.width, mBase.getBounds().height - imageData.height);
					break;
			}
		}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:21,代碼來源:ViewLabelDecorator.java

示例4: drawShadowImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
public static void drawShadowImage(GC gc, Image image, int x, int y,
    int alpha) {
  Display display = Display.getCurrent();
  Point imageSize = new Point(image.getBounds().width,
      image.getBounds().height);
  //
  ImageData imgData = new ImageData(imageSize.x, imageSize.y, 24,
      new PaletteData(255, 255, 255));
  imgData.alpha = alpha;
  Image img = new Image(display, imgData);
  GC imgGC = new GC(img);
  imgGC.drawImage(image, 0, 0);
  gc.drawImage(img, x, y);
  imgGC.dispose();
  img.dispose();
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:17,代碼來源:SWTX.java

示例5: save

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
/**
 * Save the image.
 */
public void save(OutputStream outputStream) throws IOException {
	ImageLoader imageLoader = new ImageLoader();
	imageLoader.data = new ImageData[] { imageData };
	int format = SWT.IMAGE_PNG;
	if ("BMP".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_BMP;
	} else if ("RLE".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_BMP_RLE;
	} else if ("GIF".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_GIF;
	} else if ("ICO".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_ICO;
	} else if ("JPEG".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_JPEG;
	} else if ("PNG".equals(getFileExtension())) { //$NON-NLS-1$
		format = SWT.IMAGE_PNG;
	}
	imageLoader.save(outputStream, format);
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:23,代碼來源:SwtImage.java

示例6: encontraPixel

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
private RGB encontraPixel(int x, int y, int indice) {

        labelPosicaoCor.setText(x + "," + y);

        ImageData imageData = null;
        PaletteData paletteData = null;

        if (indice == 1 && imagem1 != null) {
            imageData = imagem1.getImageData();
            paletteData = imageData.palette;
        } else if (indice == 2 && imagem2 != null) {
            imageData = imagem2.getImageData();
            paletteData = imageData.palette;
        } else if (indice == 3 && imagem3 != null) {
            imageData = imagem3.getImageData();
            paletteData = imageData.palette;
        }

        if (paletteData != null && x > -1 && y > -1) {
            int pixel = imageData.getPixel(x, y);
            RGB rgb = paletteData.getRGB(pixel);
            return rgb;
        }

        return null;
    }
 
開發者ID:nbfontana,項目名稱:pdi,代碼行數:27,代碼來源:Interface.java

示例7: getImageData

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
protected ImageData getImageData() {
	int[][] a = (int[][]) array;
	ImageData data = new ImageData(width, height, 24, palette);
	for(int y = 0; y < height; y++) {
		for(int x = 0; x < width; x++) {
			int v = a[y][x];
			int r = (v >> 16) & 0xFF;
			int g = (v >> 8) & 0xFF;
			int b = v & 0xFF;

			int pixel = 0;
			if(valid(r, g, b)) {
				pixel |= (redShift < 0 ? r << -redShift : r >>> redShift) & redMask;
				pixel |= (greenShift < 0 ? g << -greenShift : g >>> greenShift) & greenMask;
				pixel |= (blueShift < 0 ? b << -blueShift : b >>> blueShift) & blueMask;
			}
			//					int pixel = valid(r,g,b) ? palette.getPixel(new RGB(r,g,b)) : palette.getPixel(new RGB(255, 0, 0));
			data.setPixel(x, y, pixel);
		}
	}
	return data;
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:23,代碼來源:ColorImageWidget.java

示例8: drawCompositeImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
protected void drawCompositeImage(int width, int height) {
	ImageData base = getBaseImageData();
	drawImage(base, 0, 0);
	if (fOverlays != null) {
		if (fOverlays.length > 0) {
			drawTopRight(fOverlays[0]);
		}

		if (fOverlays.length > 1) {
			drawBottomRight(fOverlays[1]);
		}

		if (fOverlays.length > 2) {
			drawBottomLeft(fOverlays[2]);
		}

		if (fOverlays.length > 3) {
			drawTopLeft(fOverlays[3]);
		}
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:22,代碼來源:AbstractOverlayIcon.java

示例9: loadImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
private static Image loadImage(final Display display, final String name) {
    InputStream stream = null;
    try {
        stream = SWTBenchTest.class.getResourceAsStream(name);
        if (stream != null) {
            final ImageData imageData = new ImageData(stream);
            return new Image(display, imageData);
            // if (imageData != null) {
            // ImageData mask = imageData.getTransparencyMask();
            // return new Image(display, imageData, mask);
            // }

        }
    }
    catch (final Exception e) {
        throw new RuntimeException(e);
    }
    return null;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:20,代碼來源:SWTBenchTest.java

示例10: copyWidgetToFile

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
public File copyWidgetToFile(Control control) throws IOException {
  File file = File.createTempFile("MechanicalPopupTest", "jpg");
  file.deleteOnExit();
  Point size = control.getSize();
  GC gc = new GC(control);
  Image image = null;
  try {
    image = new Image(control.getDisplay(), size.x, size.y);
    gc.copyArea(image, 0, 0);
    ImageLoader loader = new ImageLoader();
    loader.data = new ImageData[] {image.getImageData()};
    loader.save(file.getPath(), SWT.IMAGE_JPEG);
  } finally {
    gc.dispose();
    if (image != null) {
      image.dispose();
    }
  }
  return file;
}
 
開發者ID:alfsch,項目名稱:workspacemechanic,代碼行數:21,代碼來源:MechanicPopupTest.java

示例11: write

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
public static void write(ImageFormat format, String path, List<ImageData> pages) throws TGFileFormatException {
	try {
		for(int i = 0; i < pages.size() ; i ++ ) {
			OutputStream stream = new FileOutputStream(new File(path + File.separator + "page-" + i + format.getExtension() ));
			
			ImageLoader loader = new ImageLoader();
			loader.data = new ImageData[] { (ImageData)pages.get(i) };
			loader.save(stream, format.getFormat() );
			
			stream.flush();
			stream.close();
		}
	} catch (Throwable throwable) {
		throw new TGFileFormatException("Could not write song!.",throwable);
	}
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:17,代碼來源:ImageWriter.java

示例12: applyTransparency

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
public void applyTransparency( TGColor background ){
	RGB alpha = new RGB( background.getRed(), background.getGreen(), background.getBlue() );
	RGB none = new RGB((0xff ^ alpha.red),(0xff ^ alpha.green),(0xff ^ alpha.blue));
	
	Image srcImage = this.handle;
	ImageData srcData = srcImage.getImageData();
	ImageData maskData = new ImageData(srcData.width,srcData.height,1,new PaletteData(new RGB[]{ none,alpha }  ));
	for(int x = 0; x< maskData.width; x++) {
		for(int y = 0; y < maskData.height; y++) {
			RGB rgb = srcData.palette.getRGB(srcData.getPixel(x, y));
			if(rgb.red == alpha.red && rgb.green == alpha.green && rgb.blue == alpha.blue){
				maskData.setPixel(x, y, maskData.palette.getPixel(none));
			}else{
				maskData.setPixel(x, y, maskData.palette.getPixel(alpha));
			}
		}
	}
	this.handle = new Image(srcImage.getDevice(),srcData,maskData);
	
	srcImage.dispose();
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:22,代碼來源:TGImageImpl.java

示例13: createFigure

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    final InsertedImage model = (InsertedImage) getModel();

    final byte[] data = Base64.decodeBase64((model.getBase64EncodedData().getBytes()));
    final ByteArrayInputStream in = new ByteArrayInputStream(data);

    imageData = new ImageData(in);
    changeImage();

    final InsertedImageFigure figure = new InsertedImageFigure(image, model.isFixAspectRatio(), model.getAlpha());
    figure.setMinimumSize(new Dimension(1, 1));

    return figure;
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:19,代碼來源:InsertedImageEditPart.java

示例14: execute

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}

	Shell shell = HandlerUtil.getActiveShell(event);

	FileDialog dialog = new FileDialog(shell, SWT.SAVE);
	dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
	dialog.setFilterNames(new String[] { "PNG Files", "All Files" });
	String fileSelected = dialog.open();

	if (fileSelected != null) {
		ImageLoader imageLoader = new ImageLoader();
		imageLoader.data = new ImageData[] { imageCanvas.getImageData() };

		System.out.println("Selected file: " + fileSelected);
		imageLoader.save(fileSelected, SWT.IMAGE_PNG);
	}

	return null;
}
 
開發者ID:NineWorlds,項目名稱:xstreamer,代碼行數:27,代碼來源:ImageViewSaveAsHandler.java

示例15: saveImage

import org.eclipse.swt.graphics.ImageData; //導入依賴的package包/類
protected void saveImage(String filename, ImageView imageView, int imageType) {
	IPreferenceStore store = us.nineworlds.xstreamer.Activator.getDefault().getPreferenceStore();
	String outputDirectory = store.getString(PreferenceConstants.TEMPLATE_XSTREAMER_XWING_OUTPUT_DIRECTORY);
	if (outputDirectory == null || imageView == null) {
		return;
	}

	ImageLoader imageLoader = new ImageLoader();
	imageLoader.data = new ImageData[] { imageView.imageCanvas.getImageData() };
	FileOutputStream outputStream = null;
	try {
		outputStream = new FileOutputStream(new File(outputDirectory, filename));
		imageLoader.save(outputStream, imageType);
	} catch (FileNotFoundException e) {
		Logger.error("Unable to save image to file: " + filename, e);
	} finally {
		IOUtils.closeQuietly(outputStream);
	}
}
 
開發者ID:NineWorlds,項目名稱:xstreamer,代碼行數:20,代碼來源:AbstractImageSelectionListener.java


注:本文中的org.eclipse.swt.graphics.ImageData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。