/** Get the unique instance of the class. */ public static TextureFactory getInstance() { if (fac == null) fac = new TextureFactory(1.0f); return fac; }
/** Get a texture from a WMF hatch definition (in black Color). This * texture will be cached, so the Paint will only be created once. */ public Paint getTexture(int textureId) { Integer _itexture = textureId; if (textures.containsKey( _itexture)) { Paint paint = (Paint)(textures.get(_itexture)); return paint; } else { Paint paint = createTexture(textureId, null, null); if (paint != null) textures.put(_itexture, paint); return paint; } }
/** Basic constructor. * @param scale the scale of the image * @param currentStore where the WMF records are stored * @param xOffset x value for offset * @param yOffset y value for offset */ public WMFPainter(WMFRecordStore currentStore, int xOffset, int yOffset, float scale) { setRecordStore(currentStore); TextureFactory.getInstance().reset(); this.conv = scale; this.xOffset = -xOffset; this.yOffset = -yOffset; this.scale = (float)currentStore.getWidthPixels() / currentStore.getWidthUnits() * scale; this.scale = this.scale * currentStore.getWidthPixels() / currentStore.getVpW(); float xfactor = (float)currentStore.getVpW() / currentStore.getWidthPixels() * currentStore.getWidthUnits() / currentStore.getWidthPixels(); float yfactor = (float)currentStore.getVpH() / currentStore.getHeightPixels() * currentStore.getHeightUnits() / currentStore.getHeightPixels(); this.xOffset = this.xOffset * xfactor; this.yOffset = this.yOffset * yfactor; scaleX = this.scale; scaleY = this.scale; }
Paint paint; if (! opaque) { paint = TextureFactory.getInstance().getTexture(hatch, clr); } else { paint = TextureFactory.getInstance().getTexture(hatch, clr, bkgdColor);
/** Basic constructor. * @param scale the scale of the image * @param currentStore where the WMF records are stored * @param xOffset x value for offset * @param yOffset y value for offset */ public WMFPainter(WMFRecordStore currentStore, int xOffset, int yOffset, float scale) { setRecordStore(currentStore); TextureFactory.getInstance().reset(); this.conv = scale; this.xOffset = -xOffset; this.yOffset = -yOffset; this.scale = (float)currentStore.getWidthPixels() / (float)currentStore.getWidthUnits() * scale; this.scale = this.scale * (float)currentStore.getWidthPixels() / (float)currentStore.getVpW() ; float xfactor = (float)currentStore.getVpW() / (float)currentStore.getWidthPixels() * (float)currentStore.getWidthUnits() / (float)currentStore.getWidthPixels(); float yfactor = (float)currentStore.getVpH() / (float)currentStore.getHeightPixels() * (float)currentStore.getHeightUnits() / (float)currentStore.getHeightPixels(); this.xOffset = this.xOffset * xfactor; this.yOffset = this.yOffset * yfactor; scaleX = this.scale; scaleY = this.scale; }
Paint paint; if (! opaque) { paint = TextureFactory.getInstance().getTexture(hatch, clr); } else { paint = TextureFactory.getInstance().getTexture(hatch, clr, bkgdColor);
/** Get a texture from a WMF hatch definition (in black Color). This * texture will be cached, so the Paint will only be created once. */ public Paint getTexture(int textureId) { Integer _itexture = new Integer(textureId); if (textures.containsKey( _itexture)) { Paint paint = (Paint)(textures.get(_itexture)); return paint; } else { Paint paint = createTexture(textureId, null, null); if (paint != null) textures.put(_itexture, paint); return paint; } }
/** Get the unique instance of the class. */ public static TextureFactory getInstance() { if (fac == null) fac = new TextureFactory(1.0f); return fac; }
/** Get a texture from a WMF hatch definition, with a foreground color. This * texture will be cached, so the Paint will only be created once. */ public Paint getTexture(int textureId, Color foreground) { ColoredTexture _ctexture = new ColoredTexture(textureId, foreground, null); if (textures.containsKey(_ctexture)) { Paint paint = (Paint)(textures.get(_ctexture)); return paint; } else { Paint paint = createTexture(textureId, foreground, null); if (paint != null) textures.put(_ctexture, paint); return paint; } }
/** Get the unique instance of the class, setting the scale of the pattern. * TODO : scale is not handled for now */ public static TextureFactory getInstance(float scale) { if (fac == null) fac = new TextureFactory(scale); return fac; }
/** Get a texture from a WMF hatch definition, with a foreground and a * background color. This texture will be cached, so the Paint will * only be created once. */ public Paint getTexture(int textureId, Color foreground, Color background) { ColoredTexture _ctexture = new ColoredTexture(textureId, foreground, background); if (textures.containsKey(_ctexture)) { Paint paint = (Paint)(textures.get(_ctexture)); return paint; } else { Paint paint = createTexture(textureId, foreground, background); if (paint != null) textures.put(_ctexture, paint); return paint; } }
/** Get the unique instance of the class, setting the scale of the pattern. * TODO : scale is not handled for now */ public static TextureFactory getInstance(float scale) { if (fac == null) fac = new TextureFactory(scale); return fac; }
/** Get a texture from a WMF hatch definition, with a foreground color. This * texture will be cached, so the Paint will only be created once. */ public Paint getTexture(int textureId, Color foreground) { ColoredTexture _ctexture = new ColoredTexture(textureId, foreground, null); if (textures.containsKey(_ctexture)) { Paint paint = (Paint)(textures.get(_ctexture)); return paint; } else { Paint paint = createTexture(textureId, foreground, null); if (paint != null) textures.put(_ctexture, paint); return paint; } }
/** Get a texture from a WMF hatch definition, with a foreground and a * background color. This texture will be cached, so the Paint will * only be created once. */ public Paint getTexture(int textureId, Color foreground, Color background) { ColoredTexture _ctexture = new ColoredTexture(textureId, foreground, background); if (textures.containsKey(_ctexture)) { Paint paint = (Paint)(textures.get(_ctexture)); return paint; } else { Paint paint = createTexture(textureId, foreground, background); if (paint != null) textures.put(_ctexture, paint); return paint; } }