Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 75415 Details for
Bug 47783
Jpeg encoding (image height =1)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
reproducible testcase
ImageSaveTest.java (text/plain), 1.52 KB, created by
Stef van Dijk
on 2007-08-05 22:59:54 EDT
(
hide
)
Description:
reproducible testcase
Filename:
MIME Type:
Creator:
Stef van Dijk
Created:
2007-08-05 22:59:54 EDT
Size:
1.52 KB
patch
obsolete
>package swt.tests; > >import java.io.FileNotFoundException; >import java.io.FileOutputStream; >import java.io.IOException; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.graphics.ImageData; >import org.eclipse.swt.graphics.ImageLoader; >import org.eclipse.swt.widgets.Display; > >public class ImageSaveTest { > > public static void main(String[] args) { > (new ImageSaveTest()). run(); > System.out.println("Test complete."); > } > > public void run() { > > int width = 128; > int height = 1; > > Display display = new Display(); > Image img = new Image(display, width, height); > GC gc = new GC(img); > gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); > gc.fillRectangle(0,0,width,height); > gc.dispose(); > > ImageData imageData = img.getImageData(); > > ImageLoader imageLoader = new ImageLoader(); > imageLoader.data = new ImageData[] {imageData}; > imageLoader.logicalScreenWidth = imageData.width; > imageLoader.logicalScreenHeight = imageData.height; > FileOutputStream outputStream = null; > java.io.File imageFile = new java.io.File("test.jpg"); > try { > try { > outputStream = new FileOutputStream(imageFile); > } catch (FileNotFoundException e) { > e.printStackTrace(); > } > imageLoader.save(outputStream, SWT.IMAGE_JPEG); > } finally { > if (outputStream != null) { > try { > outputStream.close(); > } catch (IOException e) { > e.printStackTrace(); > } > } > display.dispose(); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 47783
: 75415 |
86691