private void render_music_manuscript(Artist artist) { float lineSpacingMm = 2.0f; float staveHeight = 4 * lineSpacingMm; float staffTopMarginMm = 25.0f; float staffBottomMarginMm = 15.0f; float staffSideMarginMm = 15.0f; int staveCount = 12; if (aspectRatio.isPortrait()) staveCount = 12; else staveCount = 8; float staffTotal = staffTopMarginMm + staffBottomMarginMm + staveCount * staveHeight; float staffSpacing = staveHeight + (heightMm - staffTotal) / (staveCount - 1); float x0, x1, y; LineStyle line = new LineStyle(); line.setColor(0f, 0f, 0f); line.setWidth(0); staffSpacing = staveHeight + (heightMm - staffTotal) / (staveCount - 1); x0 = staffSideMarginMm / heightMm; x1 = (widthMm - staffSideMarginMm) / heightMm; for (int i = 0; i < staveCount; i++) { for (int j = 0; j < 5; j++) { y = (staffTopMarginMm + i * staffSpacing + j * lineSpacingMm) / heightMm; artist.drawLine(x0, y, x1, y, line); } } }
private void render_cornellnotes(Artist artist) { float x0, x1, y0, y1; final float MARGIN = 1.25f; LineStyle line = new LineStyle(); line.setColor(0f, 0f, 0f); line.setWidth(0); // Cue Column x0 = (MARGIN * INCH_in_MM) / widthMm; x1 = x0; y0 = 0f; y1 = (heightMm - (MARGIN * INCH_in_MM)) / heightMm; artist.drawLine(x0, y0, x1, y1, line); // Summary area at base of page x0 = 0f; x1 = widthMm / heightMm; y0 = (heightMm - (MARGIN * INCH_in_MM)) / heightMm; y1 = y0; artist.drawLine(x0, y0, x1, y1, line); // Details float spacingMm = COLLEGERULED_SPACING; int n = (int) Math.floor((heightMm - (MARGIN * INCH_in_MM) - 2 * marginMm) / spacingMm); x0 = (MARGIN * INCH_in_MM) / widthMm + marginMm / heightMm; x1 = (widthMm - marginMm) / heightMm; for (int i = 1; i <= n; i++) { float y = ((heightMm - n * spacingMm - MARGIN * INCH_in_MM) / 2 + i * spacingMm) / heightMm; artist.drawLine(x0, y, x1, y, line); } }
private void render_ruled(Artist artist, float lineSpacing, float margin) { float spacingMm = lineSpacing; float vertLineMm = margin; LineStyle line = new LineStyle(); line.setColor(0f, 0f, 0f); line.setWidth(0); int n = (int) Math.floor((heightMm - 2 * marginMm) / spacingMm) - 2; float x0 = marginMm / heightMm; float x1 = (widthMm - marginMm) / heightMm; for (int i = 1; i <= n; i++) { float y = ((heightMm - n * spacingMm) / 2 + i * spacingMm) / heightMm; artist.drawLine(x0, y, x1, y, line); } // Paint margin if (margin > 0.0f) { line.setColor(1f, 0f, 0f); line.setWidth(0); float y0 = marginMm / heightMm; float y1 = (heightMm - marginMm) / heightMm; float x = vertLineMm / widthMm; artist.drawLine(x, y0, x, y1, line); } }
private void render_quad(Artist artist) { float spacingMm = 5f; int nx, ny; float x, x0, x1, y, y0, y1; LineStyle line = new LineStyle(); line.setColor(0f, 0f, 0f); line.setWidth(0); ny = (int) Math.floor((heightMm - 2 * marginMm) / spacingMm); nx = (int) Math.floor((widthMm - 2 * marginMm) / spacingMm); float marginXMm = (widthMm - nx * spacingMm) / 2; float marginYMm = (heightMm - ny * spacingMm) / 2; x0 = marginXMm / heightMm; x1 = (widthMm - marginXMm) / heightMm; y0 = marginYMm / heightMm; y1 = (heightMm - marginYMm) / heightMm; for (int i = 0; i <= ny; i++) { y = (marginYMm + i * spacingMm) / heightMm; artist.drawLine(x0, y, x1, y, line); } for (int i = 0; i <= nx; i++) { x = (marginXMm + i * spacingMm) / heightMm; artist.drawLine(x, y0, x, y1, line); } }