mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove unused gencmap utility
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
33cf679b6a
commit
1ad5d9937a
3 changed files with 0 additions and 368 deletions
|
@ -2,7 +2,6 @@
|
|||
add_definitions(-DQT_NAMESPACE_COMPAT)
|
||||
|
||||
add_subdirectory(fixnonlatin1)
|
||||
add_subdirectory(gencmap)
|
||||
add_subdirectory(lexgen)
|
||||
add_subdirectory(normalize)
|
||||
add_subdirectory(plugintest)
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# add_definitions()
|
||||
set(EXTRA_GENCMAP_LIBS KtCore)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/privateinclude
|
||||
${CMAKE_BINARY_DIR}/include/QtCore
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtCore
|
||||
${CMAKE_BINARY_DIR}/include/QtGui
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtGui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(GENCMAP_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gencmap.cpp
|
||||
)
|
||||
|
||||
katie_setup_target(gencmap ${GENCMAP_SOURCES})
|
||||
|
||||
add_executable(gencmap ${gencmap_SOURCES})
|
||||
target_link_libraries(gencmap ${EXTRA_GENCMAP_LIBS})
|
|
@ -1,346 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016-2019 Ivailo Monev
|
||||
**
|
||||
** This file is part of the utils of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#define APPLE_CMAP 1
|
||||
|
||||
struct Col {
|
||||
int r,g,b;
|
||||
};
|
||||
|
||||
#if SPACE_SEARCH
|
||||
#define MAPSIZE 256
|
||||
#define ACCURACY 4 // Bits-per-channel
|
||||
#define SPACESIZE ((1<<ACCURACY)*(1<<ACCURACY)*(1<<ACCURACY))
|
||||
#define R(c) (((c>>(8-ACCURACY)*2)&((1<<ACCURACY)-1))<<ACCURACY)
|
||||
#define G(c) (((c>>(8-ACCURACY))&((1<<ACCURACY)-1))<<ACCURACY)
|
||||
#define B(c) (((c>>0)&((1<<ACCURACY)-1))<<ACCURACY)
|
||||
#define COL(c) (((c.r>>(8-ACCURACY))<<8)|((c.b>>(8-ACCURACY))<<4)|(c.g>>(8-ACCURACY)))
|
||||
#elif APPLE_CMAP
|
||||
#define SPACESIZE 216
|
||||
#define MAPSIZE 216
|
||||
#define R(c) ((apple_cmap[c]>>16)&0xff)
|
||||
#define G(c) ((apple_cmap[c]>>8)&0xff)
|
||||
#define B(c) ((apple_cmap[c]>>0)&0xff)
|
||||
#define COL(c) findapple(c)
|
||||
static int apple_cmap[216] = {
|
||||
0xffffff,
|
||||
0xffffcc,
|
||||
0xffff99,
|
||||
0xffff66,
|
||||
0xffff33,
|
||||
0xffff00,
|
||||
0xffccff,
|
||||
0xffcccc,
|
||||
0xffcc99,
|
||||
0xffcc66,
|
||||
0xffcc33,
|
||||
0xffcc00,
|
||||
0xff99ff,
|
||||
0xff99cc,
|
||||
0xff9999,
|
||||
0xff9966,
|
||||
0xff9933,
|
||||
0xff9900,
|
||||
0xff66ff,
|
||||
0xff66cc,
|
||||
0xff6699,
|
||||
0xff6666,
|
||||
0xff6633,
|
||||
0xff6600,
|
||||
0xff33ff,
|
||||
0xff33cc,
|
||||
0xff3399,
|
||||
0xff3366,
|
||||
0xff3333,
|
||||
0xff3300,
|
||||
0xff00ff,
|
||||
0xff00cc,
|
||||
0xff0099,
|
||||
0xff0066,
|
||||
0xff0033,
|
||||
0xff0000,
|
||||
0xccffff,
|
||||
0xccffcc,
|
||||
0xccff99,
|
||||
0xccff66,
|
||||
0xccff33,
|
||||
0xccff00,
|
||||
0xccccff,
|
||||
0xcccccc,
|
||||
0xcccc99,
|
||||
0xcccc66,
|
||||
0xcccc33,
|
||||
0xcccc00,
|
||||
0xcc99ff,
|
||||
0xcc99cc,
|
||||
0xcc9999,
|
||||
0xcc9966,
|
||||
0xcc9933,
|
||||
0xcc9900,
|
||||
0xcc66ff,
|
||||
0xcc66cc,
|
||||
0xcc6699,
|
||||
0xcc6666,
|
||||
0xcc6633,
|
||||
0xcc6600,
|
||||
0xcc33ff,
|
||||
0xcc33cc,
|
||||
0xcc3399,
|
||||
0xcc3366,
|
||||
0xcc3333,
|
||||
0xcc3300,
|
||||
0xcc00ff,
|
||||
0xcc00cc,
|
||||
0xcc0099,
|
||||
0xcc0066,
|
||||
0xcc0033,
|
||||
0xcc0000,
|
||||
0x99ffff,
|
||||
0x99ffcc,
|
||||
0x99ff99,
|
||||
0x99ff66,
|
||||
0x99ff33,
|
||||
0x99ff00,
|
||||
0x99ccff,
|
||||
0x99cccc,
|
||||
0x99cc99,
|
||||
0x99cc66,
|
||||
0x99cc33,
|
||||
0x99cc00,
|
||||
0x9999ff,
|
||||
0x9999cc,
|
||||
0x999999,
|
||||
0x999966,
|
||||
0x999933,
|
||||
0x999900,
|
||||
0x9966ff,
|
||||
0x9966cc,
|
||||
0x996699,
|
||||
0x996666,
|
||||
0x996633,
|
||||
0x996600,
|
||||
0x9933ff,
|
||||
0x9933cc,
|
||||
0x993399,
|
||||
0x993366,
|
||||
0x993333,
|
||||
0x993300,
|
||||
0x9900ff,
|
||||
0x9900cc,
|
||||
0x990099,
|
||||
0x990066,
|
||||
0x990033,
|
||||
0x990000,
|
||||
0x66ffff,
|
||||
0x66ffcc,
|
||||
0x66ff99,
|
||||
0x66ff66,
|
||||
0x66ff33,
|
||||
0x66ff00,
|
||||
0x66ccff,
|
||||
0x66cccc,
|
||||
0x66cc99,
|
||||
0x66cc66,
|
||||
0x66cc33,
|
||||
0x66cc00,
|
||||
0x6699ff,
|
||||
0x6699cc,
|
||||
0x669999,
|
||||
0x669966,
|
||||
0x669933,
|
||||
0x669900,
|
||||
0x6666ff,
|
||||
0x6666cc,
|
||||
0x666699,
|
||||
0x666666,
|
||||
0x666633,
|
||||
0x666600,
|
||||
0x6633ff,
|
||||
0x6633cc,
|
||||
0x663399,
|
||||
0x663366,
|
||||
0x663333,
|
||||
0x663300,
|
||||
0x6600ff,
|
||||
0x6600cc,
|
||||
0x660099,
|
||||
0x660066,
|
||||
0x660033,
|
||||
0x660000,
|
||||
0x33ffff,
|
||||
0x33ffcc,
|
||||
0x33ff99,
|
||||
0x33ff66,
|
||||
0x33ff33,
|
||||
0x33ff00,
|
||||
0x33ccff,
|
||||
0x33cccc,
|
||||
0x33cc99,
|
||||
0x33cc66,
|
||||
0x33cc33,
|
||||
0x33cc00,
|
||||
0x3399ff,
|
||||
0x3399cc,
|
||||
0x339999,
|
||||
0x339966,
|
||||
0x339933,
|
||||
0x339900,
|
||||
0x3366ff,
|
||||
0x3366cc,
|
||||
0x336699,
|
||||
0x336666,
|
||||
0x336633,
|
||||
0x336600,
|
||||
0x3333ff,
|
||||
0x3333cc,
|
||||
0x333399,
|
||||
0x333366,
|
||||
0x333333,
|
||||
0x333300,
|
||||
0x3300ff,
|
||||
0x3300cc,
|
||||
0x330099,
|
||||
0x330066,
|
||||
0x330033,
|
||||
0x330000,
|
||||
0x00ffff,
|
||||
0x00ffcc,
|
||||
0x00ff99,
|
||||
0x00ff66,
|
||||
0x00ff33,
|
||||
0x00ff00,
|
||||
0x00ccff,
|
||||
0x00cccc,
|
||||
0x00cc99,
|
||||
0x00cc66,
|
||||
0x00cc33,
|
||||
0x00cc00,
|
||||
0x0099ff,
|
||||
0x0099cc,
|
||||
0x009999,
|
||||
0x009966,
|
||||
0x009933,
|
||||
0x009900,
|
||||
0x0066ff,
|
||||
0x0066cc,
|
||||
0x006699,
|
||||
0x006666,
|
||||
0x006633,
|
||||
0x006600,
|
||||
0x0033ff,
|
||||
0x0033cc,
|
||||
0x003399,
|
||||
0x003366,
|
||||
0x003333,
|
||||
0x003300,
|
||||
0x0000ff,
|
||||
0x0000cc,
|
||||
0x000099,
|
||||
0x000066,
|
||||
0x000033,
|
||||
0x000000,
|
||||
};
|
||||
int findapple(Col c)
|
||||
{
|
||||
for (int i=0; i<216; i++)
|
||||
if (apple_cmap[i]==((c.r<<16)|(c.g<<8)|c.b))
|
||||
return i;
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SQ(x) ((x)*(x))
|
||||
#define D(c1,c2) (SQ(R(c1)-R(c2))+SQ(G(c1)-G(c2))+SQ(B(c1)-B(c2)))
|
||||
|
||||
int main()
|
||||
{
|
||||
Col c[256] = {
|
||||
{ 0,0,0 },
|
||||
{ 255,255,255 },
|
||||
{ 255,0,0 }, { 0,255,0 }, { 0,0,255 },
|
||||
{ 255,255,0 }, { 0,255,255 }, { 255,0,255 },
|
||||
#define PREALLOC 8
|
||||
{ 96,96,96 }, { 192,192,192 },
|
||||
//#define PREALLOC 10
|
||||
};
|
||||
int done[SPACESIZE];
|
||||
for (int a=0; a<SPACESIZE; a++) done[a]=0;
|
||||
for (int a=0; a<PREALLOC; a++) done[COL(c[a])]=1;
|
||||
|
||||
for (int allocated=PREALLOC; allocated<MAPSIZE; allocated++) {
|
||||
int mostdist;
|
||||
int dist=0;
|
||||
for (int a=0; a<SPACESIZE; a++) {
|
||||
if (!done[a]) {
|
||||
int closeness=INT_MAX;
|
||||
for (int b=0; b<SPACESIZE; b++) {
|
||||
if (done[b]) {
|
||||
int d=D(a,b);
|
||||
if (d < closeness) {
|
||||
closeness=d;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closeness > dist) {
|
||||
mostdist=a;
|
||||
dist=closeness;
|
||||
}
|
||||
}
|
||||
}
|
||||
c[allocated].r=R(mostdist);
|
||||
c[allocated].g=G(mostdist);
|
||||
c[allocated].b=B(mostdist);
|
||||
done[mostdist]=1;
|
||||
fprintf(stderr,"Done %d of %d (%06x dist %d)\n",allocated+1,MAPSIZE,
|
||||
qRgb(c[allocated].r, c[allocated].g, c[allocated].b), dist);
|
||||
}
|
||||
|
||||
for (int i=0; i<256; i++) {
|
||||
printf("0x%06x,%c", qRgb(c[i].r, c[i].g, c[i].b), i%4==3 ? '\n' : ' ');
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue