pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1826843 - /pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java
Date Thu, 15 Mar 2018 17:58:29 GMT
Author: tilman
Date: Thu Mar 15 17:58:29 2018
New Revision: 1826843

URL: http://svn.apache.org/viewvc?rev=1826843&view=rev
Log:
PDFBOX-2941: show icc colorspace type

Modified:
    pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java

Modified: pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java?rev=1826843&r1=1826842&r2=1826843&view=diff
==============================================================================
--- pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java
(original)
+++ pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/colorpane/CSArrayBased.java
Thu Mar 15 17:58:29 2018
@@ -19,12 +19,14 @@ package org.apache.pdfbox.debugger.color
 import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Font;
+import java.awt.color.ColorSpace;
 import java.io.IOException;
 import javax.swing.BoxLayout;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace;
+import org.apache.pdfbox.pdmodel.graphics.color.PDICCBased;
 import org.apache.pdfbox.pdmodel.graphics.color.PDPattern;
 
 /**
@@ -84,6 +86,42 @@ public class CSArrayBased
             colorCountLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 20));
             panel.add(colorCountLabel);
         }
+
+        if (colorSpace instanceof PDICCBased)
+        {
+            PDICCBased icc = (PDICCBased) colorSpace;
+            //TODO the javadoc of getColorSpaceType is incomplete?
+            int colorSpaceType = icc.getColorSpaceType();
+            String cs;
+            switch (colorSpaceType)
+            {
+                case ColorSpace.CS_LINEAR_RGB:
+                    cs = "linear RGB";
+                    break;
+                case ColorSpace.CS_CIEXYZ:
+                    cs = "CIEXYZ";
+                    break;
+                case ColorSpace.CS_GRAY:
+                    cs = "linear gray";
+                    break;
+                case ColorSpace.CS_sRGB:
+                    cs = "sRGB";
+                    break;
+                case ColorSpace.TYPE_GRAY:
+                    cs = "gray";
+                    break;
+                case ColorSpace.TYPE_CMYK:
+                    cs = "CMYK";
+                    break;
+                default:
+                    cs = "type " + colorSpaceType;
+                    break;
+            }
+            JLabel otherLabel = new JLabel("Colorspace type: " + cs);
+            otherLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+            otherLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 20));
+            panel.add(otherLabel);
+        }
     }
 
     /**



Mime
View raw message