You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/01/11 09:47:15 UTC

svn commit: r1872617 - in /pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger: PDFDebugger.java pagepane/PagePane.java ui/ImageTypeMenu.java ui/RenderDestinationMenu.java ui/ViewMenu.java

Author: tilman
Date: Sat Jan 11 09:47:14 2020
New Revision: 1872617

URL: http://svn.apache.org/viewvc?rev=1872617&view=rev
Log:
PDFBOX-4731, PDFBOX-4732: support RenderDestination and ImageType

Added:
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ImageTypeMenu.java
      - copied, changed from r1872451, pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RenderDestinationMenu.java
      - copied, changed from r1872451, pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java
Modified:
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
    pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1872617&r1=1872616&r2=1872617&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java Sat Jan 11 09:47:14 2020
@@ -94,6 +94,7 @@ import org.apache.pdfbox.debugger.ui.Doc
 import org.apache.pdfbox.debugger.ui.ErrorDialog;
 import org.apache.pdfbox.debugger.ui.ExtensionFileFilter;
 import org.apache.pdfbox.debugger.ui.FileOpenSaveDialog;
+import org.apache.pdfbox.debugger.ui.ImageTypeMenu;
 import org.apache.pdfbox.debugger.ui.LogDialog;
 import org.apache.pdfbox.debugger.ui.MapEntry;
 import org.apache.pdfbox.debugger.ui.OSXAdapter;
@@ -102,6 +103,7 @@ import org.apache.pdfbox.debugger.ui.PDF
 import org.apache.pdfbox.debugger.ui.PageEntry;
 import org.apache.pdfbox.debugger.ui.ReaderBottomPanel;
 import org.apache.pdfbox.debugger.ui.RecentFiles;
+import org.apache.pdfbox.debugger.ui.RenderDestinationMenu;
 import org.apache.pdfbox.debugger.ui.RotationMenu;
 import org.apache.pdfbox.debugger.ui.TextDialog;
 import org.apache.pdfbox.debugger.ui.Tree;
@@ -1309,6 +1311,8 @@ public class PDFDebugger extends JFrame
             DocumentEntry documentEntry = new DocumentEntry(document, file.getName());
             ZoomMenu.getInstance().resetZoom();
             RotationMenu.getInstance().setRotationSelection(RotationMenu.ROTATE_0_DEGREES);
+            ImageTypeMenu.getInstance().setImageTypeSelection(ImageTypeMenu.IMAGETYPE_RGB);
+            RenderDestinationMenu.getInstance().setRenderDestinationSelection(RenderDestinationMenu.RENDER_DESTINATION_EXPORT);
             tree.setModel(new PDFTreeModel(documentEntry));
             // Root/Pages/Kids/[0] is not always the first page, so use the first row instead:
             tree.setSelectionPath(tree.getPathForRow(1));

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java?rev=1872617&r1=1872616&r2=1872617&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java Sat Jan 11 09:47:14 2020
@@ -57,6 +57,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.debugger.ui.HighResolutionImageIcon;
+import org.apache.pdfbox.debugger.ui.ImageTypeMenu;
+import org.apache.pdfbox.debugger.ui.RenderDestinationMenu;
 import org.apache.pdfbox.debugger.ui.TextDialog;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.interactive.action.PDAction;
