/** Get the unique instance of the class. */ public static TextureFactory getInstance() { if (fac == null) fac = new TextureFactory(1.0f); return fac; }
/** get the Color corresponding with the Object (pen or brush object). */ private Color getColorFromObject(int brushObject) { Color color = null; if ( brushObject >= 0 ) { GdiObject gdiObj = getObject( brushObject ); return (Color)gdiObj.obj; } else return null; }
private synchronized void init() throws IOException { // Need the extra test, to avoid throwing an IOException from the Transcoder if (imageInput == null) { throw new IllegalStateException("input == null"); } if (reader == null) { WMFTranscoder transcoder = new WMFTranscoder(); ByteArrayOutputStream output = new ByteArrayOutputStream(); Writer writer = new OutputStreamWriter(output, "UTF8"); try { TranscoderInput in = new TranscoderInput(IIOUtil.createStreamAdapter(imageInput)); TranscoderOutput out = new TranscoderOutput(writer); // TODO: Transcodinghints? transcoder.transcode(in, out); } catch (TranscoderException e) { throw new IIOException(e.getMessage(), e); } reader = new SVGImageReader(getOriginatingProvider()); reader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(output.toByteArray()))); } }
/** 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; } }
public WMFRecordStore() { super(); reset(); }
protected int addObjectAt( WMFRecordStore store, int type, Object obj, int idx ) { return currentStore.addObjectAt( type, obj, idx ); } }
protected int addObject( WMFRecordStore store, int type, Object obj ) { return currentStore.addObject( type, obj ); }
public RecordStore(){ reset(); }
/** 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 the Color corresponding with the Object (pen or brush object). */ private Color getColorFromObject(int brushObject) { Color color = null; if ( brushObject >= 0 ) { GdiObject gdiObj = getObject( brushObject ); return (Color)gdiObj.obj; } else return null; }
public WMFRecordStore() { super(); reset(); }
protected int addObjectAt( WMFRecordStore store, int type, Object obj, int idx ) { return currentStore.addObjectAt( type, obj, idx ); } }
protected int addObject( WMFRecordStore store, int type, Object obj ) { return currentStore.addObject( type, obj ); }
private void setBrushPaint( WMFRecordStore currentStore, Graphics2D g2d, int brushObject) { if ( brushObject >= 0 ) { GdiObject gdiObj = currentStore.getObject( brushObject ); if (gdiObj.obj instanceof Color) { g2d.setColor( (Color)gdiObj.obj ); } else if (gdiObj.obj instanceof Paint) { g2d.setPaint( (Paint)gdiObj.obj ); } else { g2d.setPaint(getPaint((byte[])gdiObj.obj)); } brushObject = -1; } }
/** 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; }
private void setBrushPaint( WMFRecordStore currentStore, Graphics2D g2d, int brushObject) { if ( brushObject >= 0 ) { GdiObject gdiObj = currentStore.getObject( brushObject ); if (gdiObj.obj instanceof Color) { g2d.setColor( (Color)gdiObj.obj ); } else if (gdiObj.obj instanceof Paint) { g2d.setPaint( (Paint)gdiObj.obj ); } else { g2d.setPaint(getPaint((byte[])gdiObj.obj)); } brushObject = -1; } }
/** Get the unique instance of the class. */ public static TextureFactory getInstance() { if (fac == null) fac = new TextureFactory(1.0f); return fac; }