Mercurial > hg > jslab
view src/samer/core_/util/Tools.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
line wrap: on
line source
/* * Tools.java * * Copyright (c) 2000, Samer Abdallah, King's College London. * All rights reserved. * * This software is provided AS iS and WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. */ package samer.core.util; import java.awt.*; import java.io.*; import java.util.*; import java.awt.*; import java.lang.reflect.*; import samer.core.*; public class Tools { // for scheme to use - a bit clunky! public static double[] doubleArray(int n) { return new double[n]; } public static double doubleArray(double[] x, int i) { return x[i]; } public static double doubleArray(double[] x, int i, double y) { return x[i]=y; } public static double[] doubleArray(double[] x, Object[] y) { for (int i=0; i<y.length; i++) x[i]=((Double)X.DoubleCodec.decode(y[i])).doubleValue(); return x; } public static double[] doubleArray(Object [] y) { double [] x=new double[y.length]; return doubleArray(x,y); } private static Object aa=RenderingHints.VALUE_ANTIALIAS_OFF; public static void setAntialias(boolean f) { aa= f ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } public static Graphics initGraphics( Graphics g) { Graphics2D g2=(Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); //g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aa); return g; } }