Bug 54689 - tint value is wrongly applied for several colors
Summary: tint value is wrongly applied for several colors
Status: RESOLVED INFORMATIONPROVIDED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 trivial (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 50787
Blocks:
  Show dependency tree
 
Reported: 2013-03-13 15:53 UTC by Sven
Modified: 2022-08-28 10:32 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven 2013-03-13 15:53:27 UTC
For e.g. xlsx cell back ground color 14277081 - rgb 252/213/180 (visual basic 
used: ActiveCell.Interior.Color) the tint value is correct and also getRgb() 
delivers the correct value (byte array: [-9, -106, 70] - theme 9) without tint 
applied. But the value with the tint applied by getRgbWithTint() (XSSFColor 
internal private method applyTint()) delivers rgb 251/212/180 (byte array: 
[-5, -44, -76] - Hex: F79646). Other color value to reproduce is 14277081 
(theme - 0).
Comment 1 Sven 2013-03-19 10:45:54 UTC
Sorry, I mixed up some colors. Here's the corrected text: 

For e.g. xlsx cell back ground color 11851260 - rgb 252/213/180 (visual basic 
used: ActiveCell.Interior.Color) the tint value is correct and also getRgb() 
delivers the correct value (byte array: [-9, -106, 70] - Hex: F79646 - theme 9) 
without tint applied. But the value with the tint applied by getRgbWithTint() 
(XSSFColor internal private method applyTint()) delivers rgb 251/212/180 (byte 
array: [-5, -44, -76]). 

Other color value to reproduce () is 14277081 - rgb 217/217/217 (theme - 0). 
getRgb() delivers the correct value (byte array: [-1, -1, -1]) but getRgbWithTint() 
delivers byte array [0, 0, 0] even if the tint is -0.1499984740745262. 
If I apply the tint using your method from 3.9 manually I even receive 
216/216/216.

	private static byte applyTint(int lum, double tint){
		if(tint > 0){
			return (byte)(lum * (1.0-tint) + (255 - 255 * (1.0-tint)));
		} else if (tint < 0){
			return (byte)(lum*(1+tint));
		} else {
			return (byte)lum;
		}
	}
Comment 2 Sven 2013-03-19 10:53:12 UTC
Additionally for the second case I see XSSFColor.getRgb() delivers byte array 
[-1, -1, -1] where XSSFColor.getCTColor().getRgb() delivers [0, 0, 0]. This 
is the reason why getRgbWithTint() delivers [0, 0, 0] also. I applied tint with 
XSSFColor.getRgb().
Comment 3 Dominik Stadler 2015-08-25 19:16:04 UTC
This sounds similar to bug 54689
Comment 4 Javen O'Neal 2016-10-09 11:49:33 UTC
This may be a duplicate of bug 50787 or bug 59224. Can you verify that this issue still exists in the latest version of POI and is not a duplicate? If this is the case, please include a unit test to make it easier to verify this bug.
Comment 5 PJ Fanning 2022-08-28 10:32:45 UTC
Closing - please reopen if you can reproduce this with latest POI release