BitmapExtensions.GetColors Method

KGy SOFT Drawing Libraries

BitmapExtensionsGetColors Method KGy SOFT Drawing Libraries Help
Gets the colors used in the defined bitmap. A limit can be defined in maxColors.

Namespace: KGySoft.Drawing
Assembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 4.6.0
Syntax

public static Color[] GetColors(
	this Bitmap bitmap,
	int maxColors = 0
)
<ExtensionAttribute>
Public Shared Function GetColors ( 
	bitmap As Bitmap,
	Optional maxColors As Integer = 0
) As Color()
public:
[ExtensionAttribute]
static array<Color>^ GetColors(
	Bitmap^ bitmap, 
	int maxColors = 0
)
[<ExtensionAttribute>]
static member GetColors : 
        bitmap : Bitmap * 
        ?maxColors : int 
(* Defaults:
        let _maxColors = defaultArg maxColors 0
*)
-> Color[] 

Parameters

bitmap
Type: System.DrawingBitmap
The bitmap to get its colors. When it is indexed, its palette is returned and maxColors is ignored.
maxColors (Optional)
Type: SystemInt32
A limit of the returned colors. This parameter is ignored for indexed bitmaps. Use 0 for no limit. This parameter is optional.
Default value: 0.

Return Value

Type: Color
An array of Color entries.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Bitmap. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

The method is optimized for Format32bppRgb and Format32bppArgb formats.
See Also

Reference