123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- #include "sys-defines.h"
- #include "extern.h"
- void
- _pl_a_set_pen_color(S___(Plotter *_plotter))
- {
- double red, green, blue;
- double cyan, magenta, yellow, black, temp;
-
- red = ((double)((_plotter->drawstate->fgcolor).red))/0xFFFF;
- green = ((double)((_plotter->drawstate->fgcolor).green))/0xFFFF;
- blue = ((double)((_plotter->drawstate->fgcolor).blue))/0xFFFF;
- cyan = 1.0 - red;
- magenta = 1.0 - green;
- yellow = 1.0 - blue;
- temp = magenta < yellow ? magenta : yellow;
- black = cyan < temp ? cyan : temp;
- cyan -= black;
- magenta -= black;
- yellow -= black;
- if ((_plotter->ai_pen_cyan != cyan)
- || (_plotter->ai_pen_magenta != magenta)
- || (_plotter->ai_pen_yellow != yellow)
- || (_plotter->ai_pen_black != black))
-
- {
- sprintf (_plotter->data->page->point, "%.4f %.4f %.4f %.4f K\n",
- cyan, magenta, yellow, black);
- _update_buffer (_plotter->data->page);
- _plotter->ai_pen_cyan = cyan;
- _plotter->ai_pen_magenta = magenta;
- _plotter->ai_pen_yellow = yellow;
- _plotter->ai_pen_black = black;
- }
-
-
- if (_plotter->ai_pen_cyan > 0.0)
- _plotter->ai_cyan_used = true;
- if (_plotter->ai_pen_magenta > 0.0)
- _plotter->ai_magenta_used = true;
- if (_plotter->ai_pen_yellow > 0.0)
- _plotter->ai_yellow_used = true;
- if (_plotter->ai_pen_black > 0.0)
- _plotter->ai_black_used = true;
- }
- void
- _pl_a_set_fill_color(R___(Plotter *_plotter) bool force_pen_color)
- {
- double red, green, blue;
- double cyan, magenta, yellow, black, temp;
- if (force_pen_color == false && _plotter->drawstate->fill_type == 0)
-
- return;
-
- if (force_pen_color)
- {
- red = ((double)((_plotter->drawstate->fgcolor).red))/0xFFFF;
- green = ((double)((_plotter->drawstate->fgcolor).green))/0xFFFF;
- blue = ((double)((_plotter->drawstate->fgcolor).blue))/0xFFFF;
- }
- else
- {
- red = ((double)((_plotter->drawstate->fillcolor).red))/0xFFFF;
- green = ((double)((_plotter->drawstate->fillcolor).green))/0xFFFF;
- blue = ((double)((_plotter->drawstate->fillcolor).blue))/0xFFFF;
- }
-
- cyan = 1.0 - red;
- magenta = 1.0 - green;
- yellow = 1.0 - blue;
- temp = magenta < yellow ? magenta : yellow;
- black = cyan < temp ? cyan : temp;
- cyan -= black;
- magenta -= black;
- yellow -= black;
- if ((_plotter->ai_fill_cyan != cyan)
- || (_plotter->ai_fill_magenta != magenta)
- || (_plotter->ai_fill_yellow != yellow)
- || (_plotter->ai_fill_black != black))
-
- {
- sprintf (_plotter->data->page->point, "%.4f %.4f %.4f %.4f k\n",
- cyan, magenta, yellow, black);
- _update_buffer (_plotter->data->page);
- _plotter->ai_fill_cyan = cyan;
- _plotter->ai_fill_magenta = magenta;
- _plotter->ai_fill_yellow = yellow;
- _plotter->ai_fill_black = black;
- }
-
-
- if (_plotter->ai_fill_cyan > 0.0)
- _plotter->ai_cyan_used = true;
- if (_plotter->ai_fill_magenta > 0.0)
- _plotter->ai_magenta_used = true;
- if (_plotter->ai_fill_yellow > 0.0)
- _plotter->ai_yellow_used = true;
- if (_plotter->ai_fill_black > 0.0)
- _plotter->ai_black_used = true;
- }
|