2

I have solid RGB colors as shown below. How can I apply a neon glow effect to plain RGB color codes below? I am new to programming 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,
        };

    }

UPDATE:

Want to achieve something like this but with a Neon glow not just neon solid color. https://play.google.com/store/apps/details?id=com.ginnko.games.neonpong

  • Not sure what you mean by "glow", try redrawing the path/shape over original with blur mask? – hypd09 Jun 04 '14 at 04:50
  • can you post a screen-shot of what you want to achieve? – SMR Jun 04 '14 at 04:58
  • Please check above post updated – user3705373 Jun 04 '14 at 07:53
  • 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! – user3705373 Jun 04 '14 at 20:34
  • Combine GradientPaint and AlphaComposite, as shown in the example cited http://stackoverflow.com/a/7425460/230513 – user3705373 Jun 04 '14 at 20:34
  • Have you found any solution for neon paint in android? – Muhammad Umair Shafique Jan 04 '16 at 07:46

0 Answers0