United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6740278 An image(256 colors) in clipboard should be displayed correctly
6740278 : An image(256 colors) in clipboard should be displayed correctly

Details
Type:
Bug
Submit Date:
2008-08-22
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2009-02-23
Component:
client-libs
OS:
windows_xp
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
5.0u17-rev

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
An image(256 colors) copied in clipboard is not displayed in Java program correctly.
Some right portion of orginal image moves to the left side and shows up in the Java application.

CONFIGURATION :
 JDK: 1.4.2/5.0u16/6.0u10
 OS : WindowsXP(SP2, Japanese)

REPRODUCE:
The following steps are for 6.0u10.
1) Open SwingSet3.png in "paint" tool of Windows Accesorries
2) Save the image as **256 colors bitmap***
3) [edit]-[select All] in paint tools window
4) [edit]-[Copy]
  (The image data is transferred to clipboard)
5) Compile the attached a.java
6) invoke "java a"

Please compare in the image in java application with the original one.
You can see the difference between both images.

                                    

Comments
EVALUATION

The explanation of BITMAPINFOHEADER in Microsoft Platform SDK says,

biClrUsed :
---------------------------------------------------------------------
 Specifies the number of color indexes in the color table
that are actually used by the bitmap.
 If this value is zero, the bitmap uses the maximum number of colors
corresponding to the value of the biBitCount member for
the compression mode specified by biCompression.
 If biClrUsed is nonzero and the biBitCount member is less than 16,
the biClrUsed member specifies the actual number of colors
the graphics engine or device driver accesses.
 ...
--------------------------------------------------------------------

The number of bits are 4bits and 8 bits for 16 colors and 256 colors respectively.
( 4 bits = 16 colors and 8bits = 256colors)
However, 1 << (pSrcBmih->biBitCount - 1)  seems 1 bit less shift distance.
                                     
2008-11-06



Hardware and Software, Engineered to Work Together