/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "awt.h"
#include "awt_image.h"
extern "C" {
#include "img_colors.h"
} // extern "C"
int num_colors;
int cmapsize = 0;
int virtcubesize = 0;
int makecube_verbose = 0;
{
exit(1);
}
{
if (index >= 0) {
usage("Internal error: system palette conflict");
}
} else {
for (int i = 0; i < 256; i++) {
{
// Already there. Ignore it.
return;
}
} else if (index < 0) {
index = i;
}
}
if (index < 0) {
usage("Internal error: ran out of system palette entries");
}
}
}
{
for (int i = 0; i < num_colors; i++) {
return;
}
}
if (num_colors >= cmapsize) {
usage("Internal error: more than cmapsize static colors defined");
}
num_colors++;
}
{
int i;
programname = argv[0];
for (i = 1; i < argc; i++) {
if (i++ >= argc) {
usage("no argument to -cmapsize");
}
usage("colormap size must be between 2 and 256");
}
if (i++ >= argc) {
usage("no argument to -cubesize");
}
if (virtcubesize == 0 ||
virtcubesize > 32)
{
usage("cube size must by a power of 2 <= 32");
}
makecube_verbose = 1;
} else {
usage("unknown argument");
}
}
if (cmapsize == 0) {
}
if (virtcubesize == 0) {
}
if (0) { // For testing
};
exit(0);
}
// Allocate Windows static system colors.
{
for (i = 0; i < n; i++) {
palEntries[i].peGreen,
palEntries[i].peBlue);
palEntries[i].peRed,
palEntries[i].peGreen,
palEntries[i].peBlue);
}
}
// Allocate java.awt.Color constant colors.
addcmapcolor( 0, 0, 0); // black
50.0f, 250.0f,
if (makecube_verbose) {
for (i = 0; i < cmapsize; i++) {
}
}
// Now simulate adding the halftone palette to the system
// palette to get an idea of palette ordering.
{
for (int b = 0; b < 6; b++) {
for (int g = 0; g < 6; g++) {
for (int r = 0; r < 6; r++) {
}
}
}
68, 77, 86, 95, 105, 114, 125, 135,
146, 157, 168, 180, 192, 204, 216, 229,
242, 255 };
for (i = 0; i < 26; i++) {
}
}
if (makecube_verbose) {
for (i = 0; i < 256; i++) {
}
}
if (makecube_verbose) {
"realized halftone palette reads back %d entries\n", n);
int broken = 0;
for (i = 0; i < 256; i++) {
{
msg1 = "no sysPal match!";
msg2 = "(OK)";
} else {
broken++;
}
msg1 = "no sysPal entry...";
}
"palEntries[%3d] = (%3d, %3d, %3d), flags = %d %s %s\n",
i,
palEntries[i].peRed,
palEntries[i].peGreen,
palEntries[i].peBlue,
}
}
#if 0
for (i = 0; i < 256; i++) {
sys2cmap[i] = -1;
cmap2sys[i] = -1;
// error[i] = -1 means cmap[i] is locked to cmap2sys[i]
// error[i] >= 0 means cmap[i] may lock to cmap2sys[i] on this run
}
int nummapped;
int totalmapped = 0;
do {
for (i = 0; i < 256; i++) {
continue;
}
int e = maxerror;
int ix = -1;
for (int j = 0; j < 256; j++) {
if (error[j] < 0) {
continue;
}
int d = t * t;
d += t * t;
d += t * t;
if (d < e) {
e = d;
ix = j;
}
}
if (ix >= 0) {
// To be fair we will not accept any matches
// looser than this former match that we just
// displaced with a better match.
}
}
}
}
}
nummapped = 0;
for (i = 0; i < 256; i++) {
if (error[i] >= 0) {
// Throw this one back to be fair to a displaced entry.
cmap2sys[i] = -1;
continue;
}
error[i] = -1;
nummapped++;
}
}
totalmapped += nummapped;
if (makecube_verbose) {
}
} while (nummapped != 0);
for (i = 0; i < 256; i++) {
if (cmap2sys[i] < 0) {
for (int j = 0; j < 256; j++) {
if (sys2cmap[j] < 0) {
cmap2sys[i] = j;
sys2cmap[j] = i;
break;
}
}
if (j == 256) {
usage("Internal error: no unused system entry for cmap entry!\n");
}
}
}
#else
for (i = 0; i < 256; i++) {
if (i < 10) {
sys2cmap[i] = i;
cmap2sys[i] = i;
} else if (i < 20) {
} else {
sys2cmap[i - 10] = i;
cmap2sys[i] = i - 10;
}
}
#endif
if (makecube_verbose) {
for (i = 0; i < 256; i++) {
usage("Internal error: bad system palette back pointer!\n");
}
}
}
printf("unsigned char awt_reds[256] = {");
for (i = 0; i < 256; i++) {
}
printf("\n};\n");
printf("unsigned char awt_greens[256] = {");
for (i = 0; i < 256; i++) {
}
printf("\n};\n");
printf("unsigned char awt_blues[256] = {");
for (i = 0; i < 256; i++) {
}
printf("\n};\n");
return 0;
}
{
for (int i = 0; i < n; i++) {
i,
palEntries[i].peRed,
palEntries[i].peGreen,
palEntries[i].peBlue,
palEntries[i].peFlags);
}
}
/* This helps eliminate any dependence on javai.dll at build time. */
int
{
int len;
return len;
}