Ejemplo n.º 1
0
		public override void LoadView ()
		{
			base.LoadView ();
			UIImageView test = new UIImageView();
			Stopwatch sw = new Stopwatch();
			sw.Start ();
			CPSD psd = new CPSD("Demo1.psd");
			sw.Stop ();
			Console.WriteLine(" ========= PSD LOAD TIME: {0} =========", sw.Elapsed);
			Console.WriteLine("{0}x{1}", psd.GetWidth(), psd.GetHeight());
			Console.WriteLine("First pixels: {0};{1};{2}", psd.Buffer[0], psd.Buffer[1], psd.Buffer[2]);
			sw.Restart();
			test.Image = ImageConverter.BufferToImage(psd.Buffer, psd.GetWidth(), psd.GetHeight());
			sw.Stop ();
			Console.WriteLine(" ========= CONVERT TIME: {0} =========", sw.Elapsed);
			test.ContentMode = UIViewContentMode.TopLeft;
			View = test;
		}
Ejemplo n.º 2
0
        public override void LoadView()
        {
            base.LoadView();
            UIImageView test = new UIImageView();
            Stopwatch   sw   = new Stopwatch();

            sw.Start();
            CPSD psd = new CPSD("Demo1.psd");

            sw.Stop();
            Console.WriteLine(" ========= PSD LOAD TIME: {0} =========", sw.Elapsed);
            Console.WriteLine("{0}x{1}", psd.GetWidth(), psd.GetHeight());
            Console.WriteLine("First pixels: {0};{1};{2}", psd.Buffer[0], psd.Buffer[1], psd.Buffer[2]);
            sw.Restart();
            test.Image = ImageConverter.BufferToImage(psd.Buffer, psd.GetWidth(), psd.GetHeight());
            sw.Stop();
            Console.WriteLine(" ========= CONVERT TIME: {0} =========", sw.Elapsed);
            test.ContentMode = UIViewContentMode.TopLeft;
            View             = test;
        }
Ejemplo n.º 3
0
        public void OpenPsdFile(string FileName)
        {
            int nResult = psd.Load(FileName);

            if (nResult == 0)
            {
                int    nCompression   = psd.GetCompression();
                string strCompression = "Unknown";
                switch (nCompression)
                {
                case 0:
                    strCompression = "Raw data";
                    break;

                case 1:
                    strCompression = "RLE";
                    break;

                case 2:
                    strCompression = "ZIP without prediction";
                    break;

                case 3:
                    strCompression = "ZIP with prediction";
                    break;
                }
                label1.Text = string.Format("Image Width: {0}px\r\nImage Height: {1}px\r\n" +
                                            "Image BitsPerPixel: {2}\r\n" +
                                            "Resolution (pixels/inch): X={3} Y={4}\r\n",
                                            psd.GetWidth(),
                                            psd.GetHeight(),
                                            psd.GetBitsPerPixel(),
                                            psd.GetXResolution(),
                                            psd.GetYResolution());
                label1.Text      += "Compression: " + strCompression;
                pictureBox1.Image = System.Drawing.Image.FromHbitmap(psd.GetHBitmap());
            }
            else if (nResult == -1)
            {
                MessageBox.Show("Cannot open the File");
            }
            else if (nResult == -2)
            {
                MessageBox.Show("Invalid (or unknown) File Header");
            }
            else if (nResult == -3)
            {
                MessageBox.Show("Invalid (or unknown) ColourMode Data block");
            }
            else if (nResult == -4)
            {
                MessageBox.Show("Invalid (or unknown) Image Resource block");
            }
            else if (nResult == -5)
            {
                MessageBox.Show("Invalid (or unknown) Layer and Mask Information section");
            }
            else if (nResult == -6)
            {
                MessageBox.Show("Invalid (or unknown) Image Data block");
            }
        }