Improved 'New' and 'Open' interfaces. ('Open' dialog no longer includes

Starter images; 'New' now brings up a selection dialog showing 'Starter'
images and color choices.)
New images can be given solid background colors (which the 'Eraser' tool
erases to).
Improved --usage output.
Added support for "--papersize help" to list papersizes available via libpaper.
Some Magic tools that apply an affect once per click-and-drag no longer
recalculate the effect on pixels that have already been affected (until mouse
button is released and clicked again).
This commit is contained in:
William Kendrick 2007-07-24 18:20:17 +00:00
parent cd17a10a32
commit 6e827f67fe
9 changed files with 1280 additions and 296 deletions

View file

@ -120,8 +120,10 @@ void blocks_chalk_drip_linecb(void * ptr, int which,
x = (x / 4) * 4;
y = (y / 4) * 4;
for (yy = y - 8; yy < y + 8; yy = yy + 4)
if (!api->touched(x, y))
{
for (yy = y - 8; yy < y + 8; yy = yy + 4)
{
for (xx = x - 8; xx < x + 8; xx = xx + 4)
{
Uint32 pix[16];
@ -167,6 +169,7 @@ void blocks_chalk_drip_linecb(void * ptr, int which,
SDL_FillRect(canvas, &dest, SDL_MapRGB(canvas->format, r, g, b));
}
}
}
}
else if (which == TOOL_CHALK)

View file

@ -73,24 +73,27 @@ void do_emboss(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
{
if (api->in_circle(xx, yy, 16))
{
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r1, &g1, &b1);
SDL_GetRGB(api->getpixel(last, x + xx + 2, y + yy + 2), last->format, &r2, &g2, &b2);
if (!api->touched(x + xx, y + yy))
{
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r1, &g1, &b1);
SDL_GetRGB(api->getpixel(last, x + xx + 2, y + yy + 2), last->format, &r2, &g2, &b2);
avg1 = (r1 + g1 + b1) / 3;
avg2 = (r2 + g2 + b2) / 3;
avg1 = (r1 + g1 + b1) / 3;
avg2 = (r2 + g2 + b2) / 3;
api->rgbtohsv(r1, g1, b1, &h, &s, &v);
api->rgbtohsv(r1, g1, b1, &h, &s, &v);
r = 128 + (((avg1 - avg2) * 3) / 2);
if (r < 0) r = 0;
if (r > 255) r = 255;
g = b = r;
r = 128 + (((avg1 - avg2) * 3) / 2);
if (r < 0) r = 0;
if (r > 255) r = 255;
g = b = r;
v = (r / 255.0);
v = (r / 255.0);
api->hsvtorgb(h, s, v, &r1, &g1, &b1);
api->hsvtorgb(h, s, v, &r1, &g1, &b1);
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format, r1, g1, b1));
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format, r1, g1, b1));
}
}
}
}

View file

@ -93,7 +93,8 @@ void do_fade_darken(void * ptr, int which,
{
for (xx = x - 16; xx < x + 16; xx++)
{
if (api->in_circle(xx - x, yy - y, 16))
if (api->in_circle(xx - x, yy - y, 16) &&
!api->touched(xx, yy))
{
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);

View file

@ -91,6 +91,9 @@ void do_glasstile(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * las
x = ((x / (GT_SIZE * 2)) * (GT_SIZE * 2)) + (GT_SIZE / 2);
y = ((y / (GT_SIZE * 2)) * (GT_SIZE * 2)) + (GT_SIZE / 2);
if (api->touched(x, y))
return;
/* Apply the effect: */

View file

@ -75,19 +75,22 @@ void do_tint(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
{
if (api->in_circle(xx - x, yy - y, 16))
{
/* Get original pixel: */
if (!api->touched(xx, yy))
{
/* Get original pixel: */
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);
old = api->sRGB_to_linear(r) * 0.2126 +
api->sRGB_to_linear(g) * 0.7152 +
api->sRGB_to_linear(b) * 0.0722;
old = api->sRGB_to_linear(r) * 0.2126 +
api->sRGB_to_linear(g) * 0.7152 +
api->sRGB_to_linear(b) * 0.0722;
api->putpixel(canvas, xx, yy,
api->putpixel(canvas, xx, yy,
SDL_MapRGB(canvas->format,
api->linear_to_sRGB(rd * old),
api->linear_to_sRGB(gd * old),
api->linear_to_sRGB(bd * old)));
}
}
}
}