mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Add Palette::findExactMatch() member function
This commit is contained in:
parent
2b1e190913
commit
f99423dec4
@ -472,6 +472,15 @@ bool Palette::save(const char *filename) const
|
||||
return success;
|
||||
}
|
||||
|
||||
int Palette::findExactMatch(int r, int g, int b) const
|
||||
{
|
||||
for (int i=0; i<(int)m_colors.size(); ++i)
|
||||
if (getEntry(i) == rgba(r, g, b, 255))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Based on Allegro's bestfit_color
|
||||
|
||||
|
@ -101,6 +101,7 @@ namespace raster {
|
||||
static Palette* load(const char *filename);
|
||||
bool save(const char *filename) const;
|
||||
|
||||
int findExactMatch(int r, int g, int b) const;
|
||||
int findBestfit(int r, int g, int b, int mask_index = 0) const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user