@@ -70,6 +72,8 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination;
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.pdmodel.interactive.form.PDField;
+import org.apache.pdfbox.rendering.ImageType;
+import org.apache.pdfbox.rendering.RenderDestination;
 import org.apache.pdfbox.text.PDFTextStripper;
 
 /**
@@ -89,11 +93,15 @@ public class PagePane implements ActionL
     private JLabel label;
     private ZoomMenu zoomMenu;
     private RotationMenu rotationMenu;
+    private ImageTypeMenu imageTypeMenu;
+    private RenderDestinationMenu renderDestinationMenu;
     private ViewMenu viewMenu;
     private String labelText = "";
     private final Map<PDRectangle,String> rectMap = new HashMap<>();
     private final AffineTransform defaultTransform = GraphicsEnvironment.getLocalGraphicsEnvironment().
                         getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform();
+    // more ideas:
+    // https://stackoverflow.com/questions/16440159/dragging-of-shapes-on-jpanel
 
     public PagePane(PDDocument document, COSDictionary pageDict, JLabel statuslabel)
     {
@@ -236,9 +244,10 @@ public class PagePane implements ActionL
     public void actionPerformed(ActionEvent actionEvent)
     {
         String actionCommand = actionEvent.getActionCommand();
-        
         if (ZoomMenu.isZoomMenu(actionCommand) ||
             RotationMenu.isRotationMenu(actionCommand) ||
+            ImageTypeMenu.isImageTypeMenu(actionCommand) ||
+            RenderDestinationMenu.isRenderDestinationMenu(actionCommand) ||
             ViewMenu.isRenderingOptions(actionCommand))
         {
             startRendering();
@@ -279,7 +288,9 @@ public class PagePane implements ActionL
                 ViewMenu.isShowTextStripperBeads(),
                 ViewMenu.isShowFontBBox(),
                 ViewMenu.isShowGlyphBounds(),
-                ViewMenu.isAllowSubsampling()
+                ViewMenu.isAllowSubsampling(),
+                ImageTypeMenu.getImageType(),
+                RenderDestinationMenu.getRenderDestination()
         ).execute();
         zoomMenu.setPageZoomScale(ZoomMenu.getZoomScale());
     }
@@ -293,7 +304,15 @@ public class PagePane implements ActionL
         rotationMenu = RotationMenu.getInstance();
         rotationMenu.addMenuListeners(this);
         rotationMenu.setEnableMenu(true);
-        
+
+        imageTypeMenu = ImageTypeMenu.getInstance();
+        imageTypeMenu.addMenuListeners(this);
+        imageTypeMenu.setEnableMenu(true);
+
+        renderDestinationMenu = RenderDestinationMenu.getInstance();
+        renderDestinationMenu.addMenuListeners(this);
+        renderDestinationMenu.setEnableMenu(true);
+
         viewMenu = ViewMenu.getInstance(null);
 
         JMenu menuInstance = viewMenu.getMenu();
@@ -316,7 +335,9 @@ public class PagePane implements ActionL
         boolean isFirstEntrySkipped = false;
         zoomMenu.setEnableMenu(false);
         rotationMenu.setEnableMenu(false);
-        
+        imageTypeMenu.setEnableMenu(false);
+        renderDestinationMenu.setEnableMenu(false);
+
         JMenu menuInstance = viewMenu.getMenu();
         int itemCount = menuInstance.getItemCount();
         
@@ -445,10 +466,13 @@ public class PagePane implements ActionL
         private final boolean showFontBBox;
         private final boolean showGlyphBounds;
         private final boolean allowSubsampling;
+        private final ImageType imageType;
+        private final RenderDestination renderDestination;
 
         private RenderWorker(float scale, int rotation, boolean showTextStripper,
                              boolean showTextStripperBeads, boolean showFontBBox,
-                             boolean showGlyphBounds, boolean allowSubsampling)
+                             boolean showGlyphBounds, boolean allowSubsampling,
+                             ImageType imageType, RenderDestination renderDestination)
         {
             this.scale = scale;
             this.rotation = rotation;
@@ -457,6 +481,8 @@ public class PagePane implements ActionL
             this.showFontBBox = showFontBBox;
             this.showGlyphBounds = showGlyphBounds;
             this.allowSubsampling = allowSubsampling;
+            this.imageType = imageType;
+            this.renderDestination = renderDestination;
         }
 
         @Override
@@ -471,7 +497,7 @@ public class PagePane implements ActionL
             renderer.setSubsamplingAllowed(allowSubsampling);
 
             long t0 = System.nanoTime();
-            BufferedImage image = renderer.renderImage(pageIndex, scale);
+            BufferedImage image = renderer.renderImage(pageIndex, scale, imageType, renderDestination);
             long t1 = System.nanoTime();
 
             long ms = TimeUnit.MILLISECONDS.convert(t1 - t0, TimeUnit.NANOSECONDS);

Copied: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ImageTypeMenu.java (from r1872451, pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ImageTypeMenu.java?p2=pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ImageTypeMenu.java&p1=pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java&r1=1872451&r2=1872617&rev=1872617&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ImageTypeMenu.java Sat Jan 11 09:47:14 2020
@@ -21,69 +21,70 @@ import javax.swing.ButtonGroup;
 import javax.swing.JMenu;
 import javax.swing.JRadioButtonMenuItem;
 
+import org.apache.pdfbox.rendering.ImageType;
+
 /**
- * @author Khyrul Bashar
  * @author Tilman Hausherr
  *
- * A singleton class that provides rotation menu which can be used to show rotation menu in the menubar.
- * To act upon the menu item selection user of the class must add ActionListener which will check for
- * the action command and act accordingly.
+ * A singleton class that provides the imagetype menu for the menubar. To act upon the menu item
+ * selection, the user of the class must add ActionListener which will check for the action command
+ * and act accordingly.
  */
