private static Paint resizeLinearGradient(Paint p, int width, int height) { try { Point2D[] pts = new Point2D[2]; pts[0] = (Point2D) invokeMethod(p,"getStartPoint"); pts[1] = (Point2D) invokeMethod(p,"getEndPoint"); pts = adjustPoints(pts, width, height); float[] fractions = (float[]) invokeMethod(p,"getFractions"); Color[] colors = (Color[]) invokeMethod(p,"getColors"); Constructor<?> con = p.getClass().getDeclaredConstructor( Point2D.class, Point2D.class, new float[0].getClass(), new Color[0].getClass()); return (Paint) con.newInstance(pts[0],pts[1],fractions, colors); } catch (Exception ex) { ex.printStackTrace(); } return p; }
private static Paint resizeLinearGradient(Paint p, int width, int height) { try { Point2D[] pts = new Point2D[2]; pts[0] = (Point2D) invokeMethod(p,"getStartPoint"); pts[1] = (Point2D) invokeMethod(p,"getEndPoint"); pts = adjustPoints(pts, width, height); float[] fractions = (float[]) invokeMethod(p,"getFractions"); Color[] colors = (Color[]) invokeMethod(p,"getColors"); Constructor<?> con = p.getClass().getDeclaredConstructor( Point2D.class, Point2D.class, new float[0].getClass(), new Color[0].getClass()); return (Paint) con.newInstance(pts[0],pts[1],fractions, colors); } catch (Exception ex) { ex.printStackTrace(); } return p; }
private static Paint resizeLinearGradient(Paint p, int width, int height) { try { Point2D[] pts = new Point2D[2]; pts[0] = (Point2D) invokeMethod(p,"getStartPoint"); pts[1] = (Point2D) invokeMethod(p,"getEndPoint"); pts = adjustPoints(pts, width, height); float[] fractions = (float[]) invokeMethod(p,"getFractions"); Color[] colors = (Color[]) invokeMethod(p,"getColors"); Constructor<?> con = p.getClass().getDeclaredConstructor( Point2D.class, Point2D.class, new float[0].getClass(), new Color[0].getClass()); return (Paint) con.newInstance(pts[0],pts[1],fractions, colors); } catch (Exception ex) { ex.printStackTrace(); } return p; }
private static Paint resizeLinearGradient(Paint p, int width, int height) { try { Point2D[] pts = new Point2D[2]; pts[0] = (Point2D) invokeMethod(p,"getStartPoint"); pts[1] = (Point2D) invokeMethod(p,"getEndPoint"); pts = adjustPoints(pts, width, height); float[] fractions = (float[]) invokeMethod(p,"getFractions"); Color[] colors = (Color[]) invokeMethod(p,"getColors"); Constructor<?> con = p.getClass().getDeclaredConstructor( Point2D.class, Point2D.class, new float[0].getClass(), new Color[0].getClass()); return (Paint) con.newInstance(pts[0],pts[1],fractions, colors); } catch (Exception ex) { ex.printStackTrace(); } return p; }
pts[0] = gp.getPoint1(); pts[1] = gp.getPoint2(); pts = adjustPoints(pts, width, height); return new GradientPaint(pts[0], gp.getColor1(), pts[1], gp.getColor2(), gp.isCyclic());
pts[0] = gp.getPoint1(); pts[1] = gp.getPoint2(); pts = adjustPoints(pts, width, height); return new GradientPaint(pts[0], gp.getColor1(), pts[1], gp.getColor2(), gp.isCyclic());
pts[0] = gp.getPoint1(); pts[1] = gp.getPoint2(); pts = adjustPoints(pts, width, height); return new GradientPaint(pts[0], gp.getColor1(), pts[1], gp.getColor2(), gp.isCyclic());
pts[0] = gp.getPoint1(); pts[1] = gp.getPoint2(); pts = adjustPoints(pts, width, height); return new GradientPaint(pts[0], gp.getColor1(), pts[1], gp.getColor2(), gp.isCyclic());