本文整理汇总了Java中org.eclipse.swt.graphics.ImageLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLoader.load方法的具体用法?Java ImageLoader.load怎么用?Java ImageLoader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.ImageLoader
的用法示例。
在下文中一共展示了ImageLoader.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processLoad
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的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 );
}
} );
}
示例2: GIFAccess
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public GIFAccess(URLVideoSource src, int numPlays) throws IOException, URISyntaxException {
super(src, numPlays);
ImageLoader loader = new ImageLoader();
ImageData[] images = loader.load(src.getURL().openStream());
for(int i = 0; i < images.length; i++) {
width = Math.max(width, images[i].x + images[i].width);
height = Math.max(height, images[i].y + images[i].height);
}
nClips = images[0].delayTime - 10;
if (nClips > 0 && images.length > (nClips * 2 + 1))
shotStarts = new int[nClips];
else
nClips = 1;
for(int i = 0; i < images.length; i++)
frames.add(convert(i, i == 0 ? null : frames.get(i-1), images[i]));
if(shotStarts != null) {
duration /= nClips * 1000.0;
duration *= images.length;
}
if(shotStarts != null)
for(int i = 1; i < shotStarts.length; i++)
shotStarts[i] += shotStarts[i-1];
}
示例3: getBackRegionFromImage
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
/**
* This method generate a region from a background image
*
* @param display
* is the display area of this region
* @param image
* is the file path of the background image
*/
public static Region getBackRegionFromImage(Display display, String image) {
ImageLoader loader = new ImageLoader();
ImageData[] imageData = loader.load(ResourceLoader.load(image));
Region region = new Region(display);
ImageData data = imageData[0];
ImageData mask = data.getTransparencyMask();
org.eclipse.swt.graphics.Rectangle pixel = new org.eclipse.swt.graphics.Rectangle(
0, 0, 1, 1);
for (int y = 0; y < mask.height; y++) {
for (int x = 0; x < mask.width; x++) {
if (mask.getPixel(x, y) != 0) {
pixel.x = data.x + x;
pixel.y = data.y + y;
region.add(pixel);
}
}
}
return region;
}
示例4: setGIF
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
/**
*
*
* @param inputStream
*/
public void setGIF(InputStream inputStream) {
checkWidget();
if (thread != null) {
thread.stop();
this.getDisplay().timerExec(-1, thread);
}
ImageLoader loader = new ImageLoader();
try {
loader.load(inputStream);
} catch (Exception e) {
this.image = null;
return;
}
if (loader.data[0] != null) this.image = new Image(this.getDisplay(), loader.data[0]);
if (loader.data.length > 1) {
thread = new ComponentStatusLabelGIFHandler(this, loader);
thread.run();
}
redraw();
}
示例5: AnimatedGif
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public AnimatedGif(Display display, Canvas animationCanvas, String animatedGifFile) {
this.display = display;
this.animationCanvas = animationCanvas;
try {
loader = new ImageLoader();
} catch (SWTException ex) {
ConvertigoPlugin.logException(ex, "There was an error loading the GIF", false);
loader = null;
}
imageDataArray = loader.load(getClass().getResourceAsStream(animatedGifFile));
animationCanvasGC = new GC(animationCanvas);
shellBackground = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
}
示例6: start
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
void start(){
if(gifRunner != null) gifRunner.stop();
try {
ImageLoader imageLoader = new ImageLoader();
imageLoader.load( ResourceUtils.getBundleResourceStream(CoreConstants.PLUGIN_CORE, CoreImages.LOADING_ON));
gifRunner = new AnimatedGIFRunner(parent, imageLoader, backgroundImage);
} catch (Exception e) {
throw CoreException.getInstance(CoreException.GENERAL, e);
}
final Thread animeThread = new Thread(gifRunner);
animeThread.setDaemon(true);
animeThread.start();
}
示例7: createThumbnailFileOverSWTFast
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public static boolean createThumbnailFileOverSWTFast(File origImg, File thumb, int width, int height) throws IOException {
ImageLoader imgLoader = new ImageLoader();
ImageData[] imgData = imgLoader.load(origImg.getAbsolutePath());
if (imgData.length > 0) {
createThumbnail(imgData[0], thumb, width, height);
return true;
} else {
logger.info("Unable to load " + origImg.getAbsolutePath());
return false;
}
}
示例8: menuReopen
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
void menuReopen() {
if (currentName == null) {
return;
}
animate = false; // stop any animation in progress
resetScrollBars();
resetScaleCombos();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
this.setCursor(waitCursor);
imageCanvas.setCursor(waitCursor);
try {
loader = new ImageLoader();
long startTime = System.currentTimeMillis();
ImageData[] newImageData;
if (fileName == null) {
URL url = new URL(currentName);
InputStream stream = url.openStream();
newImageData = loader.load(stream);
}
else {
newImageData = loader.load(fileName);
}
loadTime = System.currentTimeMillis() - startTime;
imageDataIndex = 0;
displayImage(newImageData[imageDataIndex]);
}
catch (Exception e) {
showErrorDialog(ImageAnalyzer.bundle.getString("Reloading_lc"), currentName, e);
}
finally {
this.setCursor(null);
imageCanvas.setCursor(crossCursor);
waitCursor.dispose();
}
}
示例9: InstallWizard
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
/**
* Constructor
*/
public InstallWizard() {
setNeedsProgressMonitor(true);
// Set window title
String title;
if (isInstall()) {
title = getInstallManager().getInstallDescription().getWindowTitle();
if (title == null) {
title = MessageFormat.format(InstallMessages.Title0, getInstallManager().getInstallDescription().getProductName());
}
}
else {
title = InstallMessages.UninstallTitle;
}
setWindowTitle(title);
// Load title image if available
try {
if (isInstall()) {
IPath titleImagePath = getInstallManager().getInstallDescription().getTitleImage();
if (titleImagePath != null) {
if (titleImagePath.toFile().exists()) {
ImageLoader imageLoader = new ImageLoader();
ImageData[] imageDatas = imageLoader.load(titleImagePath.toOSString());
if (imageDatas.length > 0) {
titleImage = new Image(Display.getDefault(), imageDatas[0]);
}
}
else {
Installer.log("Missing title image file: " + titleImagePath.toOSString());
}
}
}
}
catch (Exception e) {
Installer.log(e);
}
}
示例10: loadImage
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public Image loadImage(Display display, Point desiredSize, Object newInput) throws CoreException {
if (desiredSize == null)
desiredSize = new Point(0, 0);
byte[] imageContents = GraphViz.load(new ByteArrayInputStream((byte[]) newInput), "png", desiredSize.x,
desiredSize.y);
// try to load the resulting image
ImageLoader loader = new ImageLoader();
ImageData[] imageData = loader.load(new ByteArrayInputStream(imageContents));
return new Image(Display.getDefault(), imageData[0]);
}
示例11: PreviewTimerTask
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
PreviewTimerTask( String taskName, Shell parentShell ) throws IOException
{
this.taskName = taskName;
this.parentShell = parentShell;
if ( imageDatas == null )
{
loader = new ImageLoader();
imageDatas = loader.load( UIHelper.getURL( "icons/obj16/progress_animation.gif" ).openStream( ) ); //$NON-NLS-1$
}
}
示例12: setShell
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public void setShell() {
Region region = getBackRegionFromImage(display, backgroundImageName);
/* Capture the transparent regions and remove them */
Region corner = handleTransparenceRegion(backgroundImage, 0, 0);
region.subtract(corner);
shell.setRegion(region);
/* Set shell size and background according to the region */
Rectangle size = region.getBounds();
shell.setSize(size.width, size.height);
/* Load background */
ImageLoader loader = new ImageLoader();
ImageData[] imageData = loader.load(ResourceLoader
.load(backgroundImageName));
Image image = new Image(null, imageData[0]);
shell.setBackgroundImage(image);
shell.setBackgroundMode(SWT.INHERIT_FORCE);
/* Set icon */
Image shellIcon = new Image(Display.getCurrent(),
GUI.class.getResourceAsStream("/GUI/JustDoIt/image/icon.png"));
shell.setImage(shellIcon);
/* Put the shell in center of screen */
center(shell);
}
示例13: GIFAnimator
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public GIFAnimator(String threadName,
String resourceFileName, Control ctrl, boolean useGIFBackground)
{
super(threadName);
this.useGIFBackground = useGIFBackground;
gc = new GC(ctrl);
display = ctrl.getDisplay();
bgColor = ctrl.getBackground();
loader = new ImageLoader();
imageDataArray = loader.load(SWTHelper.getResourceAsStream(resourceFileName));
if (imageDataArray.length <= 1)
throw new IllegalStateException("The animated file has only one frame ...");
}
示例14: UiDBImage
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
public UiDBImage(String prefix, final String name, final InputStream source){
this.dbImage = new DBImage(prefix, name);
try {
ImageLoader iml = new ImageLoader();
iml.load(source);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
iml.save(baos, SWT.IMAGE_PNG);
dbImage.setBinary(DBImage.FLD_IMAGE, baos.toByteArray());
} catch (IllegalArgumentException | SWTException e) {
log.error("Error setting image object on DBImage " + dbImage.getLabel(), e);
}
}
示例15: getImageDataFromResource
import org.eclipse.swt.graphics.ImageLoader; //导入方法依赖的package包/类
private ImageData getImageDataFromResource(String resourceName) {
ImageLoader imageLoader = new ImageLoader();
ImageData[] imageDatas = imageLoader.load(this.getClass().getResourceAsStream(resourceName));
return imageDatas[0];
}