public static RasterColor[] GetPaintColors(
RasterImage image,
Graphics graphics
)
Public Shared Function GetPaintColors( _
ByVal image As RasterImage, _
ByVal graphics As Graphics _
) As RasterColor()
public:
static array<RasterColor>^ GetPaintColors(
RasterImage^ image,
Graphics^ graphics
)
image
The source image.
graphics
The graphics object on which this image is painted.
An array of color for the palette
For more information refer to RasterImage and GDI/GDI+.
For more information, refer to Color Halftone and Halftone Images.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
public void GetPaintColorsExample()
{
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))
{
RasterColor[] colors = RasterImagePainter.GetPaintColors(image, g);
if (colors != null)
{
Console.WriteLine("Paint colors:");
for (int i = 0; i < colors.Length; i++)
{
Console.WriteLine("{0} - {1}", i, colors[i]);
}
}
else
{
Console.WriteLine("There is no palette");
}
}
}
image.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.ImageProcessing
Public Sub GetPaintColorsExample()
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 colors() As RasterColor = RasterImagePainter.GetPaintColors(image, g)
If Not IsNothing(colors) Then
Console.WriteLine("Paint colors:")
For i As Integer = 0 To colors.Length - 1
Console.WriteLine("{0} - {1}", i, colors(i))
Next
Else
Console.WriteLine("There is no palette")
End If
End Using
End Using
image.Dispose()
codecs.Dispose()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
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.