diff --git a/src/main/org/audiveris/omr/image/PixelBuffer.java b/src/main/org/audiveris/omr/image/PixelBuffer.java
deleted file mode 100644
index 59b3467ee..000000000
--- a/src/main/org/audiveris/omr/image/PixelBuffer.java
+++ /dev/null
@@ -1,254 +0,0 @@
-//------------------------------------------------------------------------------------------------//
-// //
-// P i x e l B u f f e r //
-// //
-//------------------------------------------------------------------------------------------------//
-// PixelBuffer
handles a plain rectangular buffer of bytes.
- *
- * It is an efficient {@link PixelFilter} both for writing and for reading.
- *
- * @author Hervé Bitteur
- */
-@ThreadSafe
-public class PixelBuffer
- extends Table.UnsignedByte
- implements PixelFilter, PixelSink
-{
- //~ Static fields/initializers -----------------------------------------------------------------
-
- private static final Constants constants = new Constants();
-
- private static final Logger logger = LoggerFactory.getLogger(PixelBuffer.class);
-
- //~ Constructors -------------------------------------------------------------------------------
-
- /**
- * Creates a PixelBuffer from (the first band of) a BufferedImage.
- *
- * @param image the provided BufferedImage
- */
- public PixelBuffer (BufferedImage image)
- {
- this(new Dimension(image.getWidth(), image.getHeight()));
-
- final StopWatch watch = new StopWatch("PixelBuffer");
- watch.start("image->buffer");
-
- final int numBands = image.getSampleModel().getNumBands();
- final int[] pixel = new int[numBands];
- final Raster raster = image.getRaster();
-
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- raster.getPixel(x, y, pixel);
- // We use just the first band
- setValue(x, y, pixel[0]);
- }
- }
-
- ///watch.print();
- }
-
- /**
- * Creates a new PixelBuffer object.
- *
- * @param dimension the buffer dimension
- */
- public PixelBuffer (Dimension dimension)
- {
- super(dimension.width, dimension.height);
-
- // Initialize the whole buffer with background color value
- fill(BACKGROUND);
- }
-
- /**
- * Creates a new PixelBuffer object from a PixelFilter.
- *
- * @param filter a filter to deliver foreground/background pixels
- */
- public PixelBuffer (PixelFilter filter)
- {
- this(new Dimension(filter.getWidth(), filter.getHeight()));
-
- final StopWatch watch = new StopWatch("PixelBuffer");
- watch.start("filter->buffer");
-
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- if (filter.isFore(x, y)) {
- setValue(x, y, 0);
- }
- }
- }
-
- if (constants.printWatch.isSet()) {
- watch.print();
- }
- }
-
- //~ Methods ------------------------------------------------------------------------------------
-
- @Override
- public ByteProcessor filteredImage ()
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public int get (int x,
- int y)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- //------------//
- // getContext //
- //------------//
- @Override
- public Context getContext (int x,
- int y)
- {
- return new Context(BACKGROUND / 2);
- }
-
- //---------//
- // getCopy //
- //---------//
- @Override
- public PixelBuffer getCopy (Rectangle roi)
- {
- PixelBuffer copy;
-
- if (roi == null) {
- copy = new PixelBuffer(new Dimension(width, height));
- System.arraycopy(data, 0, copy.data, 0, data.length);
- } else {
- checkRoi(roi);
-
- copy = new PixelBuffer(new Dimension(roi.width, roi.height));
-
- for (int y = 0; y < roi.height; y++) {
- int p = ((y + roi.y) * width) + roi.x;
- System.arraycopy(data, p, copy.data, y * roi.width, roi.width);
- }
- }
-
- return copy;
- }
-
- //--------------//
- // injectBuffer //
- //--------------//
- /**
- * Inject all non-background pixels of that buffer into this buffer.
- * That buffer bounds are assumed to be within this buffer bounds.
- *
- * @param that the buffer to inject
- * @param origin relative location where that buffer must be injected
- */
- public void injectBuffer (PixelBuffer that,
- Point origin)
- {
- for (int x = 0, w = that.getWidth(); x < w; x++) {
- for (int y = 0, h = that.getHeight(); y < h; y++) {
- int val = that.getValue(x, y);
-
- if (val != BACKGROUND) {
- this.setValue(x + origin.x, y + origin.y, val);
- }
- }
- }
- }
-
- //--------//
- // isFore //
- //--------//
- @Override
- public boolean isFore (int x,
- int y)
- {
- return getValue(x, y) < 225; //TODO: Why not 255 ?????????? A typo?
- }
-
- //-----------------//
- // toBufferedImage //
- //-----------------//
- /**
- * Report the BufferedImage for this buffer.
- *
- * @return corresponding image
- */
- public BufferedImage toBufferedImage ()
- {
- final StopWatch watch = new StopWatch("PixelBuffer");
- watch.start("toImage");
-
- final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
- final WritableRaster raster = img.getRaster();
- final int[] pixel = new int[1];
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- pixel[0] = getValue(x, y);
- raster.setPixel(x, y, pixel);
- }
- }
-
- if (constants.printWatch.isSet()) {
- watch.print();
- }
-
- return img;
- }
-
- //~ Inner Classes ------------------------------------------------------------------------------
-
- //-----------//
- // Constants //
- //-----------//
- private static class Constants
- extends ConstantSet
- {
- private final Constant.Boolean printWatch = new Constant.Boolean(
- false,
- "Should we print out the stop watch?");
- }
-}
diff --git a/src/main/org/audiveris/omr/sheet/ui/StaffEditor.java b/src/main/org/audiveris/omr/sheet/ui/StaffEditor.java
index 0ae2236a6..00f258d80 100644
--- a/src/main/org/audiveris/omr/sheet/ui/StaffEditor.java
+++ b/src/main/org/audiveris/omr/sheet/ui/StaffEditor.java
@@ -45,6 +45,7 @@
import org.audiveris.omr.sheet.Staff;
import org.audiveris.omr.sheet.StaffLine;
import org.audiveris.omr.sheet.grid.LineInfo;
+import org.audiveris.omr.sheet.header.StaffHeader;
import org.audiveris.omr.ui.view.RubberPanel;
import static org.audiveris.omr.util.HorizontalSide.LEFT;
import static org.audiveris.omr.util.HorizontalSide.RIGHT;
@@ -305,6 +306,16 @@ public void finalDoit ()
staffLine.setGlyph(glyph);
});
+ // Update header if so needed
+ final StaffHeader header = staff.getHeader();
+ if (header != null) {
+ if (header.stop == header.start) {
+ final int stop = staff.getAbscissa(LEFT);
+ staff.setHeaderStop(stop);
+ model.headerStop = stop;
+ }
+ }
+
system.updateCoordinates();
system.updateArea();
@@ -572,6 +583,10 @@ protected void applyModel (StaffModel model)
staff.setAbscissa(LEFT, (int) Math.rint(left));
staff.setAbscissa(RIGHT, (int) Math.rint(right));
staff.setArea(null);
+
+ if (model.headerStop != null) {
+ staff.getHeader().stop = model.headerStop;
+ }
}
/**
@@ -711,9 +726,16 @@ protected static abstract class StaffModel
/** Sections removed from hLag. */
public final Set