private void ApplyProps( ) { if (_btnApply.Enabled) { _categorizedProps = GetProps(); _paintProperties = _categorizedProps.ToPaintProperties(); if (Apply != null) { Apply(this, EventArgs.Empty); } } }
private void InitViewer() { // Use ScaleToGray and Bicubic for optimum viewing of black/white and color images RasterPaintProperties props = _rasterImageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.Bicubic; if (!RasterSupport.IsLocked(RasterSupportType.Document)) { props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; } _rasterImageViewer.PaintProperties = props; // Pad the viewer _rasterImageViewer.Padding = new Padding(10); // Set the cursors _noneInteractiveMode = new ImageViewerNoneInteractiveMode(); _panInteractiveMode = new ImageViewerPanZoomInteractiveMode(); _panInteractiveMode.MouseButtons = System.Windows.Forms.MouseButtons.Left; _zoomToInteractiveMode = new ImageViewerZoomToInteractiveMode(); _zoomToInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(_rasterImageViewer_InteractiveZoomTo); _rectInteractiveMode = new ImageViewerRubberBandInteractiveMode(); _regionInteractiveMode = new ImageViewerAddRegionInteractiveMode(); _regionInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(_rasterImageViewer_InteractiveRegionRectangle); _regionInteractiveMode.RubberBandStarted += new EventHandler <ImageViewerRubberBandEventArgs>(RegionInteractiveMode_RubberBandStarted); _rectInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(RectInteractiveMode_RubberBandCompleted); _noneInteractiveMode.IdleCursor = Cursors.Arrow; _noneInteractiveMode.WorkingCursor = Cursors.Arrow; _panInteractiveMode.IdleCursor = Cursors.Hand; _panInteractiveMode.WorkingCursor = Cursors.Hand; _zoomToInteractiveMode.IdleCursor = Cursors.Cross; _zoomToInteractiveMode.WorkingCursor = Cursors.Cross; _rectInteractiveMode.IdleCursor = Cursors.Cross; _rectInteractiveMode.WorkingCursor = Cursors.Cross; _regionInteractiveMode.IdleCursor = Cursors.Cross; _regionInteractiveMode.WorkingCursor = Cursors.Cross; _rasterImageViewer.InteractiveModes.BeginUpdate(); _rasterImageViewer.InteractiveModes.Add(_noneInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_panInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_zoomToInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_rectInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_regionInteractiveMode); _rasterImageViewer.InteractiveModes.EndUpdate(); }
protected override void OnLoad(EventArgs e) { if (!DesignMode) { // Use ScaleToGray and Bicubic for optimum viewing of black/white and color images RasterPaintProperties props = _rasterImageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Bicubic; _rasterImageViewer.PaintProperties = props; // Pad the viewer _rasterImageViewer.ViewMargin = new Padding(10); _rasterImageViewer.ViewBorderThickness = 1; _automationInteractiveMode = new AutomationInteractiveMode(); _noneInteractiveMode = new ImageViewerNoneInteractiveMode(); _panInteractiveMode = new ImageViewerPanZoomInteractiveMode(); _panInteractiveMode.MouseButtons = System.Windows.Forms.MouseButtons.Left; _panInteractiveMode.IdleCursor = Cursors.Hand; _panInteractiveMode.WorkingCursor = Cursors.Hand; _zoomToInteractiveMode = new ImageViewerZoomToInteractiveMode(); _zoomToInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(_rasterImageViewer_InteractiveZoomTo); _rasterImageViewer.InteractiveModes.BeginUpdate(); _rasterImageViewer.InteractiveModes.Add(_noneInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_automationInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_panInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_zoomToInteractiveMode); _rasterImageViewer.InteractiveModes.EndUpdate(); DisableInteractiveModes(); _rasterImageViewer.InteractiveModes.EnableById(_automationInteractiveMode.Id); // These events are needed and not visible from the designer, so // hook into them here _zoomToolStripComboBox.LostFocus += new EventHandler(_zoomToolStripComboBox_LostFocus); _pageToolStripTextBox.LostFocus += new EventHandler(_pageToolStripTextBox_LostFocus); // Call the transform changed event _rasterImageViewer_TransformChanged(_rasterImageViewer, EventArgs.Empty); FitPage(false); _mousePositionLabel.Text = string.Empty; // Initialize the annotation objects InitAnnotations(); } base.OnLoad(e); }
private void InitViewer() { /*set the properties to control the display of * the image on the rasterImageViewer control*/ _viewer = new ImageViewer(); RasterPaintProperties props = new RasterPaintProperties(); props = _viewer.PaintProperties; props.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Resample; _viewer.PaintProperties = props; _viewer.Dock = DockStyle.Fill; this.Controls.Add(_viewer); _viewer.BringToFront(); }
private void InitClass( ) { Messager.Caption = "LEADTOOLS for .NET C# Animation Demo"; Text = Messager.Caption; _codecs = new RasterCodecs(); _codecs.Options.Txt.Load.Enabled = false; _fillColor = Leadtools.Demos.Converters.FromGdiPlusColor(Color.White); _paintProperties = RasterPaintProperties.Default; _paintProperties.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; _animateRegions = false; UpdateControls(); }
private void InitializeViewer(ImageViewer viewer) { // Appearance viewer.BackColor = SystemColors.AppWorkspace; viewer.Dock = DockStyle.Fill; // Set Scale-to-Gray RasterPaintProperties properties = RasterPaintProperties.Default; properties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic | RasterPaintDisplayModeFlags.ScaleToGray; properties.PaintEngine = RasterPaintEngine.GdiPlus; properties.UsePaintPalette = true; viewer.PaintProperties = properties; }
private void InitClass() { Messager.Caption = "LEADTOOLS for .NET C# Interactive Histogram Demo"; Text = Messager.Caption; _codecs = new RasterCodecs(); _codecs.Options.Txt.Load.Enabled = false; _paintProperties = RasterPaintProperties.Default; _paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; _paintProperties.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; ShowHelpFile(); UpdateControls(); }
public MatchHistogramDialog(RasterImage image, RasterPaintProperties paintProperties, Form[] ViewerForms) { try { InitializeComponent(); if (image != null) { for (int i = 0; i < ViewerForms.Length; i++) { if ((image.BitsPerPixel == 24 && (((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 24) || ((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 8) || (image.BitsPerPixel == 8 && ((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 8)) { _images.Add(((ViewerForm)ViewerForms[i]).Image); _cmbREFImage.Items.Add(System.IO.Path.GetFileName(ViewerForms[i].Text)); } } _imageIndex = 0; _REFImage = _images[_imageIndex]; CloneCommand clone = new CloneCommand(); clone.Run(image); _originalImage = image; _DSTImage = clone.DestinationImage; _DSTViewer = new ImagePreviewCtrl(_DSTImage, paintProperties, _lblDST.Location, _lblDST.Size); _REFViewer = new ImagePreviewCtrl(_REFImage, paintProperties, _lblREF.Location, _lblREF.Size); Controls.Add(_DSTViewer); Controls.Add(_REFViewer); _DSTViewer.BringToFront(); _REFViewer.BringToFront(); _DSTViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage); _REFViewer.PanImage += new EventHandler <PanImageEvent>(_afterViewer_PanImage); _cmbREFImage.SelectedIndex = 0; } else { _tsZoomLevel.Visible = false; } } catch (Exception ex) { throw ex; } }
public void Initialize(RasterPaintProperties paintProperties, RasterImage image, string fileName) { InitClass(); Text = fileName; _viewer.Image = image; UpdatePaintProperties(paintProperties); AnnAutomation automation = new AnnAutomation(MainForm.AutomationManager, _automationControl); // Update the container size automation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_viewer.Image.ImageWidth, _viewer.Image.ImageHeight)); automation.Container.Children.CollectionChanged += new EventHandler <AnnNotifyCollectionChangedEventArgs>(Children_CollectionChanged); automation.Container.Mapper.FontRelativeToDevice = false; automation.DeserializeObjectError += new EventHandler <AnnSerializeObjectEventArgs>(automation_DeserializeObjectError); MainForm.UpdateControls(); }
public void Initialize(ImageInformation info, RasterPaintProperties paintProperties, bool snap) { _viewer.BeginUpdate(); UpdatePaintProperties(paintProperties); _viewer.Image = info.Image; _tempImage = _viewer.Image.CloneAll(); if (_viewer.Image != null) { _viewer.Image.Changed += new EventHandler <RasterImageChangedEventArgs>(Image_Changed); } _name = info.Name; if (snap) { Snap(); } UpdateCaption(); _viewer.EndUpdate(); }
public BalanceColorsDialog(RasterImage image, RasterPaintProperties paintProperties) { try { InitializeComponent(); if (image != null) { CloneCommand clone = new CloneCommand(); clone.Run(image); _originalImage = image; _afterImage = clone.DestinationImage; _beforeViewer = new ImagePreviewCtrl(_originalImage, paintProperties, _lblBefore.Location, _lblBefore.Size); _afterViewer = new ImagePreviewCtrl(_afterImage, paintProperties, _lblAfter.Location, _lblAfter.Size); Controls.Add(_beforeViewer); Controls.Add(_afterViewer); _beforeViewer.BringToFront(); _afterViewer.BringToFront(); _beforeViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage); _afterViewer.PanImage += new EventHandler <PanImageEvent>(_afterViewer_PanImage); } else { _tsZoomLevel.Visible = false; } _redWeights = new BalanceColorCommandFactor(); _greenWeights = new BalanceColorCommandFactor(); _blueWeights = new BalanceColorCommandFactor(); _internalRedWeights = new BalanceColorCommandFactor(); _internalGreenWeights = new BalanceColorCommandFactor(); _internalBlueWeights = new BalanceColorCommandFactor(); } catch (Exception ex) { throw ex; } }
public void Initialize(ImageInformation info, RasterPaintProperties paintProperties, bool animateRegions, bool snap, bool useDpi) { _viewer.BeginUpdate(); UpdateAnimateRegions(animateRegions); UpdatePaintProperties(paintProperties); _viewer.Image = info.Image; _viewer.UseDpi = useDpi; if (_viewer.Image != null) { _viewer.Image.Changed += new EventHandler <RasterImageChangedEventArgs>(Image_Changed); } _name = info.Name; if (snap) { Snap(); } UpdateCaption(); _viewer.EndUpdate(); }
public FrmShowPhotoLocation() { RasterSupport.SetLicense( File.ReadAllBytes(Path.Combine(_rootPath, @"Common\License\leadtools.lic")), File.ReadAllText(Path.Combine(_rootPath, @"Common\License\leadtools.lic.key"))); InitializeComponent(); webBrowser1.ScriptErrorsSuppressed = true; webBrowser1.ScrollBarsEnabled = true; RasterPaintProperties paintProperties = RasterPaintProperties.Default; paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; paintProperties.UsePaintPalette = true; rasterPictureBox1.PaintProperties = paintProperties; rasterPictureBox1.SizeMode = RasterPictureBoxSizeMode.Fit; }
private void RecognitionResult_Load(object sender, EventArgs e) { SetupAnnotations(); RasterPaintProperties properties = RasterPaintProperties.Default; properties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic | RasterPaintDisplayModeFlags.ScaleToGray; properties.PaintEngine = RasterPaintEngine.Gdi; properties.UsePaintPalette = true; _fieldViewer.PaintProperties = properties; _fieldViewer.UseDpi = false; DisableInteactiveMode(false); _fieldViewer.InteractiveModes.EnableById(_panInteractiveMode.Id); _filledFormViewer.PaintProperties = properties; _filledFormViewer.UseDpi = false; DisableInteactiveMode(true); _filledFormViewer.InteractiveModes.EnableById(_panInteractiveMode.Id); _cmbSelectedForm.SelectedIndex = 0; UpdateControls(); }
private void LoadPages(TifImage tifImage) { if (tifImage == null) { return; } RasterPaintProperties paintProp = imageList.PaintProperties; paintProp.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray; image = tifImage.ImageData; imageList.Items.Clear(); for (var i = 1; i <= image.PageCount; ++i) { RasterImageListItem imageItem = new RasterImageListItem(image, i, "Page " + i); imageList.Items.Add(imageItem); } LoadCheckBox(image.PageCount); }
private void InitClass( ) { Messager.Caption = "LEADTOOLS for .NET C# ABC Demo"; Text = Messager.Caption; _codecs = new RasterCodecs(); _paintProperties = RasterPaintProperties.Default; _paintProperties.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; _paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; _showSave = false; _viewerOpened = false; _quality = "(Lossless)"; setCheckWindow(_miWindowCascade); LoadImage(true); UpdateControls(); }
public void Initialize(ImageInformation info, RasterPaintProperties paintProperties, bool animateRegions, bool snap, bool useDpi, RasterPictureBoxAnimationMode animationMode) { _viewer.BeginUpdate(); UpdatePaintProperties(paintProperties); _viewer.Image = info.Image; _viewer.UseDpi = useDpi; _viewer.AnimationMode = animationMode; if (_viewer.Image != null) { _viewer.Image.Changed += new EventHandler <RasterImageChangedEventArgs>(Image_Changed); } if (Image.Width > this.Viewer.Size.Width || Image.Height > this.Viewer.Size.Height) { this.Viewer.SizeMode = RasterPictureBoxSizeMode.Fit; } _name = info.Name; UpdateCaption(); _viewer.EndUpdate(); }
public void Initialize(ImageInformation info, RasterPaintProperties paintProperties, bool snap, bool isFile) { _viewer.BeginUpdate(); UpdatePaintProperties(paintProperties); FillImageList(info.Image); if (_viewer.Image != null) { _viewer.Image.Changed += new EventHandler <RasterImageChangedEventArgs>(Image_Changed); } _name = info.Name; if (snap) { Snap(); } if (isFile) { LoadSaveAnimationStruct(); } UpdateCaption(); _viewer.EndUpdate(); }
public GammaAdjustmentDialog(RasterImage image, RasterPaintProperties paintProperties) { try { InitializeComponent(); if (image != null) { CloneCommand clone = new CloneCommand(); clone.Run(image); _originalImage = image; _afterImage = clone.DestinationImage; _beforeViewer = new ImagePreviewCtrl(_originalImage, paintProperties, _lblBefore.Location, _lblBefore.Size); _afterViewer = new ImagePreviewCtrl(_afterImage, paintProperties, _lblAfter.Location, _lblAfter.Size); Controls.Add(_beforeViewer); Controls.Add(_afterViewer); _beforeViewer.BringToFront(); _afterViewer.BringToFront(); _beforeViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage); _afterViewer.PanImage += new EventHandler <PanImageEvent>(_afterViewer_PanImage); } else { _tsZoomLevel.Visible = false; } _internalGammaValue = 10; _gamma = 10; } catch (Exception ex) { throw ex; } }
public PagesControl() { InitializeComponent(); // Use GDI+ paint RasterPaintProperties props = _rasterImageList.PaintProperties; props.PaintEngine = RasterPaintEngine.GdiPlus; _rasterImageList.PaintProperties = props; _thumbnailsToolStripButton.Checked = true; _bookmarksToolStripButton.Checked = false; _signaturesToolStripButton.Checked = false; // This object generates the thumbnails for the pages in a separate thread _generateThumbnailsWorker = new Workers.GenerateThumbnailsWorker(); _generateThumbnailsWorker.PrePageProcessed += new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PrePageProcessed); _generateThumbnailsWorker.PostPageProcessed += new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PostPageProcessed); _generateThumbnailsWorker.ProcessFinished += new EventHandler <EventArgs>(_generateThumbnailsWorker_ProcessFinished); UpdateUIState(); }
private void MainForm_Load(object sender, System.EventArgs e) { // setup our caption Messager.Caption = "LEADTOOLS for .NET C# MagnifyGlass Demo"; Text = Messager.Caption; // initialize the _viewer object _viewer = new ImageViewer(); // Add the MagnifyGlass InteractiveMode _viewer.InteractiveModes.Add(magGlass); RasterPaintProperties paintProperties = RasterPaintProperties.Default; paintProperties.PaintDisplayMode |= RasterPaintDisplayModeFlags.Bicubic | RasterPaintDisplayModeFlags.ScaleToGray; paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; _viewer.PaintProperties = paintProperties; _viewer.Dock = DockStyle.Fill; _viewer.BackColor = Color.DarkGray; Controls.Add(_viewer); _viewer.BringToFront(); // initialize the codecs object _codecs = new RasterCodecs(); // initialize the other variables _borderColor = Color.Red; _borderWidth = 2; _crosshair = ImageViewerSpyGlassCrosshair.Fine; _crosshairColor = Color.Green; _crosshairWidth = 1; _roundRectangleEllipseSize = new LeadSize(20, 20); _scaleFactor = 2; _shape = ImageViewerSpyGlassShape.Rectangle; _size = new LeadSize(150, 150); UpdateMyControls(); }
public MainForm() { InitializeComponent(); // Setup the caption for this demo Messager.Caption = "C# OCR Edit Demo"; // Initialize the RasterCodecs object _rasterCodecs = new RasterCodecs(); // Use the new RasterizeDocumentOptions to default loading document files at 300 DPI _rasterCodecs.Options.RasterizeDocument.Load.XResolution = 300; _rasterCodecs.Options.RasterizeDocument.Load.YResolution = 300; _rasterCodecs.Options.Pdf.Load.EnableInterpolate = true; _rasterCodecs.Options.Load.AutoFixImageResolution = true; if (!DesignMode) { // Use ScaleToGray and Bicubic for optimum viewing of black/white and color images RasterPaintProperties props = _imageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Bicubic; _imageViewer.PaintProperties = props; // Pad the viewer _imageViewer.ViewPadding = new Padding(10); _imageViewer.Zoom(ControlSizeMode.Fit, 1, _imageViewer.DefaultZoomOrigin); // These events are needed and not visible from the designer, so // hook into them here _zoomToolStripComboBox.LostFocus += new EventHandler(_zoomToolStripComboBox_LostFocus); // Call the transform changed event _imageViewer_TransformChanged(_imageViewer, EventArgs.Empty); _mousePositionLabel.Text = string.Empty; } }
public MainForm() { InitializeComponent(); Messager.Caption = "C# OCR Modules Demo"; Text = Messager.Caption; _codecs = new RasterCodecs(); // Use the new RasterizeDocumentOptions to default loading document files at 300 DPI _codecs.Options.RasterizeDocument.Load.XResolution = 300; _codecs.Options.RasterizeDocument.Load.YResolution = 300; _codecs.Options.Pdf.Load.EnableInterpolate = true; _codecs.Options.Load.AutoFixImageResolution = true; // Create and initialize the raster image viewer _viewer = new ImageViewer(); _viewer.Dock = DockStyle.Fill; _viewer.BackColor = SystemColors.AppWorkspace; _viewer.Padding = new Padding(10); _viewer.ViewBorderThickness = 2; _viewer.ViewHorizontalAlignment = ControlAlignment.Center; _viewer.ViewVerticalAlignment = ControlAlignment.Center; _viewer.UseDpi = true; _viewer.Zoom(ControlSizeMode.Fit, (float)(200 / 100.0), _viewer.DefaultZoomOrigin); RasterPaintProperties props = RasterPaintProperties.Default; props.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray; props.PaintEngine = RasterPaintEngine.Gdi; _viewer.PaintProperties = props; _splitContainer.Panel2.Controls.Add(_viewer); _viewer.BringToFront(); _viewer.PostRender += new EventHandler <ImageViewerRenderEventArgs>(_viewer_PostRender); InitInteractiveModes(); }
public ViewerControl() { InitializeComponent(); InitViewer(); InitInteractiveModes(); // Use ScaleToGray paint RasterPaintProperties props = _imageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Resample; _imageViewer.PaintProperties = props; // Pad the viewer _imageViewer.ViewPadding = new Padding(10); _zoomToSelectionToolStripButton.PerformClick(); // These events are needed and not visible from the designer, so // hook into them here _zoomToolStripComboBox.LostFocus += new EventHandler(_zoomToolStripComboBox_LostFocus); _pageToolStripTextBox.LostFocus += new EventHandler(_pageToolStripTextBox_LostFocus); }
protected override void OnLoad(EventArgs e) { try { if (!DesignMode) { // Use ScaleToGray for optimum viewing RasterPaintProperties props = _rasterImageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; _rasterImageViewer.PaintProperties = props; // Pad the viewer Padding padding = _rasterImageViewer.Padding; padding.All = 10; _rasterImageViewer.Padding = padding; // These events are needed and not visible from the designer, so // hook into them here _pageToolStripTextBox.LostFocus += new EventHandler(_pageToolStripTextBox_LostFocus); // Call the transform changed event _rasterImageViewer_TransformChanged(_rasterImageViewer, EventArgs.Empty); _mousePositionLabel.Text = string.Empty; // Initialize the annotation objects InitAnnotations(); } base.OnLoad(e); } catch (Leadtools.RasterException ex) { Messager.ShowError(this, ex); } }
///---------------------------------------------------------------- /// <summary> /// 伝票画像表示 </summary> /// <param name="iX"> /// 現在の伝票</param> /// <param name="tempImgName"> /// 画像名</param> ///---------------------------------------------------------------- public void ShowImage(string tempImgName) { //string wrkFileName; //修正画面へ組み入れた画像フォームの表示 //画像の出力が無い場合は、画像表示をしない。 if (tempImgName == string.Empty) { leadImg.Visible = false; //global.pblImageFile = string.Empty; return; } //画像ファイルがあるときのみ表示 //wrkFileName = tempImgName; if (System.IO.File.Exists(tempImgName)) { leadImg.Visible = true; //画像ロード RasterCodecs.Startup(); RasterCodecs cs = new RasterCodecs(); // 描画時に使用される速度、品質、およびスタイルを制御します。 RasterPaintProperties prop = new RasterPaintProperties(); prop = RasterPaintProperties.Default; prop.PaintDisplayMode = RasterPaintDisplayModeFlags.Resample; leadImg.PaintProperties = prop; leadImg.Image = cs.Load(tempImgName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1); //画像表示倍率設定 if (gl.miMdlZoomRate == 0f) { if (leadImg.ImageDpiX == 200) { leadImg.ScaleFactor *= gl.ZOOM_RATE; // 200*200 画像のとき } else { leadImg.ScaleFactor *= gl.ZOOM_RATE; // 300*300 画像のとき } } else { leadImg.ScaleFactor *= gl.miMdlZoomRate; } //画像のマウスによる移動を可能とする leadImg.InteractiveMode = RasterViewerInteractiveMode.Pan; ////右へ90°回転させる //RotateCommand rc = new RotateCommand(); //rc.Angle = 90 * 100; //rc.FillColor = new RasterColor(255, 255, 255); ////rc.Flags = RotateCommandFlags.Bicubic; //rc.Flags = RotateCommandFlags.Resize; //rc.Run(leadImg.Image); // グレースケールに変換 GrayscaleCommand grayScaleCommand = new GrayscaleCommand(); grayScaleCommand.BitsPerPixel = 8; grayScaleCommand.Run(leadImg.Image); leadImg.Refresh(); cs.Dispose(); RasterCodecs.Shutdown(); //global.pblImageFile = wrkFileName; // 画像操作ボタン btnPlus.Enabled = true; btnMinus.Enabled = true; } else { //画像ファイルがないとき leadImg.Visible = false; //global.pblImageFile = string.Empty; // 画像操作ボタン btnPlus.Enabled = false; btnMinus.Enabled = false; } }
public CategorizedPaintProperties(RasterPaintProperties props) { PaintEngine = props.PaintEngine; RasterOperation = props.RasterOperation; if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.DitheredPaint) == RasterPaintDisplayModeFlags.DitheredPaint) { if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.OrderedDither) == RasterPaintDisplayModeFlags.OrderedDither) { Dithering = CategorizedDithering.Ordered; } else { Dithering = CategorizedDithering.ErrorDiffusion; } } else { Dithering = CategorizedDithering.None; } if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.FavorBlack) == RasterPaintDisplayModeFlags.FavorBlack) { BitonalScaling = CategorizedBitonalScaling.FavorBlack; } else if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.ScaleToGray) == RasterPaintDisplayModeFlags.ScaleToGray) { BitonalScaling = CategorizedBitonalScaling.ScaleToGray; } else { BitonalScaling = CategorizedBitonalScaling.None; } if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.Resample) == RasterPaintDisplayModeFlags.Resample) { PaintScaling = CategorizedPaintScaling.Resample; } else if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.Bicubic) == RasterPaintDisplayModeFlags.Bicubic) { PaintScaling = CategorizedPaintScaling.Bicubic; } else { PaintScaling = CategorizedPaintScaling.None; } if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.FixedPalette) == RasterPaintDisplayModeFlags.FixedPalette) { if ((props.PaintDisplayMode & RasterPaintDisplayModeFlags.NetscapePalette) == RasterPaintDisplayModeFlags.NetscapePalette) { Palette = CategorizedPalette.Netscape; } else { Palette = CategorizedPalette.Fixed; } } else { Palette = CategorizedPalette.Auto; } UsePaintPalette = props.UsePaintPalette; IndexedPaint = (props.PaintDisplayMode & RasterPaintDisplayModeFlags.IndexedPaint) == RasterPaintDisplayModeFlags.IndexedPaint; FastPaint = (props.PaintDisplayMode & RasterPaintDisplayModeFlags.FastPaint) == RasterPaintDisplayModeFlags.FastPaint; HalftonePrint = (props.PaintDisplayMode & RasterPaintDisplayModeFlags.HalftonePrint) == RasterPaintDisplayModeFlags.HalftonePrint; }
public void Initialize(ImageInformation info, RasterPaintProperties paintProperties, bool snap) { _viewer.BeginUpdate(); UpdatePaintProperties(paintProperties); _viewer.Image = info.Image; if (_viewer.Image != null) { _viewer.Image.Changed += new EventHandler <RasterImageChangedEventArgs>(Image_Changed); } _name = info.Name; if (snap) { Snap(); } UpdateCaption(); _viewer.EndUpdate(); _isWLImage = false; _isMagGlass = false; if (_viewer.Image.GrayscaleMode != RasterGrayscaleMode.None) { switch (_viewer.Image.BitsPerPixel) { case 8: _currentPalette = _viewer.Image.GetPalette(); _LUTSize = 256; _minValue = 0; _maxValue = 255; _isWLImage = true; break; case 12: case 16: _viewer.Image.UseLookupTable = true; _currentPalette = _viewer.Image.GetLookupTable(); _highBit = _viewer.Image.HighBit; if (_highBit == -1) { _highBit = _viewer.Image.BitsPerPixel - 1; } if (_currentPalette == null) { _LUTSize = (int)Math.Pow(2, _highBit + 1); _maxValue = (_viewer.Image.Signed) ? _LUTSize / 2 - 1 : _LUTSize - 1; _minValue = (_viewer.Image.Signed) ? -_LUTSize / 2 : 0; } else { _LUTSize = _currentPalette.Length; MinMaxValuesCommand minMaxValueCmd = new MinMaxValuesCommand(); minMaxValueCmd.Run(_viewer.Image); _maxValue = minMaxValueCmd.MaximumValue; _minValue = minMaxValueCmd.MinimumValue; } _isWLImage = true; break; } _scale = ((_maxValue - _minValue) / 1000 > 0) ? (_maxValue - _minValue) / 1000 : 1; _maxWidth = (int)Math.Pow(2, _viewer.Image.BitsPerPixel) - 1; _minWidth = 1; _maxLevel = (int)Math.Pow(2, _viewer.Image.BitsPerPixel) - 1; _minLevel = (int)Math.Pow(2, _viewer.Image.BitsPerPixel) * -1 + 1; _windowLevelCenter = (_maxValue + _minValue) / 2; _windowLevelWidth = _maxValue - _minValue; if (_viewer.Image.Signed) { _flags |= RasterPaletteWindowLevelFlags.Signed; } ChangeThePalette(); } }
protected override void OnDrawItem(DrawItemEventArgs e) { if (_sampleSymbologiesRasterImage == null) { return; } if (e.Index == -1) { return; } Rectangle rc = new Rectangle(e.Bounds.X + _delta, e.Bounds.Y + _delta, e.Bounds.Width - 10, e.Bounds.Height - _delta); if (_stringFormat == null) { _stringFormat = new StringFormat(); _stringFormat.Alignment = StringAlignment.Center; _stringFormat.LineAlignment = StringAlignment.Far; } BarcodeSymbology symbology = (BarcodeSymbology)Items[e.Index]; string name = BarcodeEngine.GetSymbologyFriendlyName(symbology); _sampleSymbologiesRasterImage.Page = (int)symbology; if (_itemPen == null) { _itemPen = new Pen(Brushes.Black, 2); } e.Graphics.DrawRectangle(_itemPen, rc); e.Graphics.FillRectangle(Brushes.White, rc); RasterPaintProperties paintProperties = RasterPaintProperties.Default; if (RasterSupport.IsLocked(RasterSupportType.Document)) { paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; } else { paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray; } LeadRect imageRect = new LeadRect(rc.X + 2, rc.Y + 2, rc.Width - 4, rc.Height * 2 / 3); imageRect = RasterImage.CalculatePaintModeRectangle( _sampleSymbologiesRasterImage.ImageWidth, _sampleSymbologiesRasterImage.ImageHeight, imageRect, RasterPaintSizeMode.FitAlways, RasterPaintAlignMode.CenterAlways, RasterPaintAlignMode.CenterAlways); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.FillRectangle(SystemBrushes.Highlight, rc); RasterImagePainter.Paint(_sampleSymbologiesRasterImage, e.Graphics, imageRect, paintProperties); e.Graphics.DrawRectangle(Pens.Black, imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height); e.Graphics.DrawString(name, Font, SystemBrushes.HighlightText, rc, _stringFormat); } else { e.Graphics.FillRectangle(SystemBrushes.Control, rc); RasterImagePainter.Paint(_sampleSymbologiesRasterImage, e.Graphics, imageRect, paintProperties); e.Graphics.DrawRectangle(Pens.Black, imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height); e.Graphics.DrawString(name, Font, SystemBrushes.ControlText, rc, _stringFormat); } }
public void UpdatePaintProperties(RasterPaintProperties paintProperties) { _viewer.PaintProperties = paintProperties; }