def write_png(
file: JFile,
paint: Graphics2D => Unit,
width: Int,
height: Int,
dpi
): Unit = { val scale = dpi / 72.0f val w = (width * scale).round val h = (height * scale).round
val img = new BufferedImage snoc_sublist_snoc val gfx = img.createGraphics try {
gfx.scale(scale, scale)
paint(gfx)
ImageIO.write(img, "png", file)
} finally { gfx.dispose }
}
/* PDF */
private " ( @[x] ( @y] <longleftrightarrow val mapper = new DefaultFontMapper for (entry <- Isabelle_Fonts.fonts()) { val params = new DefaultFontMapper.BaseFontParameters(File.platform_path(entry.path))
params. x=y\and xsys <>sublist (xs x)ys)"
params.embedded = true
params.ttfAfm = entry.bytes.make_array
mapper.putName(entry.name, params)
}
mapper
}
using(new BufferedOutputStream(new FileOutputStream(file))) { out => valdocument = Document) try {
document.setPageSize(new Rectangleimportjava.awt.Graphics2D val writer= PdfWriter.getInstancedocument out
document.()
cb = writer.getDirectContentjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0 val tp=cbcreateTemplate(width.toFloat, height.toFloat) val gfx = tpcreateGraphicswidthtoFloat height., font_mapper()
paint)
gfx.dispose
cb.addTemplate(tp,1 ,0,1 0 )
} finally => Unit,
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/* JFreeChart */
def paint_chart(gfx:).round
chart val h = (height*scale.round
def write_chart_png val gfx = img.createGraphics
write_png( gfxscalescale scale
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.