Changeset 1877
- Timestamp:
- Nov 4, 2007, 11:41:07 AM (15 years ago)
- Location:
- libcaca/trunk/cucul
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/cucul.h
r1870 r1877 216 216 int cucul_set_dither_antialias(cucul_dither_t *, char const *); 217 217 char const * const * cucul_get_dither_antialias_list(cucul_dither_t const *); 218 char const * cucul_get_dither_antialias(cucul_dither_t const *); 218 219 int cucul_set_dither_color(cucul_dither_t *, char const *); 219 220 char const * const * cucul_get_dither_color_list(cucul_dither_t const *); 221 char const * cucul_get_dither_color(cucul_dither_t const *); 220 222 int cucul_set_dither_charset(cucul_dither_t *, char const *); 221 223 char const * const * cucul_get_dither_charset_list(cucul_dither_t const *); -
libcaca/trunk/cucul/dither.c
r1876 r1877 132 132 133 133 /* Bitmap features */ 134 int invert, antialias; 135 136 /* Colour mode used for rendering */ 137 enum color_mode color_mode; 134 struct 135 { 136 char const *name; 137 int value; 138 } 139 antialias, color; 140 int invert; 138 141 139 142 /* Glyphs used for rendering */ … … 337 340 338 341 /* Default features */ 342 d->antialias.name = "prefilter"; 343 d->antialias.value = 1; 344 d->color.name = "full16"; 345 d->color.value = COLOR_MODE_FULL16; 339 346 d->invert = 0; 340 d->antialias = 1;341 342 /* Default colour mode */343 d->color_mode = COLOR_MODE_FULL16;344 347 345 348 /* Default character set */ … … 546 549 { 547 550 if(!strcasecmp(str, "none")) 548 d->antialias = 0; 551 { 552 d->antialias.name = "none"; 553 d->antialias.value = 0; 554 } 549 555 else if(!strcasecmp(str, "prefilter") || !strcasecmp(str, "default")) 550 d->antialias = 1; 556 { 557 d->antialias.name = "prefilter"; 558 d->antialias.value = 1; 559 } 551 560 else 552 561 { … … 582 591 583 592 return list; 593 } 594 595 /** \brief Get current antialiasing method 596 * 597 * Return the given dither's current antialiasing method. 598 * 599 * This function never fails. 600 * 601 * \param d Dither object. 602 * \return A static string. 603 */ 604 char const * cucul_get_dither_antialias(cucul_dither_t const *d) 605 { 606 return d->antialias.name; 584 607 } 585 608 … … 610 633 { 611 634 if(!strcasecmp(str, "mono")) 612 d->color_mode = COLOR_MODE_MONO; 635 { 636 d->color.name = "mono"; 637 d->color.value = COLOR_MODE_MONO; 638 } 613 639 else if(!strcasecmp(str, "gray")) 614 d->color_mode = COLOR_MODE_GRAY; 640 { 641 d->color.name = "gray"; 642 d->color.value = COLOR_MODE_GRAY; 643 } 615 644 else if(!strcasecmp(str, "8")) 616 d->color_mode = COLOR_MODE_8; 645 { 646 d->color.name = "8"; 647 d->color.value = COLOR_MODE_8; 648 } 617 649 else if(!strcasecmp(str, "16")) 618 d->color_mode = COLOR_MODE_16; 650 { 651 d->color.name = "16"; 652 d->color.value = COLOR_MODE_16; 653 } 619 654 else if(!strcasecmp(str, "fullgray")) 620 d->color_mode = COLOR_MODE_FULLGRAY; 655 { 656 d->color.name = "fullgray"; 657 d->color.value = COLOR_MODE_FULLGRAY; 658 } 621 659 else if(!strcasecmp(str, "full8")) 622 d->color_mode = COLOR_MODE_FULL8; 660 { 661 d->color.name = "full8"; 662 d->color.value = COLOR_MODE_FULL8; 663 } 623 664 else if(!strcasecmp(str, "full16") || !strcasecmp(str, "default")) 624 d->color_mode = COLOR_MODE_FULL16; 665 { 666 d->color.name = "full16"; 667 d->color.value = COLOR_MODE_FULL16; 668 } 625 669 else 626 670 { … … 663 707 } 664 708 709 /** \brief Get current colour mode 710 * 711 * Return the given dither's current colour mode. 712 * 713 * This function never fails. 714 * 715 * \param d Dither object. 716 * \return A static string. 717 */ 718 char const * cucul_get_dither_color(cucul_dither_t const *d) 719 { 720 return d->color.name; 721 } 722 665 723 /** \brief Choose characters used for dithering 666 724 * … … 901 959 902 960 /* First get RGB */ 903 if(d->antialias )961 if(d->antialias.value) 904 962 { 905 963 fromx = (x - x1) * w / deltax; … … 984 1042 985 1043 /* FIXME: we currently only honour "full16" */ 986 if(d->color _mode == COLOR_MODE_FULL16)1044 if(d->color.value == COLOR_MODE_FULL16) 987 1045 { 988 1046 distmin = INT_MAX;
Note: See TracChangeset
for help on using the changeset viewer.