Creates the processor if not existing, clears the background and prepares it for plotting. Also called by the PlotWindow class to prepare the window.
()
| 2166 | /** Creates the processor if not existing, clears the background and prepares |
| 2167 | * it for plotting. Also called by the PlotWindow class to prepare the window. */ |
| 2168 | @AstroImageJ(reason = "Support scaling plots") |
| 2169 | ImageProcessor getBlankProcessor() { |
| 2170 | makeMarginValues(); |
| 2171 | //IJ.log("Plot.getBlankPr preferredH="+preferredPlotHeight+" pp.h="+pp.height); |
| 2172 | if (pp.width <= 0 || pp.height <= 0) { |
| 2173 | pp.width = sc(preferredPlotWidth) + leftMargin + rightMargin; |
| 2174 | pp.height = sc(preferredPlotHeight) + topMargin + bottomMargin; |
| 2175 | } |
| 2176 | frameWidth = pp.width - (leftMargin + rightMargin); |
| 2177 | frameHeight = pp.height - (topMargin + bottomMargin); |
| 2178 | scaleFrame(); |
| 2179 | boolean isColored = isColored(); //color, not grayscale required? |
| 2180 | if (ip == null || pp.width != ip.getWidth() || pp.height != ip.getHeight() || (isColored != (ip instanceof ColorProcessor))) { |
| 2181 | if (isColored) { |
| 2182 | ip = new ColorProcessor(pp.width, pp.height); |
| 2183 | } else { |
| 2184 | ip = new ByteProcessor(pp.width, pp.height); |
| 2185 | invertedLut = Prefs.useInvertingLut && !Interpreter.isBatchMode() && IJ.getInstance()!=null; |
| 2186 | if (invertedLut) ip.invertLut(); |
| 2187 | } |
| 2188 | if (imp != null && stack == null) |
| 2189 | imp.setProcessor(ip); |
| 2190 | } |
| 2191 | if (ip instanceof ColorProcessor) |
| 2192 | Arrays.fill((int[])(ip.getPixels()), 0xffffff); |
| 2193 | else |
| 2194 | Arrays.fill((byte[])(ip.getPixels()), invertedLut ? (byte)0 : (byte)0xff); |
| 2195 | |
| 2196 | ip.setFont(scFont(defaultFont)); |
| 2197 | ip.setLineWidth(sc(1)); |
| 2198 | ip.setAntialiasedText(pp.antialiasedText); |
| 2199 | frame = new Rectangle(leftMargin, topMargin, frameWidth+1, frameHeight+1); |
| 2200 | if (pp.frame.color2 != null) { //background color |
| 2201 | ip.setColor(pp.frame.color2); |
| 2202 | ip.setRoi(frame); |
| 2203 | ip.fill(); |
| 2204 | ip.resetRoi(); |
| 2205 | } |
| 2206 | ip.setColor(Color.black); |
| 2207 | return ip; |
| 2208 | } |
| 2209 | |
| 2210 | @AstroImageJ(reason = "Support scaling plots") |
| 2211 | void scaleFrame() { |
no test coverage detected