39 const gchar * available);
50 unsigned long plane_masks_return[],
52 unsigned long pixels_return[],
unsigned int npixels)
54 unsigned int i, nfree, iret;
57 for (i = 0; i < colormap->
size && nfree < npixels; i++)
62 g_warning(
"alloc_color_cells: too large palette: %d",
63 colormap->
size + npixels);
68 for (i = 0; i < colormap->
size && iret < npixels; i++)
69 if (!colormap->
in_use[i]) {
71 pixels_return[iret] = i;
75 if (nfree < npixels) {
76 int nmore = npixels - nfree;
82 #ifdef SOME_STRANGE_BUG
83 if (!ResizePalette(colormap->
palette, colormap->
size + nmore)) {
87 g_print(
"alloc_color_cells: %#x to %d\n",
90 for (i = colormap->
size; i < colormap->size + nmore; i++) {
91 pixels_return[iret] = i;
95 #ifdef SOME_STRANGE_BUG
96 colormap->
size += nmore;
167 PALETTEENTRY
entry, closeEntry;
174 COLORREF newPixel, closePixel;
181 newPixel = RGB(entry.peRed, entry.peGreen, entry.peBlue);
182 index = GetNearestPaletteIndex(colormap->
palette, newPixel);
183 GetPaletteEntries(colormap->
palette, index, 1, &closeEntry);
184 closePixel = RGB(closeEntry.peRed, closeEntry.peGreen,
187 if (newPixel != closePixel) {
189 if (!colormap->
in_use[index]) {
192 if (SetPaletteEntries(colormap->
palette, index, 1, &entry) ==
199 for (i = 0; i < colormap->
size; i++)
200 if (!colormap->
in_use[i]) {
202 if (SetPaletteEntries(colormap->
palette,
203 index, 1, &entry) == 0)
208 if (i == colormap->
size) {
217 index = colormap->
size;
219 if (!ResizePalette(colormap->
palette, colormap->
size))
221 if (SetPaletteEntries
222 (colormap->
palette, index, 1, &entry) == 0)
235 g_print(
"alloc_color from %#x: index %d for %02x %02x %02x\n",
237 entry.peRed, entry.peGreen, entry.peBlue);
245 RGB(entry.peRed, entry.peGreen, entry.peBlue));
247 color->peRed = GetRValue(*pixelp);
248 color->peGreen = GetGValue(*pixelp);
249 color->peBlue = GetBValue(*pixelp);
277 PALETTEENTRY entries[256];
285 int lowestpixel = 256;
286 int highestpixel = -1;
288 npal = GetPaletteEntries(colormap->
palette, 0, 256, entries);
289 for (i = 0; i < npixels; i++) {
290 int pixel = pixels[i];
292 if (pixel < lowestpixel)
294 if (pixel > highestpixel)
295 highestpixel = pixel;
299 entries[pixel] = entries[0];
302 if (SetPaletteEntries(colormap->
palette, lowestpixel,
303 highestpixel - lowestpixel + 1,
304 entries + lowestpixel) == 0)
309 g_print(
"free_colors %#x lowestpixel = %d, highestpixel = %d\n",
310 colormap->
palette, lowestpixel, highestpixel);
333 char logPalBuf[
sizeof(LOGPALETTE) + 256 *
sizeof(PALETTEENTRY)];
334 LOGPALETTE *logPalettePtr;
345 logPalettePtr = (LOGPALETTE *) logPalBuf;
346 logPalettePtr->palVersion = 0x300;
347 sysPal = (HPALETTE) GetStockObject(DEFAULT_PALETTE);
348 logPalettePtr->palNumEntries =
349 GetPaletteEntries(sysPal, 0, 256, logPalettePtr->palPalEntry);
352 colormap->
size = logPalettePtr->palNumEntries;
354 colormap->
palette = CreatePalette(logPalettePtr);
357 ((GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) != 0);
359 colormap->
sizepalette = GetDeviceCaps(hdc, SIZEPALETTE);
362 for (i = 0; i < logPalettePtr->palNumEntries; i++)
365 for (i = logPalettePtr->palNumEntries; i < colormap->sizepalette;
369 ReleaseDC(
NULL, hdc);
394 if (!DeleteObject(colormap->
palette)) {
395 g_error(
"Unable to free colormap, palette is still selected.");
408 {
"alice blue", 240, 248, 255},
409 {
"AliceBlue", 240, 248, 255},
410 {
"antique white", 250, 235, 215},
411 {
"AntiqueWhite", 250, 235, 215},
412 {
"AntiqueWhite1", 255, 239, 219},
413 {
"AntiqueWhite2", 238, 223, 204},
414 {
"AntiqueWhite3", 205, 192, 176},
415 {
"AntiqueWhite4", 139, 131, 120},
416 {
"aquamarine", 127, 255, 212},
417 {
"aquamarine1", 127, 255, 212},
418 {
"aquamarine2", 118, 238, 198},
419 {
"aquamarine3", 102, 205, 170},
420 {
"aquamarine4", 69, 139, 116},
421 {
"azure", 240, 255, 255},
422 {
"azure1", 240, 255, 255},
423 {
"azure2", 224, 238, 238},
424 {
"azure3", 193, 205, 205},
425 {
"azure4", 131, 139, 139},
426 {
"beige", 245, 245, 220},
427 {
"bisque", 255, 228, 196},
428 {
"bisque1", 255, 228, 196},
429 {
"bisque2", 238, 213, 183},
430 {
"bisque3", 205, 183, 158},
431 {
"bisque4", 139, 125, 107},
433 {
"blanched almond", 255, 235, 205},
434 {
"BlanchedAlmond", 255, 235, 205},
436 {
"blue violet", 138, 43, 226},
437 {
"blue1", 0, 0, 255},
438 {
"blue2", 0, 0, 238},
439 {
"blue3", 0, 0, 205},
440 {
"blue4", 0, 0, 139},
441 {
"BlueViolet", 138, 43, 226},
442 {
"brown", 165, 42, 42},
443 {
"brown1", 255, 64, 64},
444 {
"brown2", 238, 59, 59},
445 {
"brown3", 205, 51, 51},
446 {
"brown4", 139, 35, 35},
447 {
"burlywood", 222, 184, 135},
448 {
"burlywood1", 255, 211, 155},
449 {
"burlywood2", 238, 197, 145},
450 {
"burlywood3", 205, 170, 125},
451 {
"burlywood4", 139, 115, 85},
452 {
"cadet blue", 95, 158, 160},
453 {
"CadetBlue", 95, 158, 160},
454 {
"CadetBlue1", 152, 245, 255},
455 {
"CadetBlue2", 142, 229, 238},
456 {
"CadetBlue3", 122, 197, 205},
457 {
"CadetBlue4", 83, 134, 139},
458 {
"chartreuse", 127, 255, 0},
459 {
"chartreuse1", 127, 255, 0},
460 {
"chartreuse2", 118, 238, 0},
461 {
"chartreuse3", 102, 205, 0},
462 {
"chartreuse4", 69, 139, 0},
463 {
"chocolate", 210, 105, 30},
464 {
"chocolate1", 255, 127, 36},
465 {
"chocolate2", 238, 118, 33},
466 {
"chocolate3", 205, 102, 29},
467 {
"chocolate4", 139, 69, 19},
468 {
"coral", 255, 127, 80},
469 {
"coral1", 255, 114, 86},
470 {
"coral2", 238, 106, 80},
471 {
"coral3", 205, 91, 69},
472 {
"coral4", 139, 62, 47},
473 {
"cornflower blue", 100, 149, 237},
474 {
"CornflowerBlue", 100, 149, 237},
475 {
"cornsilk", 255, 248, 220},
476 {
"cornsilk1", 255, 248, 220},
477 {
"cornsilk2", 238, 232, 205},
478 {
"cornsilk3", 205, 200, 177},
479 {
"cornsilk4", 139, 136, 120},
480 {
"cyan", 0, 255, 255},
481 {
"cyan1", 0, 255, 255},
482 {
"cyan2", 0, 238, 238},
483 {
"cyan3", 0, 205, 205},
484 {
"cyan4", 0, 139, 139},
485 {
"dark blue", 0, 0, 139},
486 {
"dark cyan", 0, 139, 139},
487 {
"dark goldenrod", 184, 134, 11},
488 {
"dark gray", 169, 169, 169},
489 {
"dark green", 0, 100, 0},
490 {
"dark grey", 169, 169, 169},
491 {
"dark khaki", 189, 183, 107},
492 {
"dark magenta", 139, 0, 139},
493 {
"dark olive green", 85, 107, 47},
494 {
"dark orange", 255, 140, 0},
495 {
"dark orchid", 153, 50, 204},
496 {
"dark red", 139, 0, 0},
497 {
"dark salmon", 233, 150, 122},
498 {
"dark sea green", 143, 188, 143},
499 {
"dark slate blue", 72, 61, 139},
500 {
"dark slate gray", 47, 79, 79},
501 {
"dark slate grey", 47, 79, 79},
502 {
"dark turquoise", 0, 206, 209},
503 {
"dark violet", 148, 0, 211},
504 {
"DarkBlue", 0, 0, 139},
505 {
"DarkCyan", 0, 139, 139},
506 {
"DarkGoldenrod", 184, 134, 11},
507 {
"DarkGoldenrod1", 255, 185, 15},
508 {
"DarkGoldenrod2", 238, 173, 14},
509 {
"DarkGoldenrod3", 205, 149, 12},
510 {
"DarkGoldenrod4", 139, 101, 8},
511 {
"DarkGray", 169, 169, 169},
512 {
"DarkGreen", 0, 100, 0},
513 {
"DarkGrey", 169, 169, 169},
514 {
"DarkKhaki", 189, 183, 107},
515 {
"DarkMagenta", 139, 0, 139},
516 {
"DarkOliveGreen", 85, 107, 47},
517 {
"DarkOliveGreen1", 202, 255, 112},
518 {
"DarkOliveGreen2", 188, 238, 104},
519 {
"DarkOliveGreen3", 162, 205, 90},
520 {
"DarkOliveGreen4", 110, 139, 61},
521 {
"DarkOrange", 255, 140, 0},
522 {
"DarkOrange1", 255, 127, 0},
523 {
"DarkOrange2", 238, 118, 0},
524 {
"DarkOrange3", 205, 102, 0},
525 {
"DarkOrange4", 139, 69, 0},
526 {
"DarkOrchid", 153, 50, 204},
527 {
"DarkOrchid1", 191, 62, 255},
528 {
"DarkOrchid2", 178, 58, 238},
529 {
"DarkOrchid3", 154, 50, 205},
530 {
"DarkOrchid4", 104, 34, 139},
531 {
"DarkRed", 139, 0, 0},
532 {
"DarkSalmon", 233, 150, 122},
533 {
"DarkSeaGreen", 143, 188, 143},
534 {
"DarkSeaGreen1", 193, 255, 193},
535 {
"DarkSeaGreen2", 180, 238, 180},
536 {
"DarkSeaGreen3", 155, 205, 155},
537 {
"DarkSeaGreen4", 105, 139, 105},
538 {
"DarkSlateBlue", 72, 61, 139},
539 {
"DarkSlateGray", 47, 79, 79},
540 {
"DarkSlateGray1", 151, 255, 255},
541 {
"DarkSlateGray2", 141, 238, 238},
542 {
"DarkSlateGray3", 121, 205, 205},
543 {
"DarkSlateGray4", 82, 139, 139},
544 {
"DarkSlateGrey", 47, 79, 79},
545 {
"DarkTurquoise", 0, 206, 209},
546 {
"DarkViolet", 148, 0, 211},
547 {
"deep pink", 255, 20, 147},
548 {
"deep sky blue", 0, 191, 255},
549 {
"DeepPink", 255, 20, 147},
550 {
"DeepPink1", 255, 20, 147},
551 {
"DeepPink2", 238, 18, 137},
552 {
"DeepPink3", 205, 16, 118},
553 {
"DeepPink4", 139, 10, 80},
554 {
"DeepSkyBlue", 0, 191, 255},
555 {
"DeepSkyBlue1", 0, 191, 255},
556 {
"DeepSkyBlue2", 0, 178, 238},
557 {
"DeepSkyBlue3", 0, 154, 205},
558 {
"DeepSkyBlue4", 0, 104, 139},
559 {
"dim gray", 105, 105, 105},
560 {
"dim grey", 105, 105, 105},
561 {
"DimGray", 105, 105, 105},
562 {
"DimGrey", 105, 105, 105},
563 {
"dodger blue", 30, 144, 255},
564 {
"DodgerBlue", 30, 144, 255},
565 {
"DodgerBlue1", 30, 144, 255},
566 {
"DodgerBlue2", 28, 134, 238},
567 {
"DodgerBlue3", 24, 116, 205},
568 {
"DodgerBlue4", 16, 78, 139},
569 {
"firebrick", 178, 34, 34},
570 {
"firebrick1", 255, 48, 48},
571 {
"firebrick2", 238, 44, 44},
572 {
"firebrick3", 205, 38, 38},
573 {
"firebrick4", 139, 26, 26},
574 {
"floral white", 255, 250, 240},
575 {
"FloralWhite", 255, 250, 240},
576 {
"forest green", 34, 139, 34},
577 {
"ForestGreen", 34, 139, 34},
578 {
"gainsboro", 220, 220, 220},
579 {
"ghost white", 248, 248, 255},
580 {
"GhostWhite", 248, 248, 255},
581 {
"gold", 255, 215, 0},
582 {
"gold1", 255, 215, 0},
583 {
"gold2", 238, 201, 0},
584 {
"gold3", 205, 173, 0},
585 {
"gold4", 139, 117, 0},
586 {
"goldenrod", 218, 165, 32},
587 {
"goldenrod1", 255, 193, 37},
588 {
"goldenrod2", 238, 180, 34},
589 {
"goldenrod3", 205, 155, 29},
590 {
"goldenrod4", 139, 105, 20},
591 {
"gray", 190, 190, 190},
594 {
"gray10", 26, 26, 26},
595 {
"gray100", 255, 255, 255},
596 {
"gray11", 28, 28, 28},
597 {
"gray12", 31, 31, 31},
598 {
"gray13", 33, 33, 33},
599 {
"gray14", 36, 36, 36},
600 {
"gray15", 38, 38, 38},
601 {
"gray16", 41, 41, 41},
602 {
"gray17", 43, 43, 43},
603 {
"gray18", 46, 46, 46},
604 {
"gray19", 48, 48, 48},
606 {
"gray20", 51, 51, 51},
607 {
"gray21", 54, 54, 54},
608 {
"gray22", 56, 56, 56},
609 {
"gray23", 59, 59, 59},
610 {
"gray24", 61, 61, 61},
611 {
"gray25", 64, 64, 64},
612 {
"gray26", 66, 66, 66},
613 {
"gray27", 69, 69, 69},
614 {
"gray28", 71, 71, 71},
615 {
"gray29", 74, 74, 74},
617 {
"gray30", 77, 77, 77},
618 {
"gray31", 79, 79, 79},
619 {
"gray32", 82, 82, 82},
620 {
"gray33", 84, 84, 84},
621 {
"gray34", 87, 87, 87},
622 {
"gray35", 89, 89, 89},
623 {
"gray36", 92, 92, 92},
624 {
"gray37", 94, 94, 94},
625 {
"gray38", 97, 97, 97},
626 {
"gray39", 99, 99, 99},
627 {
"gray4", 10, 10, 10},
628 {
"gray40", 102, 102, 102},
629 {
"gray41", 105, 105, 105},
630 {
"gray42", 107, 107, 107},
631 {
"gray43", 110, 110, 110},
632 {
"gray44", 112, 112, 112},
633 {
"gray45", 115, 115, 115},
634 {
"gray46", 117, 117, 117},
635 {
"gray47", 120, 120, 120},
636 {
"gray48", 122, 122, 122},
637 {
"gray49", 125, 125, 125},
638 {
"gray5", 13, 13, 13},
639 {
"gray50", 127, 127, 127},
640 {
"gray51", 130, 130, 130},
641 {
"gray52", 133, 133, 133},
642 {
"gray53", 135, 135, 135},
643 {
"gray54", 138, 138, 138},
644 {
"gray55", 140, 140, 140},
645 {
"gray56", 143, 143, 143},
646 {
"gray57", 145, 145, 145},
647 {
"gray58", 148, 148, 148},
648 {
"gray59", 150, 150, 150},
649 {
"gray6", 15, 15, 15},
650 {
"gray60", 153, 153, 153},
651 {
"gray61", 156, 156, 156},
652 {
"gray62", 158, 158, 158},
653 {
"gray63", 161, 161, 161},
654 {
"gray64", 163, 163, 163},
655 {
"gray65", 166, 166, 166},
656 {
"gray66", 168, 168, 168},
657 {
"gray67", 171, 171, 171},
658 {
"gray68", 173, 173, 173},
659 {
"gray69", 176, 176, 176},
660 {
"gray7", 18, 18, 18},
661 {
"gray70", 179, 179, 179},
662 {
"gray71", 181, 181, 181},
663 {
"gray72", 184, 184, 184},
664 {
"gray73", 186, 186, 186},
665 {
"gray74", 189, 189, 189},
666 {
"gray75", 191, 191, 191},
667 {
"gray76", 194, 194, 194},
668 {
"gray77", 196, 196, 196},
669 {
"gray78", 199, 199, 199},
670 {
"gray79", 201, 201, 201},
671 {
"gray8", 20, 20, 20},
672 {
"gray80", 204, 204, 204},
673 {
"gray81", 207, 207, 207},
674 {
"gray82", 209, 209, 209},
675 {
"gray83", 212, 212, 212},
676 {
"gray84", 214, 214, 214},
677 {
"gray85", 217, 217, 217},
678 {
"gray86", 219, 219, 219},
679 {
"gray87", 222, 222, 222},
680 {
"gray88", 224, 224, 224},
681 {
"gray89", 227, 227, 227},
682 {
"gray9", 23, 23, 23},
683 {
"gray90", 229, 229, 229},
684 {
"gray91", 232, 232, 232},
685 {
"gray92", 235, 235, 235},
686 {
"gray93", 237, 237, 237},
687 {
"gray94", 240, 240, 240},
688 {
"gray95", 242, 242, 242},
689 {
"gray96", 245, 245, 245},
690 {
"gray97", 247, 247, 247},
691 {
"gray98", 250, 250, 250},
692 {
"gray99", 252, 252, 252},
693 {
"green", 0, 255, 0},
694 {
"green yellow", 173, 255, 47},
695 {
"green1", 0, 255, 0},
696 {
"green2", 0, 238, 0},
697 {
"green3", 0, 205, 0},
698 {
"green4", 0, 139, 0},
699 {
"GreenYellow", 173, 255, 47},
700 {
"grey", 190, 190, 190},
703 {
"grey10", 26, 26, 26},
704 {
"grey100", 255, 255, 255},
705 {
"grey11", 28, 28, 28},
706 {
"grey12", 31, 31, 31},
707 {
"grey13", 33, 33, 33},
708 {
"grey14", 36, 36, 36},
709 {
"grey15", 38, 38, 38},
710 {
"grey16", 41, 41, 41},
711 {
"grey17", 43, 43, 43},
712 {
"grey18", 46, 46, 46},
713 {
"grey19", 48, 48, 48},
715 {
"grey20", 51, 51, 51},
716 {
"grey21", 54, 54, 54},
717 {
"grey22", 56, 56, 56},
718 {
"grey23", 59, 59, 59},
719 {
"grey24", 61, 61, 61},
720 {
"grey25", 64, 64, 64},
721 {
"grey26", 66, 66, 66},
722 {
"grey27", 69, 69, 69},
723 {
"grey28", 71, 71, 71},
724 {
"grey29", 74, 74, 74},
726 {
"grey30", 77, 77, 77},
727 {
"grey31", 79, 79, 79},
728 {
"grey32", 82, 82, 82},
729 {
"grey33", 84, 84, 84},
730 {
"grey34", 87, 87, 87},
731 {
"grey35", 89, 89, 89},
732 {
"grey36", 92, 92, 92},
733 {
"grey37", 94, 94, 94},
734 {
"grey38", 97, 97, 97},
735 {
"grey39", 99, 99, 99},
736 {
"grey4", 10, 10, 10},
737 {
"grey40", 102, 102, 102},
738 {
"grey41", 105, 105, 105},
739 {
"grey42", 107, 107, 107},
740 {
"grey43", 110, 110, 110},
741 {
"grey44", 112, 112, 112},
742 {
"grey45", 115, 115, 115},
743 {
"grey46", 117, 117, 117},
744 {
"grey47", 120, 120, 120},
745 {
"grey48", 122, 122, 122},
746 {
"grey49", 125, 125, 125},
747 {
"grey5", 13, 13, 13},
748 {
"grey50", 127, 127, 127},
749 {
"grey51", 130, 130, 130},
750 {
"grey52", 133, 133, 133},
751 {
"grey53", 135, 135, 135},
752 {
"grey54", 138, 138, 138},
753 {
"grey55", 140, 140, 140},
754 {
"grey56", 143, 143, 143},
755 {
"grey57", 145, 145, 145},
756 {
"grey58", 148, 148, 148},
757 {
"grey59", 150, 150, 150},
758 {
"grey6", 15, 15, 15},
759 {
"grey60", 153, 153, 153},
760 {
"grey61", 156, 156, 156},
761 {
"grey62", 158, 158, 158},
762 {
"grey63", 161, 161, 161},
763 {
"grey64", 163, 163, 163},
764 {
"grey65", 166, 166, 166},
765 {
"grey66", 168, 168, 168},
766 {
"grey67", 171, 171, 171},
767 {
"grey68", 173, 173, 173},
768 {
"grey69", 176, 176, 176},
769 {
"grey7", 18, 18, 18},
770 {
"grey70", 179, 179, 179},
771 {
"grey71", 181, 181, 181},
772 {
"grey72", 184, 184, 184},
773 {
"grey73", 186, 186, 186},
774 {
"grey74", 189, 189, 189},
775 {
"grey75", 191, 191, 191},
776 {
"grey76", 194, 194, 194},
777 {
"grey77", 196, 196, 196},
778 {
"grey78", 199, 199, 199},
779 {
"grey79", 201, 201, 201},
780 {
"grey8", 20, 20, 20},
781 {
"grey80", 204, 204, 204},
782 {
"grey81", 207, 207, 207},
783 {
"grey82", 209, 209, 209},
784 {
"grey83", 212, 212, 212},
785 {
"grey84", 214, 214, 214},
786 {
"grey85", 217, 217, 217},
787 {
"grey86", 219, 219, 219},
788 {
"grey87", 222, 222, 222},
789 {
"grey88", 224, 224, 224},
790 {
"grey89", 227, 227, 227},
791 {
"grey9", 23, 23, 23},
792 {
"grey90", 229, 229, 229},
793 {
"grey91", 232, 232, 232},
794 {
"grey92", 235, 235, 235},
795 {
"grey93", 237, 237, 237},
796 {
"grey94", 240, 240, 240},
797 {
"grey95", 242, 242, 242},
798 {
"grey96", 245, 245, 245},
799 {
"grey97", 247, 247, 247},
800 {
"grey98", 250, 250, 250},
801 {
"grey99", 252, 252, 252},
802 {
"honeydew", 240, 255, 240},
803 {
"honeydew1", 240, 255, 240},
804 {
"honeydew2", 224, 238, 224},
805 {
"honeydew3", 193, 205, 193},
806 {
"honeydew4", 131, 139, 131},
807 {
"hot pink", 255, 105, 180},
808 {
"HotPink", 255, 105, 180},
809 {
"HotPink1", 255, 110, 180},
810 {
"HotPink2", 238, 106, 167},
811 {
"HotPink3", 205, 96, 144},
812 {
"HotPink4", 139, 58, 98},
813 {
"indian red", 205, 92, 92},
814 {
"IndianRed", 205, 92, 92},
815 {
"IndianRed1", 255, 106, 106},
816 {
"IndianRed2", 238, 99, 99},
817 {
"IndianRed3", 205, 85, 85},
818 {
"IndianRed4", 139, 58, 58},
819 {
"ivory", 255, 255, 240},
820 {
"ivory1", 255, 255, 240},
821 {
"ivory2", 238, 238, 224},
822 {
"ivory3", 205, 205, 193},
823 {
"ivory4", 139, 139, 131},
824 {
"khaki", 240, 230, 140},
825 {
"khaki1", 255, 246, 143},
826 {
"khaki2", 238, 230, 133},
827 {
"khaki3", 205, 198, 115},
828 {
"khaki4", 139, 134, 78},
829 {
"lavender", 230, 230, 250},
830 {
"lavender blush", 255, 240, 245},
831 {
"LavenderBlush", 255, 240, 245},
832 {
"LavenderBlush1", 255, 240, 245},
833 {
"LavenderBlush2", 238, 224, 229},
834 {
"LavenderBlush3", 205, 193, 197},
835 {
"LavenderBlush4", 139, 131, 134},
836 {
"lawn green", 124, 252, 0},
837 {
"LawnGreen", 124, 252, 0},
838 {
"lemon chiffon", 255, 250, 205},
839 {
"LemonChiffon", 255, 250, 205},
840 {
"LemonChiffon1", 255, 250, 205},
841 {
"LemonChiffon2", 238, 233, 191},
842 {
"LemonChiffon3", 205, 201, 165},
843 {
"LemonChiffon4", 139, 137, 112},
844 {
"light blue", 173, 216, 230},
845 {
"light coral", 240, 128, 128},
846 {
"light cyan", 224, 255, 255},
847 {
"light goldenrod", 238, 221, 130},
848 {
"light goldenrod yellow", 250, 250, 210},
849 {
"light gray", 211, 211, 211},
850 {
"light green", 144, 238, 144},
851 {
"light grey", 211, 211, 211},
852 {
"light pink", 255, 182, 193},
853 {
"light salmon", 255, 160, 122},
854 {
"light sea green", 32, 178, 170},
855 {
"light sky blue", 135, 206, 250},
856 {
"light slate blue", 132, 112, 255},
857 {
"light slate gray", 119, 136, 153},
858 {
"light slate grey", 119, 136, 153},
859 {
"light steel blue", 176, 196, 222},
860 {
"light yellow", 255, 255, 224},
861 {
"LightBlue", 173, 216, 230},
862 {
"LightBlue1", 191, 239, 255},
863 {
"LightBlue2", 178, 223, 238},
864 {
"LightBlue3", 154, 192, 205},
865 {
"LightBlue4", 104, 131, 139},
866 {
"LightCoral", 240, 128, 128},
867 {
"LightCyan", 224, 255, 255},
868 {
"LightCyan1", 224, 255, 255},
869 {
"LightCyan2", 209, 238, 238},
870 {
"LightCyan3", 180, 205, 205},
871 {
"LightCyan4", 122, 139, 139},
872 {
"LightGoldenrod", 238, 221, 130},
873 {
"LightGoldenrod1", 255, 236, 139},
874 {
"LightGoldenrod2", 238, 220, 130},
875 {
"LightGoldenrod3", 205, 190, 112},
876 {
"LightGoldenrod4", 139, 129, 76},
877 {
"LightGoldenrodYellow", 250, 250, 210},
878 {
"LightGray", 211, 211, 211},
879 {
"LightGreen", 144, 238, 144},
880 {
"LightGrey", 211, 211, 211},
881 {
"LightPink", 255, 182, 193},
882 {
"LightPink1", 255, 174, 185},
883 {
"LightPink2", 238, 162, 173},
884 {
"LightPink3", 205, 140, 149},
885 {
"LightPink4", 139, 95, 101},
886 {
"LightSalmon", 255, 160, 122},
887 {
"LightSalmon1", 255, 160, 122},
888 {
"LightSalmon2", 238, 149, 114},
889 {
"LightSalmon3", 205, 129, 98},
890 {
"LightSalmon4", 139, 87, 66},
891 {
"LightSeaGreen", 32, 178, 170},
892 {
"LightSkyBlue", 135, 206, 250},
893 {
"LightSkyBlue1", 176, 226, 255},
894 {
"LightSkyBlue2", 164, 211, 238},
895 {
"LightSkyBlue3", 141, 182, 205},
896 {
"LightSkyBlue4", 96, 123, 139},
897 {
"LightSlateBlue", 132, 112, 255},
898 {
"LightSlateGray", 119, 136, 153},
899 {
"LightSlateGrey", 119, 136, 153},
900 {
"LightSteelBlue", 176, 196, 222},
901 {
"LightSteelBlue1", 202, 225, 255},
902 {
"LightSteelBlue2", 188, 210, 238},
903 {
"LightSteelBlue3", 162, 181, 205},
904 {
"LightSteelBlue4", 110, 123, 139},
905 {
"LightYellow", 255, 255, 224},
906 {
"LightYellow1", 255, 255, 224},
907 {
"LightYellow2", 238, 238, 209},
908 {
"LightYellow3", 205, 205, 180},
909 {
"LightYellow4", 139, 139, 122},
910 {
"lime green", 50, 205, 50},
911 {
"LimeGreen", 50, 205, 50},
912 {
"linen", 250, 240, 230},
913 {
"magenta", 255, 0, 255},
914 {
"magenta1", 255, 0, 255},
915 {
"magenta2", 238, 0, 238},
916 {
"magenta3", 205, 0, 205},
917 {
"magenta4", 139, 0, 139},
918 {
"maroon", 176, 48, 96},
919 {
"maroon1", 255, 52, 179},
920 {
"maroon2", 238, 48, 167},
921 {
"maroon3", 205, 41, 144},
922 {
"maroon4", 139, 28, 98},
923 {
"medium aquamarine", 102, 205, 170},
924 {
"medium blue", 0, 0, 205},
925 {
"medium orchid", 186, 85, 211},
926 {
"medium purple", 147, 112, 219},
927 {
"medium sea green", 60, 179, 113},
928 {
"medium slate blue", 123, 104, 238},
929 {
"medium spring green", 0, 250, 154},
930 {
"medium turquoise", 72, 209, 204},
931 {
"medium violet red", 199, 21, 133},
932 {
"MediumAquamarine", 102, 205, 170},
933 {
"MediumBlue", 0, 0, 205},
934 {
"MediumOrchid", 186, 85, 211},
935 {
"MediumOrchid1", 224, 102, 255},
936 {
"MediumOrchid2", 209, 95, 238},
937 {
"MediumOrchid3", 180, 82, 205},
938 {
"MediumOrchid4", 122, 55, 139},
939 {
"MediumPurple", 147, 112, 219},
940 {
"MediumPurple1", 171, 130, 255},
941 {
"MediumPurple2", 159, 121, 238},
942 {
"MediumPurple3", 137, 104, 205},
943 {
"MediumPurple4", 93, 71, 139},
944 {
"MediumSeaGreen", 60, 179, 113},
945 {
"MediumSlateBlue", 123, 104, 238},
946 {
"MediumSpringGreen", 0, 250, 154},
947 {
"MediumTurquoise", 72, 209, 204},
948 {
"MediumVioletRed", 199, 21, 133},
949 {
"midnight blue", 25, 25, 112},
950 {
"MidnightBlue", 25, 25, 112},
951 {
"mint cream", 245, 255, 250},
952 {
"MintCream", 245, 255, 250},
953 {
"misty rose", 255, 228, 225},
954 {
"MistyRose", 255, 228, 225},
955 {
"MistyRose1", 255, 228, 225},
956 {
"MistyRose2", 238, 213, 210},
957 {
"MistyRose3", 205, 183, 181},
958 {
"MistyRose4", 139, 125, 123},
959 {
"moccasin", 255, 228, 181},
960 {
"navajo white", 255, 222, 173},
961 {
"NavajoWhite", 255, 222, 173},
962 {
"NavajoWhite1", 255, 222, 173},
963 {
"NavajoWhite2", 238, 207, 161},
964 {
"NavajoWhite3", 205, 179, 139},
965 {
"NavajoWhite4", 139, 121, 94},
967 {
"navy blue", 0, 0, 128},
968 {
"NavyBlue", 0, 0, 128},
969 {
"old lace", 253, 245, 230},
970 {
"OldLace", 253, 245, 230},
971 {
"olive drab", 107, 142, 35},
972 {
"OliveDrab", 107, 142, 35},
973 {
"OliveDrab1", 192, 255, 62},
974 {
"OliveDrab2", 179, 238, 58},
975 {
"OliveDrab3", 154, 205, 50},
976 {
"OliveDrab4", 105, 139, 34},
977 {
"orange", 255, 165, 0},
978 {
"orange red", 255, 69, 0},
979 {
"orange1", 255, 165, 0},
980 {
"orange2", 238, 154, 0},
981 {
"orange3", 205, 133, 0},
982 {
"orange4", 139, 90, 0},
983 {
"OrangeRed", 255, 69, 0},
984 {
"OrangeRed1", 255, 69, 0},
985 {
"OrangeRed2", 238, 64, 0},
986 {
"OrangeRed3", 205, 55, 0},
987 {
"OrangeRed4", 139, 37, 0},
988 {
"orchid", 218, 112, 214},
989 {
"orchid1", 255, 131, 250},
990 {
"orchid2", 238, 122, 233},
991 {
"orchid3", 205, 105, 201},
992 {
"orchid4", 139, 71, 137},
993 {
"pale goldenrod", 238, 232, 170},
994 {
"pale green", 152, 251, 152},
995 {
"pale turquoise", 175, 238, 238},
996 {
"pale violet red", 219, 112, 147},
997 {
"PaleGoldenrod", 238, 232, 170},
998 {
"PaleGreen", 152, 251, 152},
999 {
"PaleGreen1", 154, 255, 154},
1000 {
"PaleGreen2", 144, 238, 144},
1001 {
"PaleGreen3", 124, 205, 124},
1002 {
"PaleGreen4", 84, 139, 84},
1003 {
"PaleTurquoise", 175, 238, 238},
1004 {
"PaleTurquoise1", 187, 255, 255},
1005 {
"PaleTurquoise2", 174, 238, 238},
1006 {
"PaleTurquoise3", 150, 205, 205},
1007 {
"PaleTurquoise4", 102, 139, 139},
1008 {
"PaleVioletRed", 219, 112, 147},
1009 {
"PaleVioletRed1", 255, 130, 171},
1010 {
"PaleVioletRed2", 238, 121, 159},
1011 {
"PaleVioletRed3", 205, 104, 137},
1012 {
"PaleVioletRed4", 139, 71, 93},
1013 {
"papaya whip", 255, 239, 213},
1014 {
"PapayaWhip", 255, 239, 213},
1015 {
"peach puff", 255, 218, 185},
1016 {
"PeachPuff", 255, 218, 185},
1017 {
"PeachPuff1", 255, 218, 185},
1018 {
"PeachPuff2", 238, 203, 173},
1019 {
"PeachPuff3", 205, 175, 149},
1020 {
"PeachPuff4", 139, 119, 101},
1021 {
"peru", 205, 133, 63},
1022 {
"pink", 255, 192, 203},
1023 {
"pink1", 255, 181, 197},
1024 {
"pink2", 238, 169, 184},
1025 {
"pink3", 205, 145, 158},
1026 {
"pink4", 139, 99, 108},
1027 {
"plum", 221, 160, 221},
1028 {
"plum1", 255, 187, 255},
1029 {
"plum2", 238, 174, 238},
1030 {
"plum3", 205, 150, 205},
1031 {
"plum4", 139, 102, 139},
1032 {
"powder blue", 176, 224, 230},
1033 {
"PowderBlue", 176, 224, 230},
1034 {
"purple", 160, 32, 240},
1035 {
"purple1", 155, 48, 255},
1036 {
"purple2", 145, 44, 238},
1037 {
"purple3", 125, 38, 205},
1038 {
"purple4", 85, 26, 139},
1040 {
"red1", 255, 0, 0},
1041 {
"red2", 238, 0, 0},
1042 {
"red3", 205, 0, 0},
1043 {
"red4", 139, 0, 0},
1044 {
"rosy brown", 188, 143, 143},
1045 {
"RosyBrown", 188, 143, 143},
1046 {
"RosyBrown1", 255, 193, 193},
1047 {
"RosyBrown2", 238, 180, 180},
1048 {
"RosyBrown3", 205, 155, 155},
1049 {
"RosyBrown4", 139, 105, 105},
1050 {
"royal blue", 65, 105, 225},
1051 {
"RoyalBlue", 65, 105, 225},
1052 {
"RoyalBlue1", 72, 118, 255},
1053 {
"RoyalBlue2", 67, 110, 238},
1054 {
"RoyalBlue3", 58, 95, 205},
1055 {
"RoyalBlue4", 39, 64, 139},
1056 {
"saddle brown", 139, 69, 19},
1057 {
"SaddleBrown", 139, 69, 19},
1058 {
"salmon", 250, 128, 114},
1059 {
"salmon1", 255, 140, 105},
1060 {
"salmon2", 238, 130, 98},
1061 {
"salmon3", 205, 112, 84},
1062 {
"salmon4", 139, 76, 57},
1063 {
"sandy brown", 244, 164, 96},
1064 {
"SandyBrown", 244, 164, 96},
1065 {
"sea green", 46, 139, 87},
1066 {
"SeaGreen", 46, 139, 87},
1067 {
"SeaGreen1", 84, 255, 159},
1068 {
"SeaGreen2", 78, 238, 148},
1069 {
"SeaGreen3", 67, 205, 128},
1070 {
"SeaGreen4", 46, 139, 87},
1071 {
"seashell", 255, 245, 238},
1072 {
"seashell1", 255, 245, 238},
1073 {
"seashell2", 238, 229, 222},
1074 {
"seashell3", 205, 197, 191},
1075 {
"seashell4", 139, 134, 130},
1076 {
"sienna", 160, 82, 45},
1077 {
"sienna1", 255, 130, 71},
1078 {
"sienna2", 238, 121, 66},
1079 {
"sienna3", 205, 104, 57},
1080 {
"sienna4", 139, 71, 38},
1081 {
"sky blue", 135, 206, 235},
1082 {
"SkyBlue", 135, 206, 235},
1083 {
"SkyBlue1", 135, 206, 255},
1084 {
"SkyBlue2", 126, 192, 238},
1085 {
"SkyBlue3", 108, 166, 205},
1086 {
"SkyBlue4", 74, 112, 139},
1087 {
"slate blue", 106, 90, 205},
1088 {
"slate gray", 112, 128, 144},
1089 {
"slate grey", 112, 128, 144},
1090 {
"SlateBlue", 106, 90, 205},
1091 {
"SlateBlue1", 131, 111, 255},
1092 {
"SlateBlue2", 122, 103, 238},
1093 {
"SlateBlue3", 105, 89, 205},
1094 {
"SlateBlue4", 71, 60, 139},
1095 {
"SlateGray", 112, 128, 144},
1096 {
"SlateGray1", 198, 226, 255},
1097 {
"SlateGray2", 185, 211, 238},
1098 {
"SlateGray3", 159, 182, 205},
1099 {
"SlateGray4", 108, 123, 139},
1100 {
"SlateGrey", 112, 128, 144},
1101 {
"snow", 255, 250, 250},
1102 {
"snow1", 255, 250, 250},
1103 {
"snow2", 238, 233, 233},
1104 {
"snow3", 205, 201, 201},
1105 {
"snow4", 139, 137, 137},
1106 {
"spring green", 0, 255, 127},
1107 {
"SpringGreen", 0, 255, 127},
1108 {
"SpringGreen1", 0, 255, 127},
1109 {
"SpringGreen2", 0, 238, 118},
1110 {
"SpringGreen3", 0, 205, 102},
1111 {
"SpringGreen4", 0, 139, 69},
1112 {
"steel blue", 70, 130, 180},
1113 {
"SteelBlue", 70, 130, 180},
1114 {
"SteelBlue1", 99, 184, 255},
1115 {
"SteelBlue2", 92, 172, 238},
1116 {
"SteelBlue3", 79, 148, 205},
1117 {
"SteelBlue4", 54, 100, 139},
1118 {
"tan", 210, 180, 140},
1119 {
"tan1", 255, 165, 79},
1120 {
"tan2", 238, 154, 73},
1121 {
"tan3", 205, 133, 63},
1122 {
"tan4", 139, 90, 43},
1123 {
"thistle", 216, 191, 216},
1124 {
"thistle1", 255, 225, 255},
1125 {
"thistle2", 238, 210, 238},
1126 {
"thistle3", 205, 181, 205},
1127 {
"thistle4", 139, 123, 139},
1128 {
"tomato", 255, 99, 71},
1129 {
"tomato1", 255, 99, 71},
1130 {
"tomato2", 238, 92, 66},
1131 {
"tomato3", 205, 79, 57},
1132 {
"tomato4", 139, 54, 38},
1133 {
"turquoise", 64, 224, 208},
1134 {
"turquoise1", 0, 245, 255},
1135 {
"turquoise2", 0, 229, 238},
1136 {
"turquoise3", 0, 197, 205},
1137 {
"turquoise4", 0, 134, 139},
1138 {
"violet", 238, 130, 238},
1139 {
"violet red", 208, 32, 144},
1140 {
"VioletRed", 208, 32, 144},
1141 {
"VioletRed1", 255, 62, 150},
1142 {
"VioletRed2", 238, 58, 140},
1143 {
"VioletRed3", 205, 50, 120},
1144 {
"VioletRed4", 139, 34, 82},
1145 {
"wheat", 245, 222, 179},
1146 {
"wheat1", 255, 231, 186},
1147 {
"wheat2", 238, 216, 174},
1148 {
"wheat3", 205, 186, 150},
1149 {
"wheat4", 139, 126, 102},
1150 {
"white", 255, 255, 255},
1151 {
"white smoke", 245, 245, 245},
1152 {
"WhiteSmoke", 245, 245, 245},
1153 {
"yellow", 255, 255, 0},
1154 {
"yellow green", 154, 205, 50},
1155 {
"yellow1", 255, 255, 0},
1156 {
"yellow2", 238, 238, 0},
1157 {
"yellow3", 205, 205, 0},
1158 {
"yellow4", 139, 139, 0},
1159 {
"YellowGreen", 154, 205, 50}
1162 #define numXColors (sizeof (xColors) / sizeof (*xColors))
1184 return strcasecmp((
const char *) a, ((
const XColorEntry *) b)->
name);
1196 colorPtr->
red = (found->red * 65535) / 255;
1197 colorPtr->
green = (found->green * 65535) / 255;
1198 colorPtr->
blue = (found->blue * 65535) / 255;
1220 if (spec[0] ==
'#') {
1224 if ((i = strlen(spec + 1)) % 3) {
1229 sprintf(fmt,
"%%%dx%%%dx%%%dx", i, i, i);
1230 if (sscanf(spec + 1, fmt, &red, &green, &blue) != 3) {
1237 }
else if (i == 1) {
1238 colorPtr->
red = (red * 65535) / 15;
1239 colorPtr->
green = (green * 65535) / 15;
1240 colorPtr->
blue = (blue * 65535) / 15;
1241 }
else if (i == 2) {
1242 colorPtr->
red = (red * 65535) / 255;
1243 colorPtr->
green = (green * 65535) / 255;
1244 colorPtr->
blue = (blue * 65535) / 255;
1247 colorPtr->
red = (red * 65535) / 4095;
1248 colorPtr->
green = (green * 65535) / 4095;
1249 colorPtr->
blue = (blue * 65535) / 4095;
1284 private->base.visual = visual;
1285 private->base.ref_count = 1;
1287 private->hash =
NULL;
1288 private->last_sync_time = 0;
1289 private->info =
NULL;
1296 switch (visual->
type) {
1304 private->private_val = private_cmap;
1309 PALETTEENTRY pal[256];
1313 GetPaletteEntries(private->xcolormap->palette, 0,
1314 colormap->
size, pal);
1315 for (i = 0; i < colormap->
size; i++) {
1317 if ((
guint)i >= npal) {
1322 colormap->
colors[i].
red = (pal[i].peRed * 65535) / 255;
1323 colormap->
colors[i].
green = (pal[i].peGreen * 65525) / 255;
1324 colormap->
colors[i].
blue = (pal[i].peBlue * 65535) / 255;
1334 private->private_val =
FALSE;
1363 #define MIN_SYNC_TIME 2
1367 time_t current_time;
1375 current_time = time(
NULL);
1377 && ((current_time - private->last_sync_time) <
MIN_SYNC_TIME))
1380 private->last_sync_time = current_time;
1385 nlookup = GetPaletteEntries(private->xcolormap->palette,
1386 0, colormap->
size, xpalette);
1388 for (i = 0; i < nlookup; i++) {
1390 colormap->
colors[i].
red = (xpalette[i].peRed * 65535) / 255;
1391 colormap->
colors[i].
green = (xpalette[i].peGreen * 65535) / 255;
1392 colormap->
colors[i].
blue = (xpalette[i].peBlue * 65535) / 255;
1395 for (; i < colormap->
size; i++) {
1416 private->private_val =
FALSE;
1417 private->base.ref_count = 1;
1419 private->hash =
NULL;
1420 private->last_sync_time = 0;
1421 private->info =
NULL;
1424 colormap->
size =
private->base.visual->colormap_size;
1446 bitspixel = GetDeviceCaps(
gdk_DC, BITSPIXEL);
1450 else if (bitspixel == 4)
1452 else if (bitspixel == 8)
1454 else if (bitspixel == 12)
1456 else if (bitspixel == 16)
1473 switch (private->base.visual->type) {
1476 for (i = 0; i < ncolors; i++) {
1477 palette[i].peRed = (colormap->
colors[i].
red >> 8);
1478 palette[i].peGreen = (colormap->
colors[i].
green >> 8);
1479 palette[i].peBlue = (colormap->
colors[i].
blue >> 8);
1480 palette[i].peFlags = 0;
1483 if (SetPaletteEntries(private->xcolormap->palette,
1484 0, ncolors, palette) == 0)
1486 private->xcolormap->stale =
TRUE;
1511 planes, nplanes, pixels, npixels);
1514 for (i = 0; i < npixels; i++) {
1515 private->info[pixels[i]].ref_count++;
1520 return return_val != 0;
1558 for (i = 0; i < in_npixels; i++) {
1559 gulong pixel = in_pixels[i];
1561 if (private->info[pixel].ref_count) {
1562 private->info[pixel].ref_count--;
1564 if (private->info[pixel].ref_count == 0) {
1565 pixels[npixels++] = pixel;
1568 &colormap->
colors[pixel]);
1569 private->info[pixel].flags = 0;
1575 free_colors(private->xcolormap, pixels, npixels, planes);
1603 for (i = 0; i < ncolors; i++) {
1606 if (private->info[pixel].ref_count) {
1607 private->info[pixel].ref_count--;
1609 if (private->info[pixel].ref_count == 0) {
1610 pixels[npixels++] = pixel;
1613 &colormap->
colors[pixel]);
1614 private->info[pixel].flags = 0;
1619 free_colors(private->xcolormap, pixels, npixels, 0);
1639 xcolor.peRed = color->
red >> 8;
1640 xcolor.peGreen = color->
green >> 8;
1641 xcolor.peBlue = color->
blue >> 8;
1644 ret->
red = (xcolor.peRed * 65535) / 255;
1645 ret->
green = (xcolor.peGreen * 65535) / 255;
1646 ret->
blue = (xcolor.peBlue * 65535) / 255;
1649 if (private->info[ret->
pixel].ref_count) {
1653 private->info[ret->
pixel].ref_count = 1;
1681 if (private->private_val) {
1683 for (i = 0; i < ncolors; i++) {
1684 while ((index < colormap->size)
1685 && (
private->info[index].ref_count != 0))
1688 if (index < colormap->size) {
1689 colors[i].
pixel = index;
1691 private->info[index].ref_count++;
1702 0, pixels, ncolors);
1704 for (i = 0; i < ncolors; i++) {
1705 colors[i].
pixel = pixels[i];
1706 private->info[pixels[i]].ref_count++;
1713 return status ? ncolors : 0;
1728 gint nremaining = 0;
1736 for (i = 0; i < ncolors; i++) {
1738 while ((index < colormap->size)
1739 && (
private->info[index].ref_count != 0))
1742 if (index < colormap->size) {
1743 store[nstore].peRed = colors[i].
red >> 8;
1744 store[nstore].peBlue = colors[i].
blue >> 8;
1745 store[nstore].peGreen = colors[i].
green >> 8;
1750 colors[i].
pixel = index;
1751 private->info[index].ref_count++;
1757 if (SetPaletteEntries(private->xcolormap->palette,
1758 0, nstore, store) == 0)
1760 private->xcolormap->stale =
TRUE;
1764 if (nremaining > 0 && best_match) {
1768 for (i = 0; i < colormap->
size; i++)
1769 available[i] =
TRUE;
1771 for (i = 0; i < ncolors; i++) {
1774 &colors[i], available);
1776 colors[i] = colormap->
colors[index];
1777 private->info[index].ref_count++;
1787 return (ncolors - nremaining);
1799 gint nremaining = 0;
1805 for (i = 0; i < ncolors; i++) {
1815 if (nremaining > 0 && best_match) {
1817 for (i = 0; i < colormap->
size; i++)
1818 available[i] = ((private->info[i].ref_count == 0) ||
1822 while (nremaining > 0) {
1823 for (i = 0; i < ncolors; i++) {
1829 if (private->info[index].ref_count) {
1830 private->info[index].ref_count++;
1831 colors[i] = colormap->
colors[index];
1836 &colormap->
colors[index],
1842 available[index] =
FALSE;
1858 for (i = 0; i < ncolors; i++)
1859 if (success[i] == 2)
1861 nremaining = nfailed;
1864 return (ncolors - nremaining);
1878 gint nremaining = 0;
1884 for (i = 0; i < ncolors; i++) {
1888 private->info[lookup_color->
pixel].ref_count++;
1899 if (nremaining > 0) {
1900 if (private->private_val)
1903 best_match, success);
1906 writable, best_match,
1922 gint nremaining = 0;
1930 for (i = 0; i < ncolors; i++) {
1934 switch (private->base.visual->type) {
1940 best_match, success);
1944 best_match, success);
1948 visual =
private->base.visual;
1950 for (i = 0; i < ncolors; i++) {
1952 (((colors[i].
red >> (16 - visual->
red_prec)) << visual->
1964 for (i = 0; i < ncolors; i++) {
1965 xcolor.peRed = colors[i].
red >> 8;
1966 xcolor.peGreen = colors[i].
green >> 8;
1967 xcolor.peBlue = colors[i].
blue >> 8;
1988 xcolor.peRed = color->
red >> 8;
1989 xcolor.peGreen = color->
green >> 8;
1990 xcolor.peBlue = color->
blue >> 8;
1992 if (SetPaletteEntries(private->xcolormap->palette,
1993 color->
pixel, 1, &xcolor) == 0)
1995 private->xcolormap->stale =
TRUE;
2006 gint rdiff, gdiff, bdiff;
2016 for (i = 0; i < cmap->
size; i++) {
2017 if ((!available) || (available && available[i])) {
2018 rdiff = (color->
red - colors[i].
red);
2020 bdiff = (color->
blue - colors[i].
blue);
2022 sum =
ABS(rdiff) +
ABS(gdiff) +
ABS(bdiff);
2073 return (
guint) * cmap;
2081 #ifdef G_ENABLE_DEBUG
2085 static char buf[100];
2087 sprintf(buf,
"(%.04x,%.04x,%.04x):%.06x",
static void gdk_colormap_remove(GdkColormap *cmap)
static GHashTable * colormap_hash
static Colormap default_colormap()
static gint gdk_colormap_alloc_colors_private(GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writable, gboolean best_match, gboolean *success)
struct ColormapStruct * Colormap
gint gdk_colormap_alloc_colors(GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writable, gboolean best_match, gboolean *success)
gboolean gdk_color_parse(const gchar *spec, GdkColor *color)
GHashTable * g_hash_table_new(GHashFunc hash_func, GEqualFunc key_equal_func)
g_hash_table_new: : a function to create a hash value from a key.
void gdk_colormap_free_colors(GdkColormap *colormap, GdkColor *colors, gint ncolors)
#define g_return_val_if_fail(expr, val)
void gdk_colormap_sync(GdkColormap *colormap, gboolean force)
void g_hash_table_destroy(GHashTable *hash_table)
g_hash_table_destroy: : a GHashTable.
static int alloc_color(Colormap colormap, XColor *color, gulong *pixelp)
static guint gdk_colormap_hash(Colormap *cmap)
static gint gdk_colormap_alloc_colors_shared(GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writable, gboolean best_match, gboolean *success)
guint(* GHashFunc)(gconstpointer key)
static XColorEntry xColors[]
static int compare_xcolor_entries(const void *a, const void *b)
void g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value)
g_hash_table_insert: : a GHashTable.
G_BEGIN_DECLS typedef char gchar
gboolean gdk_colors_alloc(GdkColormap *colormap, gint contiguous, gulong *planes, gint nplanes, gulong *pixels, gint npixels)
gboolean g_hash_table_remove(GHashTable *hash_table, gconstpointer key)
g_hash_table_remove: : a GHashTable.
static int FindColor(const char *name, GdkColor *colorPtr)
GdkColormap * gdk_colormap_lookup(Colormap xcolormap)
gint(* GCompareFunc)(gconstpointer a, gconstpointer b)
static void gdk_colormap_add(GdkColormap *cmap)
#define g_return_if_fail(expr)
static Status alloc_color_cells(Colormap colormap, gboolean contig, unsigned long plane_masks_return[], unsigned int nplanes, unsigned long pixels_return[], unsigned int npixels)
GdkColormap * gdk_colormap_get_system(void)
#define g_new(struct_type, n_structs)
#define g_new0(struct_type, n_structs)
typedefG_BEGIN_DECLS struct _GHashTable GHashTable
static void g_error(const gchar *format,...)
gboolean gdk_color_change(GdkColormap *colormap, GdkColor *color)
static void free_colors(Colormap colormap, gulong *pixels, gint npixels, gulong planes)
#define WIN32_GDI_FAILED(api)
void g_free(gpointer mem)
static void free_colormap(Colormap colormap)
GdkVisual * gdk_visual_get_system(void)
GdkColormap * gdk_colormap_new(GdkVisual *visual, gint private_cmap)
void gdk_colors_free(GdkColormap *colormap, gulong *in_pixels, gint in_npixels, gulong planes)
static gboolean gdk_colormap_alloc1(GdkColormap *colormap, GdkColor *color, GdkColor *ret)
gboolean gdk_color_equal(const GdkColor *colora, const GdkColor *colorb)
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
static gint gdk_colormap_alloc_colors_writable(GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writable, gboolean best_match, gboolean *success)
static void g_warning(const gchar *format,...)
static Colormap create_colormap(HWND w, Visual *visual, gboolean alloc)
guint gdk_color_hash(const GdkColor *colora)
gboolean parse_color(Colormap map, const char *spec, GdkColor *colorPtr)
void gdk_colormap_change(GdkColormap *colormap, gint ncolors)
gint gdk_colormap_get_system_size(void)
gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
g_hash_table_lookup: : a GHashTable.
static gint gdk_colormap_alloc_colors_pseudocolor(GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writable, gboolean best_match, gboolean *success)
void g_print(const gchar *format,...)
void _gdk_colormap_real_destroy(GdkColormap *colormap)
static gint gdk_colormap_match_color(GdkColormap *cmap, GdkColor *color, const gchar *available)
static gint gdk_colormap_cmp(Colormap *a, Colormap *b)