public void createMarkerData(LayoutContext c) { if (getMarkerData() != null) { return; } StrutMetrics strutMetrics = InlineBoxing.createDefaultStrutMetrics(c, this); boolean imageMarker = false; MarkerData result = new MarkerData(); result.setStructMetrics(strutMetrics); CalculatedStyle style = getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); String image = style.getStringProperty(CSSName.LIST_STYLE_IMAGE); if (! image.equals("none")) { result.setImageMarker(makeImageMarker(c, strutMetrics, image)); imageMarker = result.getImageMarker() != null; } if (listStyle != IdentValue.NONE && ! imageMarker) { if (listStyle == IdentValue.CIRCLE || listStyle == IdentValue.SQUARE || listStyle == IdentValue.DISC) { result.setGlyphMarker(makeGlyphMarker(strutMetrics)); } else { result.setTextMarker(makeTextMarker(c, listStyle)); } } setMarkerData(result); }
private static void drawImage(RenderingContext c, BlockBox box, MarkerData markerData) { FSImage img = null; MarkerData.ImageMarker marker = markerData.getImageMarker(); img = marker.getImage(); if (img != null) { StrutMetrics strutMetrics = box.getMarkerData().getStructMetrics(); int x = getReferenceX(c, box); // FIXME: findbugs possible loss of precision, cf. int / (float)2 x += -marker.getLayoutWidth() + (marker.getLayoutWidth() / 2 - img.getWidth() / 2); c.getOutputDevice().drawImage(img, x, (int)(getReferenceBaseline(c, box) - strutMetrics.getAscent() / 2 - img.getHeight() / 2)); } }
private static void drawImage(RenderingContext c, BlockBox box, MarkerData markerData) { FSImage img = null; MarkerData.ImageMarker marker = markerData.getImageMarker(); img = marker.getImage(); if (img != null) { StrutMetrics strutMetrics = box.getMarkerData().getStructMetrics(); int x = getReferenceX(c, box); x += -marker.getLayoutWidth() + (marker.getLayoutWidth() / 2 - img.getWidth() / 2); c.getOutputDevice().drawImage(img, x, (int)(getReferenceBaseline(c, box) - strutMetrics.getAscent() / 2 - img.getHeight() / 2)); } }
public void createMarkerData(LayoutContext c) { if (getMarkerData() != null) { return; } StrutMetrics strutMetrics = InlineBoxing.createDefaultStrutMetrics(c, this); boolean imageMarker = false; MarkerData result = new MarkerData(); result.setStructMetrics(strutMetrics); CalculatedStyle style = getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); String image = style.getStringProperty(CSSName.LIST_STYLE_IMAGE); if (! image.equals("none")) { result.setImageMarker(makeImageMarker(c, strutMetrics, image)); imageMarker = result.getImageMarker() != null; } if (listStyle != IdentValue.NONE && ! imageMarker) { if (listStyle == IdentValue.CIRCLE || listStyle == IdentValue.SQUARE || listStyle == IdentValue.DISC) { result.setGlyphMarker(makeGlyphMarker(strutMetrics)); } else { result.setTextMarker(makeTextMarker(c, listStyle)); } } setMarkerData(result); }
public static void paint(RenderingContext c, BlockBox box) { if (box.getMarkerData() == null) { return; } MarkerData markerData = box.getMarkerData(); if (markerData.getImageMarker() != null) { drawImage(c, box, markerData); } else { CalculatedStyle style = box.getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); c.getOutputDevice().setColor(style.getColor()); if (markerData.getGlyphMarker() != null) { drawGlyph(c, box, style, listStyle); } else if (markerData.getTextMarker() != null){ drawText(c, box, listStyle); } } }
public static void paint(RenderingContext c, BlockBox box) { if (box.getMarkerData() == null) { return; } MarkerData markerData = box.getMarkerData(); if (markerData.getImageMarker() != null) { drawImage(c, box, markerData); } else { CalculatedStyle style = box.getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); c.getOutputDevice().setColor(style.getColor()); if (markerData.getGlyphMarker() != null) { drawGlyph(c, box, style, listStyle); } else if (markerData.getTextMarker() != null){ drawText(c, box, listStyle); } } }