[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-2d-dev
Subject: Re: [OpenJDK 2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk while reading non-index
From: Jayathirth D V <jayathirth.d.v () oracle ! com>
Date: 2018-03-28 8:13:23
Message-ID: 145db2fc-516f-4602-be90-210985690f22 () default
[Download RAW message or body]
Hi Krishna,
Thanks for providing the inputs.
1. I suggest to rename considerTransparentPixel as isAlphaPresent.
As discussed I have added new name as isTransparentPixelPresent()
2. You can refactor the function body as below:
Return ((destinationBands == null ||
destinationBands.length == 4) &&
metadata.tRNS_colorType == PNG_COLOR_RGB);
Changes are made.
3. From line 1088 through 1113, I see some repeated calculations like \
bytesPerRow etc. Why can't we reuse the previously defined variables? Apart from \
destBands, all the other calculations look similar and repeated.
Previous to this change all the values like inputsBands, bytesPerRow, eltsPerRow were \
same between the decoded output and destination image. Now because we are changing \
only the destination image due to the presence of transparent pixel, we need both \
these set of values. inputsBands, bytesPerRow, eltsPerRow will be used for decoded \
output and destBands, destEltsPerRow for destination image. Its better if don't \
mingle code flow or variables between these two code paths.
4. When you are copying the pixels to a writable raster, at line 1273, you \
could reduce the repetition of the lines, by just having one statement inside if as \
below:
for (int i = 0; i < passWidth; i++) {
byteData[destidx] = curr[srcidx];
byteData[destidx + 1] = curr[srcidx + 1];
byteData[destidx + 2] = curr[srcidx + 2];
if (curr[srcidx] == (byte)metadata.tRNS_red &&
curr[srcidx + 1] == (byte)metadata.tRNS_green &&
curr[srcidx + 2] == (byte)metadata.tRNS_blue)
{
byteData[destidx + 3] = (byte)0;
} else {
byteData[destidx + 3] = (byte)255;
}
srcidx += 3;
destidx += 4;
}
Same thing can be done for the loop that executes for 16bit pixel data.
Changes are made.
Please find updated webrev for review :
http://cr.openjdk.java.net/~jdv/6788458/webrev.03/
Thanks,
Jay
From: Krishna Addepalli
Sent: Wednesday, March 28, 2018 11:52 AM
To: Jayathirth D V; 2d-dev
Subject: RE: [OpenJDK 2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk \
while reading non-indexed RGB images
Hi Jay,
I have some points as below:
1. I suggest to rename considerTransparentPixel as isAlphaPresent.
2. You can refactor the function body as below:
Return ((destinationBands == null ||
destinationBands.length == 4) &&
metadata.tRNS_colorType == PNG_COLOR_RGB);
3. From line 1088 through 1113, I see some repeated calculations like \
bytesPerRow etc. Why can't we reuse the previously defined variables? Apart from \
destBands, all the other calculations look similar and repeated.
4. When you are copying the pixels to a writable raster, at line 1273, you \
could reduce the repetition of the lines, by just having one statement inside if as \
below:
for (int i = 0; i < passWidth; i++) {
byteData[destidx] = curr[srcidx];
byteData[destidx + 1] = curr[srcidx + 1];
byteData[destidx + 2] = curr[srcidx + 2];
if (curr[srcidx] == (byte)metadata.tRNS_red &&
curr[srcidx + 1] == (byte)metadata.tRNS_green &&
curr[srcidx + 2] == (byte)metadata.tRNS_blue)
{
byteData[destidx + 3] = (byte)0;
} else {
byteData[destidx + 3] = (byte)255;
}
srcidx += 3;
destidx += 4;
}
Same thing can be done for the loop that executes for 16bit pixel data.
I haven't yet checked the test cases.
Thanks,
Krishna
From: Jayathirth D V
Sent: Wednesday, March 28, 2018 9:52 AM
To: 2d-dev <HYPERLINK "mailto:2d-dev@openjdk.java.net"2d-dev@openjdk.java.net>
Subject: Re: [OpenJDK 2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk \
while reading non-indexed RGB images
Hello All,
I have enhanced both the test case to verify pixels which not only match tRNS \
transparent pixel data but also for them which doesn't match tRNS transparent pixel \
data.
Please find updated webrev for review:
http://cr.openjdk.java.net/~jdv/6788458/webrev.02/
Thanks,
Jay
From: Jayathirth D V
Sent: Wednesday, March 28, 2018 8:28 AM
To: 2d-dev
Subject: Re: [OpenJDK 2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk \
while reading non-indexed RGB images
Hello All,
I just realized that the test case Read16BitPNGWithTRNSChunk.java is creating (50, \
50) image(which was done while debugging the issue), which is not needed as we need \
single pixel to verify the fix as it is done in Read8BitPNGWithTRNSChunk.java. I have \
updated Read16BitPNGWithTRNSChunk.java to reflect this small change.
Please find updated webrev for review:
http://cr.openjdk.java.net/~jdv/6788458/webrev.01/
Thanks,
Jay
From: Jayathirth D V
Sent: Tuesday, March 27, 2018 6:51 PM
To: 2d-dev
Subject: [OpenJDK 2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk \
while reading non-indexed RGB images
Hello All,
Please review the following solution in JDK11 :
Bug : https://bugs.openjdk.java.net/browse/JDK-6788458
Webrev : http://cr.openjdk.java.net/~jdv/6788458/webrev.00/
Issue: When we try to read non-indexed RGB PNG image having transparent pixel \
information in tRNS chunk, ImageIO.PNGImageReader ignores the transparent pixel \
information. If we use Toolkit.getDefaultToolkit().createImage() it doesn't ignore \
the transparent pixel information.
Root cause: In ImageIO.PNGImageReader() we store tRNS chunk values in readMetadata() \
-> parse_tRNS_chunk (), but we never use the tRNS R, G, B value to compare with \
decoded image information. Also in ImageIO.PNGImageReader() for IHDR colortype RGB we \
use only 3 channel destination BufferedImage. So even if we use the tRNS chunk value \
we need destination BufferedImage of 4 channels to represent transparency.
Solution: While assigning destination image in PNGImageReader.getImageTypes() if we \
know that PNG image is of type RGB and has tRNS chunk then we need to assign a \
destination image having 4 channels. After that in decodePass() we need to create 4 \
channel destination raster and while we store decoded image information into the \
destination BufferedImage we need to compare decoded R, G, B values with tRNS R, G, B \
values and store appropriate alpha channel value.
Also we use 4 channel destination image in case of RGB image only when tRNS chunk is \
present and ImageReadParam.destinationBands is null or \
ImageReadParam.destinationBands is equal to 4.
One more change is that we have optimization in PNGImageReader.readMetadata() where \
if ignoreMetadata is true and IHDR colortype is not of type PNG_COLOR_PALETTE, we \
ignore all the chunk data and just try to find first IDAT chunk. But if we need tRNS \
chunk values in case of IHDR colortype PNG_COLOR_RGB we need to parse tNRS chunk \
also. So in readMetadata() also appropriate changes are made.
Note : Initially the enhancement request was present only for 8 bit RGB PNG images \
but after making more modifications realized that we can add support for 16 bit RGB \
image also by making similar incremental changes. The tRNS chunk value is still \
ignored for Gray PNG image. If we need to support PNG_COLOR_GRAY image with tRNS \
chunk(which is very rare) we can take that up in a separate bug as it needs different \
set of changes.
Thanks,
Jay
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:457146263;
mso-list-type:hybrid;
mso-list-template-ids:1444586246 67698703 67698713 67698715 67698703 67698713 \
67698715 67698703 67698713 67698715;} @list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:2067146257;
mso-list-type:hybrid;
mso-list-template-ids:1444586246 67698703 67698713 67698715 67698703 67698713 \
67698715 67698703 67698713 67698715;} @list l1:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" \
vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi \
Krishna,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p \
class=MsoNormal>Thanks for providing the inputs.<o:p></o:p></p><p \
class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p \
class=MsoListParagraph style='text-indent:-.25in;mso-list:l1 level1 lfo2'><![if \
!supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>1.<span \
style='font:7.0pt "Times New Roman"'> \
</span></span></span><![endif]><span style='color:#1F497D'>I suggest to rename \
<b>considerTransparentPixel </b>as<b> isAlphaPresent.</b><o:p></o:p></span></p><p \
class=MsoNormal style='margin-left:.5in'>As discussed I have added new name as \
<b>isTransparentPixelPresent()<o:p></o:p></b></p><p class=MsoNormal \
style='margin-left:.5in'><span style='color:#1F497D'><o:p> </o:p></span></p><p \
class=MsoListParagraph style='text-indent:-.25in;mso-list:l1 level1 lfo2'><![if \
!supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>2.<span \
style='font:7.0pt "Times New Roman"'> \
</span></span></span><![endif]><span style='color:#1F497D'>You can refactor the \
function body as below:<o:p></o:p></span></p><p class=MsoListParagraph \
style='margin-left:1.0in'><span style='color:#1F497D'> \
Return ((destinationBands == null ||<o:p></o:p></span></p><p class=MsoListParagraph \
style='margin-left:1.0in'><span \
style='color:#1F497D'> \
destinationBands.length == 4) &&<o:p></o:p></span></p><p \
class=MsoListParagraph style='margin-left:1.0in'><span \
style='color:#1F497D'> \
metadata.tRNS_colorType == PNG_COLOR_RGB);<o:p></o:p></span></p><p \
class=MsoListParagraph style='margin-left:1.0in'><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'> \
</span>Changes are made.<span \
style='color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph \
style='text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span \
style='color:#1F497D'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times \
New Roman"'> </span></span></span><![endif]><span \
style='color:#1F497D'>From line 1088 through 1113, I see some repeated calculations \
like bytesPerRow etc. Why can’t we reuse the previously defined variables? \
Apart from destBands, all the other calculations look similar and \
repeated.<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph>Previous \
to this change all the values like inputsBands, bytesPerRow, eltsPerRow were same \
between the decoded output and destination image.<br>Now because we are changing only \
the destination image due to the presence of transparent pixel, we need both these \
set of values. inputsBands, bytesPerRow, eltsPerRow will be used for \
decoded output and destBands, destEltsPerRow for destination image. Its better if \
don’t mingle code flow or variables between these two code \
paths.<o:p></o:p></p><p class=MsoListParagraph><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph \
style='text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span \
style='color:#1F497D'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times \
New Roman"'> </span></span></span><![endif]><span \
style='color:#1F497D'>When you are copying the pixels to a writable raster, at line \
1273, you could reduce the repetition of the lines, by just having one statement \
inside if as below:<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'>for (int i = 0; i < passWidth; i++) \
{<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx] = curr[srcidx];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 1] = curr[srcidx + 1];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 2] = curr[srcidx + 2];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> \
if (curr[srcidx] == (byte)metadata.tRNS_red &&<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
curr[srcidx + 1] == (byte)metadata.tRNS_green &&<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
curr[srcidx + 2] == (byte)metadata.tRNS_blue)<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> \
{<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 3] = (byte)0;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
} else {<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; byteData[destidx \
+ 3] = (byte)255;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
}<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
srcidx += 3;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
destidx += 4;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
}<o:p></o:p></span></p><p class=MsoListParagraph><span style='color:#1F497D'>Same \
thing can be done for the loop that executes for 16bit pixel \
data.<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph>Changes \
are made.<o:p></o:p></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal>Please find \
updated webrev for review :<o:p></o:p></p><p class=MsoNormal><span \
style='color:#1F497D'><a \
href="http://cr.openjdk.java.net/~jdv/6788458/webrev.03/">http://cr.openjdk.java.net/~jdv/6788458/webrev.03/</a> \
<o:p></o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p \
class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Jay<o:p></o:p></p><p \
class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div \
style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal><b>From:</b> Krishna Addepalli <br><b>Sent:</b> Wednesday, March 28, \
2018 11:52 AM<br><b>To:</b> Jayathirth D V; 2d-dev<br><b>Subject:</b> RE: [OpenJDK \
2D-Dev] [11] RFR JDK-6788458: PNGImageReader ignores tRNS chunk while reading \
non-indexed RGB images<o:p></o:p></p></div></div><p \
class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span \
style='color:#1F497D'>Hi Jay,<o:p></o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'>I have some points as below:<o:p></o:p></span></p><p \
class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo3'><![if \
!supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>1.<span \
style='font:7.0pt "Times New Roman"'> \
</span></span></span><![endif]><span style='color:#1F497D'>I suggest to rename \
<b>considerTransparentPixel </b>as<b> isAlphaPresent.</b><o:p></o:p></span></p><p \
class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo3'><![if \
!supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>2.<span \
style='font:7.0pt "Times New Roman"'> \
</span></span></span><![endif]><span style='color:#1F497D'>You can refactor the \
function body as below:<o:p></o:p></span></p><p class=MsoListParagraph \
style='margin-left:1.0in'><span style='color:#1F497D'> \
Return ((destinationBands == null ||<o:p></o:p></span></p><p class=MsoListParagraph \
style='margin-left:1.0in'><span \
style='color:#1F497D'> \
destinationBands.length == 4) &&<o:p></o:p></span></p><p \
class=MsoListParagraph style='margin-left:1.0in'><span \
style='color:#1F497D'> \
metadata.tRNS_colorType == PNG_COLOR_RGB);<o:p></o:p></span></p><p \
class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo3'><![if \
!supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>3.<span \
style='font:7.0pt "Times New Roman"'> \
</span></span></span><![endif]><span style='color:#1F497D'>From line 1088 through \
1113, I see some repeated calculations like bytesPerRow etc. Why can’t we reuse \
the previously defined variables? Apart from destBands, all the other calculations \
look similar and repeated.<o:p></o:p></span></p><p class=MsoListParagraph \
style='text-indent:-.25in;mso-list:l0 level1 lfo3'><![if !supportLists]><span \
style='color:#1F497D'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times \
New Roman"'> </span></span></span><![endif]><span \
style='color:#1F497D'>When you are copying the pixels to a writable raster, at line \
1273, you could reduce the repetition of the lines, by just having one statement \
inside if as below:<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'>for (int i = 0; i < passWidth; i++) \
{<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx] = curr[srcidx];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 1] = curr[srcidx + 1];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 2] = curr[srcidx + 2];<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> \
if (curr[srcidx] == (byte)metadata.tRNS_red &&<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
curr[srcidx + 1] == (byte)metadata.tRNS_green &&<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
curr[srcidx + 2] == (byte)metadata.tRNS_blue)<o:p></o:p></span></p><p \
class=MsoListParagraph><span \
style='color:#1F497D'> \
{<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; \
byteData[destidx + 3] = (byte)0;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
} else {<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> &nbs \
p; byteData[destidx \
+ 3] = (byte)255;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
}<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
srcidx += 3;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
destidx += 4;<o:p></o:p></span></p><p class=MsoListParagraph><span \
style='color:#1F497D'> \
}<o:p></o:p></span></p><p class=MsoListParagraph><span style='color:#1F497D'>Same \
thing can be done for the loop that executes for 16bit pixel \
data.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:1.0in'><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph \
style='margin-left:1.0in'><span style='color:#1F497D'><o:p> </o:p></span></p><p \
class=MsoNormal><span style='color:#1F497D'>I haven’t yet checked the test \
cases.<o:p></o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span \
style='color:#1F497D'>Krishna<o:p></o:p></span></p><p class=MsoNormal><span \
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic