-1

I have solid RGB colors as shown below. How can I apply a neon glow effect to plain RGB color codes. I am new to programme so please bare with my ignorance regarding this.

public static final class Color {
        static final float RGB_UPPER_BOUND = 255;
        static final float[] GRAY_RGB = {153/RGB_UPPER_BOUND, 60/RGB_UPPER_BOUND, 243/RGB_UPPER_BOUND};
        static final float[] WHITE_RGB = {255/RGB_UPPER_BOUND, 65/RGB_UPPER_BOUND, 5/RGB_UPPER_BOUND};
        static final float[] BLACK_RGB = {0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND};
        static final float[] RED_RGB = {255/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND};
        static final float[] BLUE_RGB = {77/RGB_UPPER_BOUND, 77/RGB_UPPER_BOUND, 255/RGB_UPPER_BOUND};
        static final float[] GREEN_RGB = {131/RGB_UPPER_BOUND, 245/RGB_UPPER_BOUND, 44/RGB_UPPER_BOUND};

        public static final float[] WHITE = {
            WHITE_RGB[0],  WHITE_RGB[1],  WHITE_RGB[2],  1.0f,  // bottom left
            WHITE_RGB[0],  WHITE_RGB[1],  WHITE_RGB[2],  1.0f,  // top left
            WHITE_RGB[0],  WHITE_RGB[1],  WHITE_RGB[2],  1.0f,  // bottom right
            WHITE_RGB[0],  WHITE_RGB[1],  WHITE_RGB[2],  1.0f,  // top right
        };

        public static final float[] GRAY = {
            GRAY_RGB[0],  GRAY_RGB[1],  GRAY_RGB[2],  1.0f,
            GRAY_RGB[0],  GRAY_RGB[1],  GRAY_RGB[2],  1.0f,
            GRAY_RGB[0],  GRAY_RGB[1],  GRAY_RGB[2],  1.0f,
            GRAY_RGB[0],  GRAY_RGB[1],  GRAY_RGB[2],  1.0f,
        };

        public static final float[] BLUE = {
            BLUE_RGB[0],  BLUE_RGB[1],  BLUE_RGB[2],  1.0f,
            BLUE_RGB[0],  BLUE_RGB[1],  BLUE_RGB[2],  1.0f,
            BLUE_RGB[0],  BLUE_RGB[1],  BLUE_RGB[2],  1.0f,
            BLUE_RGB[0],  BLUE_RGB[1],  BLUE_RGB[2],  1.0f,
        };

        public static final float[] GREEN = {
            GREEN_RGB[0],  GREEN_RGB[1],  GREEN_RGB[2],  1.0f,
            GREEN_RGB[0],  GREEN_RGB[1],  GREEN_RGB[2],  1.0f,
            GREEN_RGB[0],  GREEN_RGB[1],  GREEN_RGB[2],  1.0f,
            GREEN_RGB[0],  GREEN_RGB[1],  GREEN_RGB[2],  1.0f,
        };

    }
awksp
  • 11,764
  • 4
  • 37
  • 44
  • Combine `GradientPaint` and `AlphaComposite`, as shown in the example cited [here](http://stackoverflow.com/a/7425460/230513). – trashgod Jun 04 '14 at 02:55
  • Thank you trashgod, could you answer with a practical example on how to apply it to the above code? – user3655025 Jun 04 '14 at 02:58
  • Don't call your class `Color`. There is already a `Color` class as part of the API. – camickr Jun 04 '14 at 03:02
  • It is up to YOU to do the research, read the link provided by @trashgod, and apply the samples shown there. SO users will not hand you code that you can easily get somewhere else. – Jim Garrison Jun 04 '14 at 03:05

1 Answers1

0

If you are looking for a very simple solution, Converting to HSB (Hue Saturation Brightness) and varying the brightness over time yields a primitive glow effect. This is similar to scaling the magnitude of the RGB vector except that since the human eye is more sensitive to green light and less sensitive to blue light, blue contributes significantly less to the brightness while green contributes more!

Community
  • 1
  • 1
Sesame
  • 183
  • 1
  • 9