예제 #1
0
파일: Image.cs 프로젝트: Jackjet/ECOSingle
        public Image(PDF pdf, JPGImage jpg)
        {
            this.w    = (float)jpg.GetWidth();
            this.h    = (float)jpg.GetHeight();
            this.size = jpg.GetFileSize();
            Stream inputStream = jpg.GetInputStream();

            if (jpg.GetColorComponents() == 1)
            {
                this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceGray", 8);
            }
            else
            {
                if (jpg.GetColorComponents() == 3)
                {
                    this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceRGB", 8);
                }
                else
                {
                    if (jpg.GetColorComponents() == 4)
                    {
                        this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceCMYK", 8);
                    }
                }
            }
            inputStream.Dispose();
        }
예제 #2
0
        /**
         *  Use of this constructor will result in reduced memory consumption and faster processing, however it currently only supports JPG images.
         *  Please see Example_24
         */
        public Image(PDF pdf, JPGImage jpg)
        {
            this.w    = jpg.GetWidth();
            this.h    = jpg.GetHeight();
            this.size = jpg.GetFileSize();
            Stream stream = jpg.GetInputStream();

            if (jpg.GetColorComponents() == 1)
            {
                AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceGray", 8);
            }
            else if (jpg.GetColorComponents() == 3)
            {
                AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceRGB", 8);
            }
            else if (jpg.GetColorComponents() == 4)
            {
                AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceCMYK", 8);
            }
            stream.Dispose();
        }