use of org.eclipse.swt.graphics.ImageData in project tdi-studio-se by Talend.
the class StatusConfirmSettingDialog method getItemsImage.
private Image getItemsImage(IImage iImage) {
if (iImage == null) {
iImage = EImage.DEFAULT_IMAGE;
}
Image image = cacheItemImages.get(iImage);
if (image == null) {
Image oImage = ImageProvider.getImage(iImage);
ImageData imageData = oImage.getImageData();
// enlarge image
final int larger = 4;
ImageData newData = imageData.scaledTo(imageData.width + larger, imageData.height + larger);
image = new Image(oImage.getDevice(), newData);
cacheItemImages.put(iImage, image);
}
return image;
}
use of org.eclipse.swt.graphics.ImageData in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method getItemsImage.
protected Image getItemsImage(IImage iImage) {
if (iImage == null) {
iImage = EImage.DEFAULT_IMAGE;
}
Image image = cacheItemImages.get(iImage);
if (image == null) {
Image oImage = ImageProvider.getImage(iImage);
ImageData imageData = oImage.getImageData();
// enlarge image
final int larger = 4;
ImageData newData = imageData.scaledTo(imageData.width + larger, imageData.height + larger);
image = new Image(oImage.getDevice(), newData);
cacheItemImages.put(iImage, image);
}
return image;
}
use of org.eclipse.swt.graphics.ImageData in project tdi-studio-se by Talend.
the class AttributeLabelProvider method getWriteOverlayImage.
/**
* Gets the write overlay image.
*
* @return The write overlay image
*/
private Image getWriteOverlayImage() {
if (writeOverlayImage == null || writeOverlayImage.isDisposed()) {
ImageDescriptor[] descriptors = new ImageDescriptor[] { null, null, null, null };
descriptors[IDecoration.TOP_RIGHT] = Activator.getImageDescriptor(ISharedImages.WRITE_OVR_IMG_PATH);
ImageData imageData = Activator.getImageDescriptor(ISharedImages.ATTRIBUTE_IMG_PATH).getImageData();
writeOverlayImage = new OverlayImageDescriptor(imageData, descriptors, new Point(IMAGE_WIDTH, 16)).createImage();
}
return writeOverlayImage;
}
use of org.eclipse.swt.graphics.ImageData in project tdi-studio-se by Talend.
the class HTMLDocGenerator method saveLogoImage.
protected void saveLogoImage(int type, File file) throws IOException {
boolean documentationPluginLoaded = PluginChecker.isDocumentationPluginLoaded();
// get image from cache
ByteArrayOutputStream result = logoImageCache.get(type);
if (documentationPluginLoaded) {
String userLogoPath = CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.DOC_USER_LOGO);
if (userLogoPath != null && !"".equals(userLogoPath)) {
//$NON-NLS-1$
if (result == null || !userLogoPath.equals(userDocImageOldPath)) {
userDocImageOldPath = userLogoPath;
result = new ByteArrayOutputStream(3072);
File userLogo = new File(userLogoPath);
if (userLogo.exists()) {
Image image = new Image(Display.getCurrent(), userLogoPath);
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { image.getImageData() };
imageLoader.save(result, type);
logoImageCache.put(type, result);
image.dispose();
}
}
FileOutputStream fos = new FileOutputStream(file);
fos.write(result.toByteArray());
fos.close();
return;
}
}
// if (result == null) {
result = new ByteArrayOutputStream(3072);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
ImageData imageData = brandingService.getLoginHImage().getImageData();
new ByteArrayOutputStream();
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { imageData };
imageLoader.save(result, type);
// put image to cache, no need to generate next time
logoImageCache.put(type, result);
// }
FileOutputStream fos = new FileOutputStream(file);
fos.write(result.toByteArray());
fos.close();
}
use of org.eclipse.swt.graphics.ImageData in project tdi-studio-se by Talend.
the class SWTResourceManager method getImage.
/**
* Returns an image encoded by the specified input stream
*
* @param is InputStream The input stream encoding the image data
* @return Image The image encoded by the specified input stream
*/
protected static Image getImage(InputStream is) {
Display display = Display.getCurrent();
ImageData data = new ImageData(is);
if (data.transparentPixel > 0) {
return new Image(display, data, data.getTransparencyMask());
}
return new Image(display, data);
}
Aggregations