/** * create a new PDFGraphics state, given a Graphics2D. This version * will <b>not</b> create an image, and you will get a NullPointerException * if you attempt to call getImage(). * @param page the current page * @param g the Graphics2D object to use for drawing * @param imgbounds the bounds of the image into which to fit the page * @param clip the portion of the page to draw, in page space, or null * if the whole page should be drawn * @param bgColor the color to draw the background of the image, or * null for no color (0 alpha value) */ public PDFRenderer(PDFPage page, Graphics2D g, Rectangle imgbounds, Rectangle2D clip, Color bgColor) { super(); this.page = page; this.g = g; this.imageinfo = new ImageInfo(imgbounds.width, imgbounds.height, clip, bgColor); g.translate(imgbounds.x, imgbounds.y); // System.out.println("Translating by "+imgbounds.x+","+imgbounds.y); // initialize the list of observers observers = new ArrayList<ImageObserver>(); }
/** * create a new PDFGraphics state, given a Graphics2D. This version * will <b>not</b> create an image, and you will get a NullPointerException * if you attempt to call getImage(). * @param page the current page * @param g the Graphics2D object to use for drawing * @param imgbounds the bounds of the image into which to fit the page * @param clip the portion of the page to draw, in page space, or null * if the whole page should be drawn * @param bgColor the color to draw the background of the image, or * null for no color (0 alpha value) */ public PDFRenderer(PDFPage page, Graphics2D g, Rectangle imgbounds, Rectangle2D clip, Color bgColor) { super(); this.page = page; this.g = g; this.imageinfo = new ImageInfo(imgbounds.width, imgbounds.height, clip, bgColor); g.translate(imgbounds.x, imgbounds.y); // System.out.println("Translating by "+imgbounds.x+","+imgbounds.y); // initialize the list of observers observers = new ArrayList<ImageObserver>(); }
/** * create a new PDFGraphics state, given a Graphics2D. This version * will <b>not</b> create an image, and you will get a NullPointerException * if you attempt to call getImage(). * @param page the current page * @param g the Graphics2D object to use for drawing * @param imgbounds the bounds of the image into which to fit the page * @param clip the portion of the page to draw, in page space, or null * if the whole page should be drawn * @param bgColor the color to draw the background of the image, or * null for no color (0 alpha value) */ public PDFRenderer(PDFPage page, Graphics2D g, Rectangle imgbounds, Rectangle2D clip, Color bgColor) { super(); this.page = page; this.g = g; this.imageinfo = new ImageInfo(imgbounds.width, imgbounds.height, clip, bgColor); g.translate(imgbounds.x, imgbounds.y); // System.out.println("Translating by "+imgbounds.x+","+imgbounds.y); // initialize the list of observers observers = new ArrayList<ImageObserver>(); }
/** * Stop the rendering of a particular image on this page */ public void stop(int width, int height, Rectangle2D clip) { ImageInfo info = new ImageInfo(width, height, clip); synchronized (renderers) { // find our renderer WeakReference rendererRef = renderers.get(info); if (rendererRef != null) { PDFRenderer renderer = (PDFRenderer) rendererRef.get(); if (renderer != null) { // stop it renderer.stop(); } } } }
/** * Stop the rendering of a particular image on this page */ public void stop(int width, int height, Rectangle2D clip) { ImageInfo info = new ImageInfo(width, height, clip); synchronized (renderers) { // find our renderer WeakReference rendererRef = renderers.get(info); if (rendererRef != null) { PDFRenderer renderer = (PDFRenderer) rendererRef.get(); if (renderer != null) { // stop it renderer.stop(); } } } }
/** * Stop the rendering of a particular image on this page */ public void stop(int width, int height, Rectangle2D clip) { ImageInfo info = new ImageInfo(width, height, clip); synchronized (renderers) { // find our renderer WeakReference rendererRef = renderers.get(info); if (rendererRef != null) { PDFRenderer renderer = (PDFRenderer) rendererRef.get(); if (renderer != null) { // stop it renderer.stop(); } } } }
ImageInfo info = new ImageInfo(width, height, clip, null);
ImageInfo info = new ImageInfo(width, height, clip, null);
ImageInfo info = new ImageInfo(width, height, clip, null);