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 165094 Details for
Bug 99253
[Graphics] Alpha information lost from .ico files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v01
Alpha_Icon.txt (text/plain), 2.78 KB, created by
Praveen
on 2010-04-16 09:33:55 EDT
(
hide
)
Description:
Patch v01
Filename:
MIME Type:
Creator:
Praveen
Created:
2010-04-16 09:33:55 EDT
Size:
2.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java,v >retrieving revision 1.22 >diff -u -r1.22 WinICOFileFormat.java >--- Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java 1 Jul 2009 14:50:22 -0000 1.22 >+++ Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java 16 Apr 2010 13:30:45 -0000 >@@ -138,7 +138,7 @@ > byte[] maskData = bmpFormat.loadData(infoHeader); > maskData = convertPad(maskData, width, height, 1, 4, 2); > bitInvertData(maskData, 0, maskData.length); >- return ImageData.internal_new( >+ ImageData data = ImageData.internal_new( > width, > height, > depth, >@@ -155,6 +155,22 @@ > 0, > 0, > 0); >+ if (depth == 32) { >+ /* >+ * Looking at various header information, only icons with >+ * 32-bit depth can contain alpha channel. So, constructing >+ * alphaData bytes accordingly into imageData object. >+ */ >+ int stride = (width * depth + 7) / 8; >+ byte[] alphaData = new byte[width * height]; >+ for (int y = 0; y < height; y++) { >+ for (int x = 0; x < width; x++) { >+ alphaData[y*width+x] = shapeData[y*stride+x*4 + 3]; >+ } >+ } >+ data.alphaData = alphaData; >+ } >+ return data; > } > int[][] loadIconHeaders(int numIcons) { > int[][] headers = new int[numIcons][7]; >Index: Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java,v >retrieving revision 1.71 >diff -u -r1.71 Image.java >--- Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java 1 Jul 2009 14:50:45 -0000 1.71 >+++ Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java 16 Apr 2010 13:30:46 -0000 >@@ -1005,6 +1005,7 @@ > OS.g_object_unref(pixbuf); > > boolean isIcon = image.getTransparencyType() == SWT.TRANSPARENCY_MASK; >+ boolean hasAlpha = false; > if (isIcon || image.transparentPixel != -1) { > if (image.transparentPixel != -1) { > RGB rgb = null; >@@ -1031,12 +1032,14 @@ > this.type = SWT.BITMAP; > this.mask = 0; > this.alpha = image.alpha; >- if (image.alpha == -1 && image.alphaData != null) { >- this.alphaData = new byte[image.alphaData.length]; >- System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length); >- } >- createAlphaMask(width, height); >+ hasAlpha = true; >+ } >+ if (image.alpha == -1 && image.alphaData != null) { >+ this.alphaData = new byte[image.alphaData.length]; >+ System.arraycopy(image.alphaData, 0, this.alphaData, 0, alphaData.length); >+ hasAlpha = true; > } >+ if (hasAlpha) createAlphaMask(width, height); > this.pixmap = pixmap; > } >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 99253
: 165094 |
165095