All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xworker.swt.graphics.ImageUtils Maven / Gradle / Ivy

package xworker.swt.graphics;

import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;

public class ImageUtils {
	/**
	 * 剪切一段图片。
	 * 
	 * @param src
	 * @param x
	 * @param y
	 * @param width
	 * @param height
	 * @return
	 */
	public static Image clip(Image src, int x, int y , int width, int height){
		ImageData srcData = src.getImageData();
		ImageData dstData = new ImageData(width, height, srcData.depth, srcData.palette);		
		dstData.transparentPixel = srcData.transparentPixel;
		dstData.alpha = srcData.alpha;
		
		for(int sx=0; sx




© 2015 - 2025 Weber Informatics LLC | Privacy Policy