/** * @param g * @param s get the boundaryvalues for the shape */ public static void paintTexture(Graphics2D g, Shape s, DrawingPad pad) { Rectangle r = s.getBounds(); if (r.height <= 0 || r.width <= 0) return; /** * when the height and width of the symbol is greater than 0 then GraphicsConfiguration is set * to DeviceConnfiguration */ GraphicsConfiguration config = g.getDeviceConfiguration(); BufferedImage strip = (BufferedImage) pad.getImage(); /** creates an object gstrip for drawing horizontal and vertical strip */ Graphics2D gStrip = strip.createGraphics(); horStrip(gStrip, strip, 0, r.width, 0); gStrip.dispose(); Shape prevClip = g.getClip(); if (!r.equals(s)) { g.clip(s); } vertStrip(g, strip, r.y, r.height, r.x); g.setClip(prevClip); }