←Select platform

RasterPaintDisplayModeFlags Enumeration

Summary
Contains value that controls the speed, quality, and style of painting operations.
Syntax
C#
C++/CLI
Python
[FlagsAttribute()] 
public enum RasterPaintDisplayModeFlags   
[FlagsAttribute()] 
public enum class RasterPaintDisplayModeFlags   
class RasterPaintDisplayModeFlags(Enum): 
   None = 0 
   OrderedDither = 1 
   FastPaint = 2 
   IndexedPaint = 4 
   DitheredPaint = 8 
   ScaleToGray = 16 
   HalftonePrint = 32 
   FavorBlack = 64 
   FixedPalette = 128 
   NetscapePalette = 256 
   Resample = 512 
   Bicubic = 1024 
Members
ValueMemberDescription
0x00000000None Default
0x00000001OrderedDither Enables or disables ordered dithering when painting. Ordered dithering is faster than the default dithering method, which uses error diffusion, but the quality of the image is not as good.
0x00000002FastPaint Enables or disables fast painting. Fast painting should be performed only if the current video driver is good, and the image does not need to be dithered or resized to paint. No safety check for a faulty driver is performed.
0x00000004IndexedPaint Enables or disables painting that is mapped directly to the selected palette. You can this and let Windows do color matching between the paint palette and the selected palette. Indexed painting uses the colors from the currently selected palette. It is not used if the image is not palletized.
0x00000008DitheredPaint Enables or disables painting that is mapped directly to the selected palette. This is enabled by default; you can set this flag to disable it and let Windows do color matching between the paint palette and the selected palette. Indexed painting uses the colors from the currently selected palette. It is not used if the image is not palletized.
0x00000010ScaleToGray (Document/Medical only) Enables grayscaling of 1-bit images when they are displayed. This improves the readability of the images when they are zoomed in or zoomed out, but it slows down the display.
0x00000020HalftonePrint Enables use of the printing halftone (rather than the viewing halftone) when painting to a 1-bit device.
0x00000040FavorBlack (Document/Medical only) Enables a bias in preserving black objects when displaying zoomed-out 1-bit images. This can prevent the disappearance of fine lines and details, but it slows down the display.
0x00000080FixedPalette Enables the LEAD Fixed palette when displaying 24-bit (or greater) images on 8-bit (or less) devices.
0x00000100NetscapePalette Enables the Netscape Fixed palette when displaying 24-bit (or greater) images on 8-bit (or less) devices.
0x00000200Resample Enables resample resize when displaying images at zoom factors other than 1:1.
0x00000400Bicubic Enables bicubic resize when displaying images at zoom factors other than 1:1.
Remarks

This enumeration provides value for the RasterPaintProperties.PaintDisplayMode property.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
 
public void RasterPaintPropertiesExample() 
{ 
   // Create the form  
   PaintPropertiesForm f = new PaintPropertiesForm(); 
   f.ShowDialog(); 
} 
 
class PaintPropertiesForm : Form 
{ 
   private int index = 0; 
   private RasterImage rasterImage; 
   private RasterPaintProperties paintProperties; 
 
   public PaintPropertiesForm() 
   { 
      Text = "GDI paint engine - normal - Double click to show next RasterPaintProperties options"; 
      SetStyle(ControlStyles.ResizeRedraw, true); 
      SetStyle(ControlStyles.AllPaintingInWmPaint, true); 
      SetStyle(ControlStyles.OptimizedDoubleBuffer, true); 
      SetStyle(ControlStyles.UserPaint, true); 
 
      // Load an image  
      string fileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); 
 
      using (RasterCodecs codecs = new RasterCodecs()) 
      { 
         codecs.ThrowExceptionsOnInvalidImages = true; 
         rasterImage = codecs.Load(fileName); 
      } 
 
      paintProperties = RasterPaintProperties.Default; 
 
      // Start with GDI paint engine and normal paint scaling 
      paintProperties.PaintEngine = RasterPaintEngine.Gdi; 
      paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.None; 
   } 
 
   protected override void Dispose(bool disposing) 
   { 
      if (disposing) 
      { 
         if (rasterImage != null) 
            rasterImage.Dispose(); 
      } 
 
      base.Dispose(disposing); 
   } 
 
   protected override void OnDoubleClick(EventArgs e) 
   { 
      switch (index) 
      { 
         case 0: 
            Text = "GDI paint engine - SourceAnd ROP - Double click to show next RasterPaintProperties options"; 
            paintProperties.RasterOperation = RasterPaintProperties.SourceAnd; 
            break; 
 
         case 1: 
            Text = "GDI paint engine - Scale to gray - Double click to show next RasterPaintProperties options"; 
            paintProperties.RasterOperation = RasterPaintProperties.SourceCopy; 
            paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray; 
            break; 
 
         case 2: 
            Text = "GDI+ paint engine - Double click to set the opacity"; 
            paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; 
            break; 
 
         case 3: 
            Text = "GDI+ paint engine - Opacity set to 50% - Done"; 
            paintProperties.Opacity = 128; 
            break; 
 
         default: 
            break; 
      } 
 
      index++; 
      Invalidate(); 
      base.OnDoubleClick(e); 
   } 
 
   protected override void OnPaint(PaintEventArgs e) 
   { 
      // Paint the image  
      LeadRect destRect = LeadRect.FromLTRB(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Right, ClientRectangle.Bottom); 
      destRect = RasterImage.CalculatePaintModeRectangle( 
         rasterImage.ImageWidth, 
         rasterImage.ImageHeight, 
         destRect, 
         RasterPaintSizeMode.Fit, 
         RasterPaintAlignMode.Center, 
         RasterPaintAlignMode.Center); 
 
      RasterImagePainter.Paint(rasterImage, e.Graphics, destRect, paintProperties); 
 
      base.OnPaint(e); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Drawing Namespace

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Drawing Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.