本文整理汇总了Java中org.eclipse.swt.SWT.IMAGE_JPEG属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.IMAGE_JPEG属性的具体用法?Java SWT.IMAGE_JPEG怎么用?Java SWT.IMAGE_JPEG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.IMAGE_JPEG属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
public static boolean save(IEditorPart editorPart, GraphicalViewer viewer) {
Assert.isNotNull(editorPart, "null editorPart passed to ImageSaveUtil::save");
Assert.isNotNull(viewer, "null viewer passed to ImageSaveUtil::save");
String saveFilePath = getSaveFilePath(editorPart, viewer, -1);
if (saveFilePath == null)
return false;
int format = SWT.IMAGE_JPEG;
if (saveFilePath.endsWith(".jpeg"))
format = SWT.IMAGE_JPEG;
else if (saveFilePath.endsWith(".bmp"))
format = SWT.IMAGE_BMP;
// else if (saveFilePath.endsWith(".ico"))
// format = SWT.IMAGE_ICO;
return save(editorPart, viewer, saveFilePath, format);
}
示例2: getSaveFilePath
private static String getSaveFilePath(IEditorPart editorPart, GraphicalViewer viewer, int format) {
FileDialog fileDialog = new FileDialog(editorPart.getEditorSite().getShell(), SWT.SAVE);
String[] filterExtensions = new String[] { "*.jpeg",
"*.bmp"/*
* , "*.ico" , "*.png", "*.gif"
*/ };
if (format == SWT.IMAGE_BMP)
filterExtensions = new String[] { "*.bmp" };
else if (format == SWT.IMAGE_JPEG)
filterExtensions = new String[] { "*.jpeg" };
// else if (format == SWT.IMAGE_ICO)
// filterExtensions = new String[] { "*.ico" };
fileDialog.setFilterExtensions(filterExtensions);
return fileDialog.open();
}
示例3: save
/**
* 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);
}