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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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.