Java Graphics Draw drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2)

Here you can find the source of drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2)

Description

draw Light Beam Vertical

License

BSD License

Declaration

public static void drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2) 

Method Source Code

//package com.java2s;
/***/*from  ww  w  .j  a v  a2  s .  co m*/
 * Copyright (C) 2010 Johan Henriksson
 * This code is under the Endrov / BSD license. See www.endrov.net
 * for the full text and how to cite.
 */

import java.awt.Color;
import java.awt.Graphics;

public class Main {
    private static final int beamR = 6;

    public static void drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2) {
        float[] carr = new float[3];
        c.getRGBColorComponents(carr);
        for (int i = -beamR; i < beamR; i++) {
            float weight = fmin1((beamR - Math.abs(i)) / (double) beamR);
            g.setColor(new Color(carr[0], carr[1], carr[2], weight));
            g.drawLine(midx + i, y1, midx + i, y2);
        }
    }

    private static float fmin1(double x) {
        return Math.max(Math.min(0.9f, (float) x), 0f);
    }
}

Related

  1. drawGroove(Graphics g, int x, int y, int width, int height, Color shadow, Color highlight)
  2. drawHandles(final Graphics g, final int[] x, final int[] y)
  3. drawIcon(Graphics g, String icon, int x, int y)
  4. drawInnerButtonDecoration(Graphics g, int x, int y, int w, int h, Color baseColor)
  5. drawISPip(Graphics2D g2d, float width, float height)
  6. drawLoweredBezel(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight)
  7. drawMarker(Graphics2D g, int markerWidth, int markerHeight, Point location)
  8. drawMask(Graphics2D g2, Shape mask)
  9. drawMovingRect(int x, int y, int width, int height, Graphics g, int seed)