-public final class RotationMenu extends MenuBase
+public final class ImageTypeMenu extends MenuBase
 {
-    public static final String ROTATE_0_DEGREES = "0°";
-    public static final String ROTATE_90_DEGREES = "90°";
-    public static final String ROTATE_180_DEGREES = "180°";
-    public static final String ROTATE_270_DEGREES = "270°";
+    public static final String IMAGETYPE_RGB = "RGB";
+    public static final String IMAGETYPE_ARGB = "ARGB";
+    public static final String IMAGETYPE_GRAY = "Gray";
+    public static final String IMAGETYPE_BITONAL = "Bitonal";
     
-    private static RotationMenu instance;
-    private JRadioButtonMenuItem rotate0Item;
-    private JRadioButtonMenuItem rotate90Item;
-    private JRadioButtonMenuItem rotate180Item;
-    private JRadioButtonMenuItem rotate270Item;
+    private static ImageTypeMenu instance;
+    private JRadioButtonMenuItem rgbItem;
+    private JRadioButtonMenuItem argbItem;
+    private JRadioButtonMenuItem grayItem;
+    private JRadioButtonMenuItem bitonalItem;
 
     /**
      * Constructor.
      */
-    private RotationMenu()
+    private ImageTypeMenu()
     {
-        setMenu(createRotationMenu());
+        setMenu(createMenu());
     }
   
     /**
-     * Provides the RotationMenu instance.
-     * @return RotationMenu instance.
+     * Provides the ImageTypeMenu instance.
+     * @return ImageTypeMenu instance.
      */
-    public static RotationMenu getInstance()
+    public static ImageTypeMenu getInstance()
     {
         if (instance == null)
         {
-            instance = new RotationMenu();
+            instance = new ImageTypeMenu();
         }
         return instance;
     }
 
     /**
-     * Set the rotation selection.
+     * Set the image type selection.
      * @param selection String instance.
      */
-    public void setRotationSelection(String selection)
+    public void setImageTypeSelection(String selection)
     {
-        if (ROTATE_0_DEGREES.equals(selection))
+        if (IMAGETYPE_RGB.equals(selection))
         {
-            rotate0Item.setSelected(true);
+            rgbItem.setSelected(true);
         }
-        else if (ROTATE_90_DEGREES.equals(selection))
+        else if (IMAGETYPE_ARGB.equals(selection))
         {
-            rotate90Item.setSelected(true);
+            argbItem.setSelected(true);
         }
-        else if (ROTATE_180_DEGREES.equals(selection))
+        else if (IMAGETYPE_GRAY.equals(selection))
         {
-            rotate180Item.setSelected(true);
+            grayItem.setSelected(true);
         }
-        else if (ROTATE_270_DEGREES.equals(selection))
+        else if (IMAGETYPE_BITONAL.equals(selection))
         {
-            rotate270Item.setSelected(true);
+            bitonalItem.setSelected(true);
         }
         else
         {
@@ -91,46 +92,46 @@ public final class RotationMenu extends
         }
     }
 
-    public static boolean isRotationMenu(String actionCommand)
+    public static boolean isImageTypeMenu(String actionCommand)
     {
-        return ROTATE_0_DEGREES.equals(actionCommand) || ROTATE_90_DEGREES.equals(actionCommand) ||
-                ROTATE_180_DEGREES.equals(actionCommand) || ROTATE_270_DEGREES.equals(actionCommand);
+        return IMAGETYPE_RGB.equals(actionCommand) || IMAGETYPE_ARGB.equals(actionCommand) ||
+                IMAGETYPE_GRAY.equals(actionCommand) || IMAGETYPE_BITONAL.equals(actionCommand);
     }
     
-    public static int getRotationDegrees()
+    public static ImageType getImageType()
     {
-        if (instance.rotate90Item.isSelected())
+        if (instance.argbItem.isSelected())
         {
-            return 90;
+            return ImageType.ARGB;
         }
-        if (instance.rotate180Item.isSelected())
+        if (instance.grayItem.isSelected())
         {
-            return 180;
+            return ImageType.GRAY;
         }
-        if (instance.rotate270Item.isSelected())
+        if (instance.bitonalItem.isSelected())
         {
-            return 270;
+            return ImageType.BINARY;
         }
-        return 0;
+        return ImageType.RGB;
     }
 
-    public static int getRotationDegrees(String actionCommand)
+    public static ImageType getImageType(String actionCommand)
     {
-        if (ROTATE_0_DEGREES.equals(actionCommand))
+        if (IMAGETYPE_RGB.equals(actionCommand))
         {
-            return 0;
+            return ImageType.RGB;
         }
-        else if (ROTATE_90_DEGREES.equals(actionCommand))
+        else if (IMAGETYPE_ARGB.equals(actionCommand))
         {
-            return 90;
+            return ImageType.ARGB;
         }
-        else if (ROTATE_180_DEGREES.equals(actionCommand))
+        else if (IMAGETYPE_GRAY.equals(actionCommand))
         {
-            return 180;
+            return ImageType.GRAY;
         }
-        else if (ROTATE_270_DEGREES.equals(actionCommand))
+        else if (IMAGETYPE_BITONAL.equals(actionCommand))
         {
-            return 270;
+            return ImageType.BINARY;
         }
         else
         {
@@ -138,32 +139,32 @@ public final class RotationMenu extends
         }
     }
 
-    private JMenu createRotationMenu()
+    private JMenu createMenu()
     {
         JMenu menu = new JMenu();
-        menu.setText("Rotation");
+        menu.setText("Image type");
 
-        rotate0Item = new JRadioButtonMenuItem();
-        rotate90Item = new JRadioButtonMenuItem();
-        rotate180Item = new JRadioButtonMenuItem();
-        rotate270Item = new JRadioButtonMenuItem();
-        rotate0Item.setSelected(true);
+        rgbItem = new JRadioButtonMenuItem();
+        argbItem = new JRadioButtonMenuItem();
+        grayItem = new JRadioButtonMenuItem();
+        bitonalItem = new JRadioButtonMenuItem();
+        rgbItem.setSelected(true);
 
         ButtonGroup bg = new ButtonGroup();
-        bg.add(rotate0Item);
-        bg.add(rotate90Item);
-        bg.add(rotate180Item);
-        bg.add(rotate270Item);
-
-        rotate0Item.setText(ROTATE_0_DEGREES);
-        rotate90Item.setText(ROTATE_90_DEGREES);
-        rotate180Item.setText(ROTATE_180_DEGREES);
-        rotate270Item.setText(ROTATE_270_DEGREES);
+        bg.add(rgbItem);
+        bg.add(argbItem);
+        bg.add(grayItem);
+        bg.add(bitonalItem);
+
+        rgbItem.setText(IMAGETYPE_RGB);
+        argbItem.setText(IMAGETYPE_ARGB);
+        grayItem.setText(IMAGETYPE_GRAY);
+        bitonalItem.setText(IMAGETYPE_BITONAL);
         
-        menu.add(rotate0Item);
-        menu.add(rotate90Item);
-        menu.add(rotate180Item);
-        menu.add(rotate270Item);
+        menu.add(rgbItem);
+        menu.add(argbItem);
+        menu.add(grayItem);
+        menu.add(bitonalItem);
 
         return menu;
     }

Copied: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RenderDestinationMenu.java (from r1872451, pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RenderDestinationMenu.java?p2=pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RenderDestinationMenu.java&p1=pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java&r1=1872451&r2=1872617&rev=1872617&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RotationMenu.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RenderDestinationMenu.java Sat Jan 11 09:47:14 2020
@@ -21,69 +21,64 @@ import javax.swing.ButtonGroup;
 import javax.swing.JMenu;
 import javax.swing.JRadioButtonMenuItem;
 
+import org.apache.pdfbox.rendering.RenderDestination;
+
 /**
- * @author Khyrul Bashar
  * @author Tilman Hausherr
  *
- * A singleton class that provides rotation menu which can be used to show rotation menu in the menubar.
- * To act upon the menu item selection user of the class must add ActionListener which will check for
- * the action command and act accordingly.
+ * A singleton class that provides the RenderDestination menu for the menubar. To act upon the menu
+ * item selection, the user of the class must add ActionListener which will check for the action
+ * command and act accordingly.
  */
-public final class RotationMenu extends MenuBase
+public final class RenderDestinationMenu extends MenuBase
 {
-    public static final String ROTATE_0_DEGREES = "0°";
-    public static final String ROTATE_90_DEGREES = "90°";
-    public static final String ROTATE_180_DEGREES = "180°";
-    public static final String ROTATE_270_DEGREES = "270°";
+    public static final String RENDER_DESTINATION_EXPORT = "Export";
+    public static final String RENDER_DESTINATION_PRINT = "Print";
+    public static final String RENDER_DESTINATION_VIEW = "View";
     
-    private static RotationMenu instance;
-    private JRadioButtonMenuItem rotate0Item;
-    private JRadioButtonMenuItem rotate90Item;
-    private JRadioButtonMenuItem rotate180Item;
-    private JRadioButtonMenuItem rotate270Item;
+    private static RenderDestinationMenu instance;
+    private JRadioButtonMenuItem exportItem;
+    private JRadioButtonMenuItem printItem;
+    private JRadioButtonMenuItem viewItem;
 
     /**
      * Constructor.
      */
-    private RotationMenu()
+    private RenderDestinationMenu()
     {
-        setMenu(createRotationMenu());
+        setMenu(createMenu());
     }
   
     /**
-     * Provides the RotationMenu instance.
-     * @return RotationMenu instance.
+     * Provides the RenderDestination instance.
+     * @return RenderDestination instance.
      */
-    public static RotationMenu getInstance()
+    public static RenderDestinationMenu getInstance()
     {
         if (instance == null)
         {
-            instance = new RotationMenu();
+            instance = new RenderDestinationMenu();
         }
         return instance;
     }
 
     /**
-     * Set the rotation selection.
+     * Set the render destination selection.
      * @param selection String instance.
      */
-    public void setRotationSelection(String selection)
+    public void setRenderDestinationSelection(String selection)
     {
-        if (ROTATE_0_DEGREES.equals(selection))
-        {
-            rotate0Item.setSelected(true);
-        }
-        else if (ROTATE_90_DEGREES.equals(selection))
+        if (RENDER_DESTINATION_EXPORT.equals(selection))
         {
-            rotate90Item.setSelected(true);
+            exportItem.setSelected(true);
         }
-        else if (ROTATE_180_DEGREES.equals(selection))
+        else if (RENDER_DESTINATION_PRINT.equals(selection))
         {
-            rotate180Item.setSelected(true);
+            printItem.setSelected(true);
         }
-        else if (ROTATE_270_DEGREES.equals(selection))
+        else if (RENDER_DESTINATION_VIEW.equals(selection))
         {
-            rotate270Item.setSelected(true);
+            viewItem.setSelected(true);
         }
         else
         {
@@ -91,46 +86,38 @@ public final class RotationMenu extends
         }
     }
 
-    public static boolean isRotationMenu(String actionCommand)
+    public static boolean isRenderDestinationMenu(String actionCommand)
     {
-        return ROTATE_0_DEGREES.equals(actionCommand) || ROTATE_90_DEGREES.equals(actionCommand) ||
-                ROTATE_180_DEGREES.equals(actionCommand) || ROTATE_270_DEGREES.equals(actionCommand);
+        return RENDER_DESTINATION_EXPORT.equals(actionCommand) || RENDER_DESTINATION_PRINT.equals(actionCommand) ||
+                RENDER_DESTINATION_VIEW.equals(actionCommand);
     }
     
-    public static int getRotationDegrees()
+    public static RenderDestination getRenderDestination()
     {
-        if (instance.rotate90Item.isSelected())
+        if (instance.printItem.isSelected())
         {
-            return 90;
+            return RenderDestination.PRINT;
         }
-        if (instance.rotate180Item.isSelected())
+        if (instance.viewItem.isSelected())
         {
-            return 180;
+            return RenderDestination.VIEW;
         }
-        if (instance.rotate270Item.isSelected())
-        {
-            return 270;
-        }
-        return 0;
+        return RenderDestination.EXPORT;
     }
 
-    public static int getRotationDegrees(String actionCommand)
+    public static RenderDestination getRenderDestination(String actionCommand)
     {
-        if (ROTATE_0_DEGREES.equals(actionCommand))
-        {
-            return 0;
-        }
-        else if (ROTATE_90_DEGREES.equals(actionCommand))
+        if (RENDER_DESTINATION_EXPORT.equals(actionCommand))
         {
-            return 90;
+            return RenderDestination.EXPORT;
         }
-        else if (ROTATE_180_DEGREES.equals(actionCommand))
+        else if (RENDER_DESTINATION_PRINT.equals(actionCommand))
         {
-            return 180;
+            return RenderDestination.PRINT;
         }
-        else if (ROTATE_270_DEGREES.equals(actionCommand))
+        else if (RENDER_DESTINATION_VIEW.equals(actionCommand))
         {
-            return 270;
+            return RenderDestination.VIEW;
         }
         else
         {
@@ -138,32 +125,28 @@ public final class RotationMenu extends
         }
     }
 
-    private JMenu createRotationMenu()
+    private JMenu createMenu()
     {
         JMenu menu = new JMenu();
-        menu.setText("Rotation");
+        menu.setText("Render destination");
 
-        rotate0Item = new JRadioButtonMenuItem();
-        rotate90Item = new JRadioButtonMenuItem();
-        rotate180Item = new JRadioButtonMenuItem();
-        rotate270Item = new JRadioButtonMenuItem();
-        rotate0Item.setSelected(true);
+        exportItem = new JRadioButtonMenuItem();
+        printItem = new JRadioButtonMenuItem();
+        viewItem = new JRadioButtonMenuItem();
+        exportItem.setSelected(true);
 
         ButtonGroup bg = new ButtonGroup();
-        bg.add(rotate0Item);
-        bg.add(rotate90Item);
-        bg.add(rotate180Item);
-        bg.add(rotate270Item);
-
-        rotate0Item.setText(ROTATE_0_DEGREES);
-        rotate90Item.setText(ROTATE_90_DEGREES);
-        rotate180Item.setText(ROTATE_180_DEGREES);
-        rotate270Item.setText(ROTATE_270_DEGREES);
+        bg.add(exportItem);
+        bg.add(printItem);
+        bg.add(viewItem);
+
+        exportItem.setText(RENDER_DESTINATION_EXPORT);
+        printItem.setText(RENDER_DESTINATION_PRINT);
+        viewItem.setText(RENDER_DESTINATION_VIEW);
         
-        menu.add(rotate0Item);
-        menu.add(rotate90Item);
-        menu.add(rotate180Item);
-        menu.add(rotate270Item);
+        menu.add(exportItem);
+        menu.add(printItem);
+        menu.add(viewItem);
 
         return menu;
     }

Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java?rev=1872617&r1=1872616&r2=1872617&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java Sat Jan 11 09:47:14 2020
@@ -186,6 +186,14 @@ public class ViewMenu extends MenuBase
         rotationMenu.setEnableMenu(false);
         viewMenu.add(rotationMenu.getMenu());
 
+        ImageTypeMenu imageTypeMenu = ImageTypeMenu.getInstance();
+        imageTypeMenu.setEnableMenu(false);
+        viewMenu.add(imageTypeMenu.getMenu());
+
+        RenderDestinationMenu renderDestinationMenu = RenderDestinationMenu.getInstance();
+        renderDestinationMenu.setEnableMenu(false);
+        viewMenu.add(renderDestinationMenu.getMenu());
+
         viewMenu.addSeparator();
 
         showTextStripper = new JCheckBoxMenuItem(SHOW_TEXT_STRIPPER);