< prev index next >

src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java

Print this page




2545                     flags |= 8;
2546                 }
2547                 else if (pos.isVerticalPositionRelativeToFontSize()) {
2548                     vPosition *= CSS.getFontSize(a, 12, ss);
2549                 }
2550             }
2551             // Determine any repeating values.
2552             CSS.Value repeats = (CSS.Value)a.getAttribute(CSS.Attribute.
2553                                                           BACKGROUND_REPEAT);
2554             if (repeats == null || repeats == CSS.Value.BACKGROUND_REPEAT) {
2555                 flags |= 3;
2556             }
2557             else if (repeats == CSS.Value.BACKGROUND_REPEAT_X) {
2558                 flags |= 1;
2559             }
2560             else if (repeats == CSS.Value.BACKGROUND_REPEAT_Y) {
2561                 flags |= 2;
2562             }
2563         }
2564 

2565         void paint(Graphics g, float x, float y, float w, float h, View v) {
2566             Rectangle clip = g.getClipRect();
2567             if (clip != null) {
2568                 // Constrain the clip so that images don't draw outside the
2569                 // legal bounds.
2570                 g.clipRect((int)x, (int)y, (int)w, (int)h);
2571             }
2572             if ((flags & 3) == 0) {
2573                 // no repeating
2574                 int width = backgroundImage.getIconWidth();
2575                 int height = backgroundImage.getIconWidth();
2576                 if ((flags & 4) == 4) {
2577                     paintX = (int)(x + w * hPosition -
2578                                   (float)width * hPosition);
2579                 }
2580                 else {
2581                     paintX = (int)x + (int)hPosition;
2582                 }
2583                 if ((flags & 8) == 8) {
2584                     paintY = (int)(y + h * vPosition -




2545                     flags |= 8;
2546                 }
2547                 else if (pos.isVerticalPositionRelativeToFontSize()) {
2548                     vPosition *= CSS.getFontSize(a, 12, ss);
2549                 }
2550             }
2551             // Determine any repeating values.
2552             CSS.Value repeats = (CSS.Value)a.getAttribute(CSS.Attribute.
2553                                                           BACKGROUND_REPEAT);
2554             if (repeats == null || repeats == CSS.Value.BACKGROUND_REPEAT) {
2555                 flags |= 3;
2556             }
2557             else if (repeats == CSS.Value.BACKGROUND_REPEAT_X) {
2558                 flags |= 1;
2559             }
2560             else if (repeats == CSS.Value.BACKGROUND_REPEAT_Y) {
2561                 flags |= 2;
2562             }
2563         }
2564 
2565         @SuppressWarnings("deprecation")
2566         void paint(Graphics g, float x, float y, float w, float h, View v) {
2567             Rectangle clip = g.getClipRect();
2568             if (clip != null) {
2569                 // Constrain the clip so that images don't draw outside the
2570                 // legal bounds.
2571                 g.clipRect((int)x, (int)y, (int)w, (int)h);
2572             }
2573             if ((flags & 3) == 0) {
2574                 // no repeating
2575                 int width = backgroundImage.getIconWidth();
2576                 int height = backgroundImage.getIconWidth();
2577                 if ((flags & 4) == 4) {
2578                     paintX = (int)(x + w * hPosition -
2579                                   (float)width * hPosition);
2580                 }
2581                 else {
2582                     paintX = (int)x + (int)hPosition;
2583                 }
2584                 if ((flags & 8) == 8) {
2585                     paintY = (int)(y + h * vPosition -


< prev index next >