Platforms to show: All Mac Windows Linux Cross-Platform

Back to PaletteCalculatorMBS class.

PaletteCalculatorMBS.Col(i as Integer) as color

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The color array.

Index goes from 0 to count-1.
(Read and Write computed property)

PaletteCalculatorMBS.CountColors as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Counts how many different colors are in the palette.

PaletteCalculatorMBS.CreatePicturePalette(Pic as picture) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a picture palette based on the picture.

This function checks which colors are very often used in the image and builds a palette which may be better for this image than the default system palette.

Some examples using this method:

PaletteCalculatorMBS.GetIndexOfColor(col as color) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Searches the index in the palette for the given color.

Returns -1 if the color is not found.

See also:

PaletteCalculatorMBS.GetIndexOfColor(r as Integer, g as Integer, b as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Searches the index in the palette for the given color.

Returns -1 if the color is not found.

See also:

PaletteCalculatorMBS.GetNearestIndexOfColor(col as color) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Searches the index in the palette for the best matching color.

The best color is the color with the lowest value:
value=(r-col(index).red)^2+(g-col(index).green)^2+(b-col(index).blue)^2

Returns -1 if the color is not found (should never happen).

See also:

PaletteCalculatorMBS.GetNearestIndexOfColor(r as Integer, g as Integer, b as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Searches the index in the palette for the best matching color.

The best color is the color with the lowest value:
value=(r-col(index).red)^2+(g-col(index).green)^2+(b-col(index).blue)^2

Returns -1 if the color is not found (should never happen).

See also:

PaletteCalculatorMBS.Transform(mem as memoryblock, width as Integer, height as Integer) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Transforms a 8 bit picture to a RGB picture.

The memoryblock must have the 8 bit picture data inside with each row being width bytes big. The memoryblock must have at least width*height bytes.

Returns nil on any error.

See also:

PaletteCalculatorMBS.Transform(Pic as picture) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a memoryblock with 8 bit picture data.

The resulting memoryblock has width*height bytes.
Each RGB color in the picture is looked up in the palette and used to fill the memoryblock.

See also:

PaletteCalculatorMBS.TransformBetterDithering(Pic as picture) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a memoryblock with 8 bit picture data.

The resulting memoryblock has width*height bytes.
Each RGB color in the picture is looked up in the palette and used to fill the memoryblock.
This method uses dithering to make the picture looking better than with a better transform using code like Floyd-Steinberg.

Some examples using this method:

PaletteCalculatorMBS.TransformFastDithering(Pic as picture) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a memoryblock with 8 bit picture data.

The resulting memoryblock has width*height bytes.
Each RGB color in the picture is looked up in the palette and used to fill the memoryblock.
This method uses dithering to make the picture looking better than with a simple transform.

The items on this page are in the following plugins: MBS Picture Plugin.


The biggest plugin in space...