Пример #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Bpp">Bits per pixel</param>
 /// <param name="Image">Image to print</param>
 /// <param name="YTop">Y position for the image</param>
 /// <param name="Copies">Number of copies of the image to be printed</param>
 /// <param name="RepeatMode">Repeat images seamlessly (zero gap) or on demand (individual product detects)</param>
 /// <param name="JobID">Meteor job ID</param>
 public PreLoadPrintJob(int Bpp, IMeteorImageData Image, int YTop, int Copies, REPEAT_MODE RepeatMode, int JobID)
 {
     this.bpp        = Bpp;
     this.image      = Image;
     this.ytop       = YTop;
     this.copies     = Copies;
     this.repeatmode = RepeatMode;
     this.jobid      = JobID;
 }
Пример #2
0
        /// <summary>
        /// Load the data for a new print image
        /// </summary>
        private void LoadImage()
        {
            // Attempt to avoid memory allocation problems with large images by
            // cleaning up the currently loading image.  For very large images
            // the 64 bit build of the application should be used.
            if (image != null)
            {
                pictureBoxPrintData.Image = null;
                image.Dispose();
                image = null;
                pictureBoxPrintData.Refresh();
            }
            GC.Collect();
            // Load the new image
            Cursor.Current = Cursors.WaitCursor;
            string FileName = openFileDialogLoadImage.FileName;

            image = ImageDataFactory.Create(FileName);

            if (image != null)
            {
                pictureBoxPrintData.Image           = image.GetPreviewBitmap();
                Cursor.Current                      = Cursors.Default;
                toolStripStatusFilename.Text        = image.GetBaseName();
                toolStripStatusFilename.ToolTipText = FileName;
                toolStripStatusImageDimensions.Text = string.Format("{0} x {1} pixels", image.GetDocWidth(), image.GetDocHeight());
            }
            else
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Failed to load image " + openFileDialogLoadImage.FileName,
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                openFileDialogLoadImage.FileName    = "";
                toolStripStatusFilename.Text        = "No image loaded";
                toolStripStatusFilename.ToolTipText = "";
                toolStripStatusImageDimensions.Text = "";
            }
            EnableControls();
        }
Пример #3
0
        public static IMeteorImageData Create(string FileName)
        {
            IMeteorImageData image = null;
            int ExtensionIndex     = FileName.LastIndexOf('.');

            if (ExtensionIndex != -1)
            {
                string FileExt = FileName.Substring(ExtensionIndex + 1).ToLower();
                switch (FileExt)
                {
                case "bmp":
                case "jpg":
                case "tif":
                    image = new MeteorBitmapImage();
                    break;

                default:
                    break;
                }
            }
            if (image != null)
            {
                if (image.Load(FileName))
                {
                    return(image);
                }
            }
            else
            {
                MessageBox.Show("Unrecognised file type " + FileName,
                                Application.ProductName,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            return(null);
        }