/** 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; }
protected int addObject( WMFRecordStore store, int type, Object obj ) { return currentStore.addObject( type, obj ); }
protected int addObjectAt( WMFRecordStore store, int type, Object obj, int idx ) { return currentStore.addObjectAt( type, obj, idx ); } }
int numRecords = currentStore.getNumRecords(); int numObjects = currentStore.getNumObjects(); vpX = currentStore.getVpX() * scale; vpY = currentStore.getVpY() * scale; vpW = currentStore.getVpW() * scale; vpH = currentStore.getVpH() * scale; if ( !currentStore.isReading()) { GdiObject gdiObj; int gdiIndex; bkgdColor = Color.white; for ( int i = 0; i < numObjects; i++ ) { gdiObj = currentStore.getObject( i ); gdiObj.clear(); MetaRecord mr = currentStore.getRecord( iRec ); currentStore.setVpX( vpX = -(float)mr.elementAt( 0 ) ); currentStore.setVpY( vpY = -(float)mr.elementAt( 1 ) ); vpX = vpX * scale; vpY = vpY * scale; gdiObj = currentStore.getObject( gdiIndex ); if ( !gdiObj.used ) { break; gdiObj = currentStore.getObject( gdiIndex ); if ( gdiIndex == brushObject ) {
WMFRecordStore currentStore = new WMFRecordStore(); try { currentStore.read(is); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); wmfheight = ((Integer)hints.get(KEY_INPUT_HEIGHT)).intValue(); } else { wmfwidth = currentStore.getWidthPixels(); wmfheight = currentStore.getHeightPixels(); float sizeFactor = currentStore.getUnitsToPixels() * conv; int vpX = (int)(currentStore.getVpX() * sizeFactor); int vpY = (int)(currentStore.getVpY() * sizeFactor); vpW = (int)(currentStore.getWidthUnits() * sizeFactor); vpH = (int)(currentStore.getHeightUnits() * sizeFactor);
WMFRecordStore wmfStore = new WMFRecordStore(); wmfStore.read(din); IOUtils.closeQuietly(din); int width = wmfStore.getWidthUnits(); int height = wmfStore.getHeightUnits(); int dpi = wmfStore.getMetaFileUnitsPerInch();
currentStore.getMetaFileUnitsPerInch(); _scale = currentStore.getWidthPixels() * 1f/350f; // necessary to handle dash patterns
/** {@inheritDoc} */ public void paint(Graphics2D g2d, Rectangle2D area) { WMFRecordStore wmfStore = wmf.getRecordStore(); double w = area.getWidth(); double h = area.getHeight(); //Fit in paint area g2d.translate(area.getX(), area.getY()); double sx = w / wmfStore.getWidthPixels(); double sy = h / wmfStore.getHeightPixels(); if (sx != 1.0 || sy != 1.0) { g2d.scale(sx, sy); } WMFPainter painter = new WMFPainter(wmfStore, 1.0f); long start = System.currentTimeMillis(); painter.paint(g2d); if (log.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; log.debug("Painting WMF took " + duration + " ms."); } }
int numRecords = currentStore.getNumRecords(); int numObjects = currentStore.getNumObjects(); vpX = currentStore.getVpX() * scale; vpY = currentStore.getVpY() * scale; vpW = currentStore.getVpW() * scale; vpH = currentStore.getVpH() * scale; if ( !currentStore.isReading()) { GdiObject gdiObj; int gdiIndex; bkgdColor = Color.white; for ( int i = 0; i < numObjects; i++ ) { gdiObj = currentStore.getObject( i ); gdiObj.clear(); MetaRecord mr = currentStore.getRecord( iRec ); currentStore.setVpX( vpX = -mr.elementAt( 0 )); currentStore.setVpY( vpY = -mr.elementAt( 1 )); vpX = vpX * scale; vpY = vpY * scale; gdiObj = currentStore.getObject( gdiIndex ); if ( !gdiObj.used ) { break; gdiObj = currentStore.getObject( gdiIndex ); if ( gdiIndex == brushObject ) {
WMFRecordStore currentStore = new WMFRecordStore(); try { currentStore.read(is); } catch (IOException e){ handler.fatalError(new TranscoderException(e)); wmfheight = (Integer) hints.get(KEY_INPUT_HEIGHT); } else { wmfwidth = currentStore.getWidthPixels(); wmfheight = currentStore.getHeightPixels(); float sizeFactor = currentStore.getUnitsToPixels() * conv; int vpX = (int)(currentStore.getVpX() * sizeFactor); int vpY = (int)(currentStore.getVpY() * sizeFactor); vpW = (int)(currentStore.getWidthUnits() * sizeFactor); vpH = (int)(currentStore.getHeightUnits() * sizeFactor);
currentStore.getMetaFileUnitsPerInch(); _scale = currentStore.getWidthPixels() * 1f/350f; // necessary to handle dash patterns
/** 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; }
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 ); }