Fills space between polyline and y=0 with the current color (the secondary color of the plotObject)
(ImageProcessor ip, float[] xF, float[] yF, int len)
| 3930 | * Fills space between polyline and y=0 with the current color (the secondary color of the plotObject) |
| 3931 | */ |
| 3932 | void drawFloatPolyLineFilled(ImageProcessor ip, float[] xF, float[] yF, int len) { |
| 3933 | if (xF == null || len <=1) |
| 3934 | return; |
| 3935 | ip.setLineWidth(1); |
| 3936 | int y0 = scaleYWithOverflow(0); |
| 3937 | int x1, y1; |
| 3938 | int x2 = scaleX(xF[0]); |
| 3939 | int y2 = scaleY(yF[0]); |
| 3940 | boolean isNaN1; |
| 3941 | boolean isNaN2 = Float.isNaN(xF[0]) || Float.isNaN(yF[0]) || (logXAxis && xF[0]<=0) || (logYAxis && yF[0]<=0); |
| 3942 | for (int i = 1; i < len; i++) { |
| 3943 | isNaN1 = isNaN2; |
| 3944 | isNaN2 = Float.isNaN(xF[i]) || Float.isNaN(yF[i]) || (logXAxis && xF[i]<=0) || (logYAxis && yF[i]<=0); |
| 3945 | x1 = x2; |
| 3946 | y1 = y2; |
| 3947 | x2 = scaleX(xF[i]); |
| 3948 | y2 = scaleY(yF[i]); |
| 3949 | int left = x1; |
| 3950 | int right = x2; |
| 3951 | if (isNaN1 || isNaN2) continue; |
| 3952 | if (left < frame.x && right < frame.x) continue; // ignore if all outside the plot area |
| 3953 | if (left >= frame.x+frame.width && right >= frame.x+frame.width) continue; |
| 3954 | if (left < frame.x) left = frame.x; |
| 3955 | if (left >= frame.x+frame.width) left = frame.x+frame.width-1; |
| 3956 | if (right < frame.x) right = frame.x; |
| 3957 | if (right >= frame.x+frame.width) right = frame.x+frame.width-1; |
| 3958 | if (left != right) { |
| 3959 | for (int xi = Math.min(left,right); xi <= Math.max(left,right); xi++) { |
| 3960 | int yi = (int)Math.round(y1 + (double)(y2 - y1)*(double)(xi - x1)/(double)(x2 - x1)); |
| 3961 | /* double yMin = Math.min(yF[i-1], yF[i]); |
| 3962 | double yMax = Math.max(yF[i-1], yF[i]); |
| 3963 | if (y < yMin) y = yMin; // dont extrapolate (in case rounding to pixels falls outside [xi, xi+1] interval) |
| 3964 | if (y > yMax) y = yMax;*/ |
| 3965 | ip.drawLine(xi, y0, xi, yi); |
| 3966 | } |
| 3967 | } else { |
| 3968 | ip.drawLine(left, y0, left, y2); |
| 3969 | } |
| 3970 | } |
| 3971 | } |
| 3972 | |
| 3973 | /** Returns only indexed and sorted plot objects, if at least one label is indexed like "1__MyLabel" */ |
| 3974 | @AstroImageJ(reason = "Access widen for Vector Plot saving", modified = true) |
no test coverage detected