Changeset 562


Ignore:
Timestamp:
12/03/13 09:48:42 (11 years ago)
Author:
jts21
Message:

Add alpha value support for Nathaniel's web page importing (but as mentioned in commit #558, large items with alpha values cause some serious lag when redrawing)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/Conversion.java

    r476 r562  
    9090
    9191        private static Color getRGBColor(String colorCode, Color current) {
    92                 int color[] = new int[3];
     92                int color[] = new int[4];
    9393                // Assert.assertTrue(color.length == 3);
    9494
     
    102102                        String g = values.length > 1 ? values[1] : "0";
    103103                        String b = values.length > 2 ? values[2] : "0";
     104                        String a = values.length > 3 ? values[3] : "100";
    104105
    105106                        int red = (current == null ? 0 : toColorPercent(current.getRed()));
    106                         int green = (current == null ? 0 : toColorPercent(current
    107                                         .getGreen()));
     107                        int green = (current == null ? 0 : toColorPercent(current.getGreen()));
    108108                        int blue = (current == null ? 0 : toColorPercent(current.getBlue()));
     109                        int alpha = (current == null ? 0 : toColorPercent(current.getAlpha()));
     110                       
    109111                        color[0] = (Integer) Convert(int.class, r, red);
    110112                        color[1] = (Integer) Convert(int.class, g, green);
    111113                        color[2] = (Integer) Convert(int.class, b, blue);
     114                        color[3] = (Integer) Convert(int.class, a, alpha);
    112115
    113116                        for (int i = 0; i < color.length; i++) {
    114117                                color[i] = toRGB(color[i]);
    115118                        }
    116                         return new Color(color[0], color[1], color[2]);
     119                        return new Color(color[0], color[1], color[2], color[3]);
    117120                } catch (Exception e) {
    118121                        return null;
     
    161164                int g = (int) Math.round((color.getGreen() / RGB_CONVERSION_FACTOR));
    162165                int b = (int) Math.round((color.getBlue() / RGB_CONVERSION_FACTOR));
    163 
    164                 return r + " " + g + " " + b;
     166                int a = (int) Math.round((color.getAlpha() / RGB_CONVERSION_FACTOR));
     167
     168                return r + " " + g + " " + b + " " + a;
    165169        }
    166170
Note: See TracChangeset for help on using the changeset viewer.