예제 #1
0
        public static ColorSpaceDeviceRGB Create(bool indirect)
        {
            ColorSpaceDeviceRGB ergb1 = (Resources.Get(PDF.N("DeviceRGB"), typeof(ColorSpaceDeviceRGB)) as ColorSpaceDeviceRGB);

            if (indirect)
            {
                Library.CreateIndirect(ergb1.Direct);
            }
            return(ergb1);
        }
예제 #2
0
        public static XObjectImage Create(Document doc, Bitmap img, params string[] encoding)
        {
            int       num3;
            int       num4;
            int       num5;
            Color     color1;
            int       num6;
            PDFArray  array1;
            int       num7;
            int       num8;
            PDFStream stream1 = Library.CreateStream();
            PDFDict   dict1   = stream1.Dict;

            dict1["Width"]   = PDF.O(img.Width);
            dict1["Height"]  = PDF.O(img.Height);
            dict1["Subtype"] = PDF.N("Image");
            dict1["Type"]    = PDF.N("XObject");
            byte[]           numArray1 = null;
            BitArrayAccessor accessor1 = null;
            int num1 = 0;
            int num2 = 0;

            if (doc == null)
            {
                doc = Library.Resources.Doc;
            }
            XObjectImage image1 = ((XObjectImage)doc.Resources[doc.Indirects.New(stream1), typeof(XObjectImage)]);

            image1.ColorSpace = ColorSpaceDeviceRGB.Create();
            numArray1         = new byte[((3 * img.Width) * img.Height)];
            num1 = 8;
            num2 = (3 * img.Width);
            dict1["BitsPerComponent"] = PDF.O(8);
            for (num3 = 0; (num3 < img.Height); num3 += 1)
            {
                num4      = 0;
                accessor1 = new BitArrayAccessor(numArray1, ((num3 * num2) * 8), num1, false);
                for (num5 = 0; (num5 < img.Width); num5 += 1)
                {
                    color1 = img.GetPixel(num5, num3);
                    num6   = 0;
                    while ((num6 < 3))
                    {
                        num8 = num6;
                        switch (num8)
                        {
                        case 0:
                        {
                            int num9 = num4;
                            num4            = (num9 + 1);
                            accessor1[num4] = ((long)((ulong)color1.R));
                            goto Label_0180;
                        }

                        case 1:
                        {
                            int num10 = num4;
                            num4            = (num10 + 1);
                            accessor1[num4] = ((long)((ulong)color1.G));
                            goto Label_0180;
                        }

                        case 2:
                        {
                            goto Label_016B;
                        }
                        }
                        goto Label_0180;
Label_016B:
                        int num11       = num4;
                        num4            = (num11 + 1);
                        accessor1[num4] = ((long)((ulong)color1.B));
Label_0180:
                        num6 += 1;
                    }
                }
            }
            MemoryStream stream2 = new MemoryStream(numArray1);

            if (encoding.Length > 0)
            {
                array1 = Library.CreateArray(encoding.Length);
                stream1.Dict["Filter"] = array1;
                for (num7 = 0; (num7 < encoding.Length); num7 += 1)
                {
                    array1[num7] = PDF.N(encoding[num7]);
                }
            }
            stream1.Encode(stream2);
            return(image1);
        }
예제 #3
0
 public static ColorSpaceDeviceRGB Create()
 {
     return(ColorSpaceDeviceRGB.Create(false));
 }