Returns a GDI+ palette corresponding to this Leadtools.RasterImage if painted on the given graphic object.
public static ColorPalette GetPaintPalette(Leadtools.RasterImage image,Graphics graphics)
Public Shared Function GetPaintPalette( _ByVal image As Leadtools.RasterImage, _ByVal graphics As Graphics _) As ColorPalette
public:static ColorPalette^ GetPaintPalette(Leadtools.RasterImage^ image,Graphics^ graphics)
image
The source image.
graphics
The graphics object on which this Leadtools.RasterImage is painted.
a GDI+ palette
For more information refer to RasterImage and GDI/GDI+.
For more information, refer to Handling Palette Changes.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingImports Leadtools.ImageProcessing<TestMethod()> _Public Sub GetPaintPaletteExample()Dim codecs As New RasterCodecs()Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 8, CodecsLoadByteOrder.Rgb, 1, 1)Using btmp As New Bitmap(1, 1)Using g As Graphics = Graphics.FromImage(btmp)Dim palette As ColorPalette = RasterImagePainter.GetPaintPalette(image, g)If Not IsNothing(palette) ThenConsole.WriteLine("Paint palette colors:")For i As Integer = 0 To palette.Entries.Length - 1Console.WriteLine("{0} - {1}", i, palette.Entries(i))NextElseConsole.WriteLine("There is no palette")End IfEnd UsingEnd Usingimage.Dispose()codecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.ImageProcessing;public void GetPaintPaletteExample(){RasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 8, CodecsLoadByteOrder.Rgb, 1, 1);using(Bitmap btmp = new Bitmap(1, 1)){using(Graphics g = Graphics.FromImage(btmp)){ColorPalette palette = RasterImagePainter.GetPaintPalette(image, g);if(palette != null){Console.WriteLine("Paint palette colors:");for(int i = 0; i < palette.Entries.Length; i++){Console.WriteLine("{0} - {1}", i, palette.Entries[i]);}}else{Console.WriteLine("There is no palette");}}}image.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: GetPaintPalette Method - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.