Line.java (pdfbox-2.0.23-src) | : | Line.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 105 | skipping to change at line 105 | |||
/** | /** | |||
* Calculate the color of a point on a rasterized line by linear | * Calculate the color of a point on a rasterized line by linear | |||
* interpolation. | * interpolation. | |||
* | * | |||
* @param p target point, p should always be contained in linePoints | * @param p target point, p should always be contained in linePoints | |||
* @return color | * @return color | |||
*/ | */ | |||
protected float[] calcColor(Point p) | protected float[] calcColor(Point p) | |||
{ | { | |||
int numberOfColorComponents = color0.length; | ||||
float[] pc = new float[numberOfColorComponents]; | ||||
if (point0.x == point1.x && point0.y == point1.y) | if (point0.x == point1.x && point0.y == point1.y) | |||
{ | { | |||
return color0; | return color0; | |||
} | } | |||
else if (point0.x == point1.x) | int numberOfColorComponents = color0.length; | |||
float[] pc = new float[numberOfColorComponents]; | ||||
if (point0.x == point1.x) | ||||
{ | { | |||
float l = point1.y - point0.y; | float l = point1.y - point0.y; | |||
for (int i = 0; i < numberOfColorComponents; i++) | for (int i = 0; i < numberOfColorComponents; i++) | |||
{ | { | |||
pc[i] = (color0[i] * (point1.y - p.y) / l | pc[i] = (color0[i] * (point1.y - p.y) / l | |||
+ color1[i] * (p.y - point0.y) / l); | + color1[i] * (p.y - point0.y) / l); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |