bugfix for createColor function

This commit is contained in:
wyq 2023-11-10 22:22:45 +08:00
parent 3767feb785
commit 5627ec2a36
5 changed files with 17 additions and 14 deletions

View File

@ -685,6 +685,7 @@ public class GraphicFactory {
}
m = mIter.getDoubleNext();
cb = ls.findLegendBreak(m);
System.out.println(cb.getColor().getAlpha());
if (Double.isNaN(y) || Double.isNaN(x)) {
if (points.isEmpty()) {
continue;

View File

@ -483,19 +483,22 @@ public class ColorUtil {
* @return Color
*/
public static Color createColor(Color sColor, Color eColor, float p) {
int sR, sG, sB, eR, eG, eB, r, g, b;
int sR, sG, sB, sA, eR, eG, eB, eA, r, g, b, a;
sR = sColor.getRed();
sG = sColor.getGreen();
sB = sColor.getBlue();
sA = sColor.getAlpha();
eR = eColor.getRed();
eG = eColor.getGreen();
eB = eColor.getBlue();
eA = eColor.getAlpha();
r = (int) (sR + (eR - sR) * p);
g = (int) (sG + (eG - sG) * p);
b = (int) (sB + (eB - sB) * p);
b = (int) (sB + (eB - sB) * p);
a = (int) (sA + (eA - sA) * p);
return new Color(r, g, b);
return new Color(r, g, b, a);
}
/**

View File

@ -1,32 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\common_math\interpolate">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\axis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
<RecentFolder Folder="D:\Temp\test\test"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\geoshow"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\scatter"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\scatter"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\topology"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_grid_3d.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\interp2d_4.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\interp2d_nearest_scatter.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_multi_color_alpha.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_grid_3d.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\interp2d_4.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\interp2d_nearest_scatter.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\plot3_multi_color_alpha.py"/>
</RecentFiles>
</File>
<Font>
@ -34,5 +32,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1373,812"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
</MeteoInfo>

View File

@ -11,7 +11,8 @@ import datetime
from org.meteoinfo.geometry.legend import LineStyles, HatchStyle, ColorBreak, PointBreak, PolylineBreak, \
PolygonBreak, ArrowBreak, ArrowLineBreak, ArrowPolygonBreak, StreamlineBreak, \
PointStyle, MarkerType, LegendScheme
from org.meteoinfo.geo.legend import LegendManage
#from org.meteoinfo.geo.legend import LegendManage
from org.meteoinfo.geometry.legend import LegendManage
from org.meteoinfo.common.colors import ColorUtil, ColorMap
from org.meteoinfo.geometry.shape import ShapeTypes
from org.meteoinfo.chart import ChartText