Opened 4 years ago

Closed 22 months ago

#32 closed enhancement (fixed)

lua get used/unique colors functions

Reported by: HoraK-FDF Owned by: PulkoMandy
Priority: major Milestone: 2.6
Component: GrafX2 Version: 2.5
Keywords: Cc:



is it possible to add functions for lua scripting that can return the number of used or unique colors without the automatic added save palette colors?

Here is an example how i would use this feature:
I'm currently working with 8x8 bitmap fonts some have only two colors (0, 1) and some may have more colors. The fonts with two colors are diffrently handeled than the ones with more colors (i can choose with color color 1 has in the output, color 0 will be not drawn) so i need an bool value (multicolor 0/1) that my grafx2 font-to-assembler lua script can output depending on the number of colors and with that bool value i can upgrade the output functions of my current Gameboy Advance Project. I can also make this bool value everytime by hand but because i will create many different fonts for the Project it would be nicer when the export script can do this by it self.

Change History (6)

comment:1 Changed 4 years ago by DawnBringer

My dawnbringer_lib.lua library includes the functions:

Number of Unique colors in palette:
n = #db.fixPalette(db.makePalList(256)) -- A value of 252 would omitt the last 4 pal-cols

Number of Colors in Image:
n = #db.makePalListFromHistogram(db.makeHistogram())

Number of Unique colors in Image:
n = #db.fixPalette(db.makePalListFromHistogram(db.makeHistogram()))

Is that what you are looking for?

comment:2 Changed 4 years ago by HoraK-FDF

Yes that's what i'm looking for ... nice thanks.
And sorry for the late reply.

comment:3 Changed 2 years ago by Thomas Bernard

So this is fixed, right ?

comment:4 Changed 2 years ago by PulkoMandy

Milestone: 2.52.6

comment:5 Changed 2 years ago by PulkoMandy

Owner: changed from Adrien Destugues to PulkoMandy
Status: newassigned

comment:6 Changed 22 months ago by Thomas Bernard

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.