another try to fix the grid plug-in

--Sven
This commit is contained in:
Sven Neumann 2000-02-20 19:34:51 +00:00
parent 737a8e2fc5
commit d230a0e0e9
2 changed files with 37 additions and 22 deletions

View File

@ -1,3 +1,7 @@
Sun Feb 20 20:34:40 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/common/grid.c: hopefully got it right this time
Sun Feb 20 18:40:34 CET 2000 Marc Lehmann <pcg@goof.com>
* app/fileops.c: Fix setting of filename on Save As (the filename
@ -10,7 +14,6 @@ Sun Feb 20 10:46:00 CST 2000 Seth Burgess <sjburges@gimp.org>
it work right for positioning image as well, but I fear
this may be WM dependant. Please let me know if things
hang of the edges for you... (Fixes #6257)
Sun Feb 20 03:46:12 CET 2000 Sven Neumann <sven@gimp.org>

View File

@ -274,6 +274,7 @@ doit (GDrawable * drawable)
{
GPixelRgn srcPR, destPR;
gint width, height, bytes;
gint x_offset, y_offset;
guchar *dest;
gint x, y, alpha;
@ -296,44 +297,55 @@ doit (GDrawable * drawable)
{
gimp_pixel_rgn_get_row (&srcPR, dest, sx1, y, (sx2-sx1));
if ( abs ((y - grid_cfg.voffset) % grid_cfg.vspace) < grid_cfg.vwidth )
{ /* Draw row */
y_offset = grid_cfg.vspace + y - grid_cfg.voffset;
if ((y_offset + (grid_cfg.vwidth / 2)) % grid_cfg.vspace < grid_cfg.vwidth)
{
for (x = sx1; x < sx2; x++)
{
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.hcolor, bytes, alpha);
pix_composite (&dest[(x-sx1) * bytes], grid_cfg.hcolor, bytes, alpha);
}
}
if ( abs ((y - grid_cfg.voffset + ((grid_cfg.iwidth - grid_cfg.vwidth) / 2)) % grid_cfg.vspace)
< grid_cfg.iwidth )
{ /* Draw irow */
if ((y_offset + (grid_cfg.iwidth / 2)) % grid_cfg.vspace < grid_cfg.iwidth)
{
for (x = sx1; x < sx2; x++)
{
if (( abs ((x - grid_cfg.hoffset - (grid_cfg.hwidth / 2)) % grid_cfg.hspace) >= grid_cfg.ispace
&& ( abs (x - grid_cfg.hoffset - (grid_cfg.hwidth / 2)) % grid_cfg.hspace) < grid_cfg.ioffset)
|| (abs (((x - grid_cfg.hoffset - (grid_cfg.hwidth / 2)) % grid_cfg.hspace) - grid_cfg.hspace) >= grid_cfg.ispace
&& (abs (((x - grid_cfg.hoffset - (grid_cfg.hwidth / 2)) % grid_cfg.hspace) - grid_cfg.hspace) < grid_cfg.ioffset))) {
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
x_offset = grid_cfg.hspace + x - grid_cfg.hoffset;
if ((x_offset % grid_cfg.hspace >= grid_cfg.ispace
&&
x_offset % grid_cfg.hspace < grid_cfg.ioffset)
||
(grid_cfg.hspace - (x_offset % grid_cfg.hspace) >= grid_cfg.ispace
&&
grid_cfg.hspace - (x_offset % grid_cfg.hspace) < grid_cfg.ioffset))
{
pix_composite (&dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
}
}
}
for (x = sx1; x < sx2; x++)
{
if (abs ((x - grid_cfg.hoffset) % grid_cfg.hspace) < grid_cfg.hwidth)
x_offset = grid_cfg.hspace + x - grid_cfg.hoffset;
if ((x_offset + (grid_cfg.hwidth / 2)) % grid_cfg.hspace < grid_cfg.hwidth)
{
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.vcolor, bytes, alpha);
pix_composite (&dest[(x-sx1) * bytes], grid_cfg.vcolor, bytes, alpha);
}
if (abs (((x - grid_cfg.hoffset + ((grid_cfg.iwidth - grid_cfg.hwidth) / 2)) % grid_cfg.hspace) < grid_cfg.iwidth)
&& (( (abs ((y - grid_cfg.voffset - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) >= grid_cfg.ispace)
&& (abs ((y - grid_cfg.voffset - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) < grid_cfg.ioffset))
|| (( (abs (((y - grid_cfg.voffset - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) - grid_cfg.vspace) >= grid_cfg.ispace)
&& (abs (((y - grid_cfg.voffset - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) - grid_cfg.vspace) < grid_cfg.ioffset))
))
)
if ((x_offset + (grid_cfg.iwidth / 2)) % grid_cfg.hspace < grid_cfg.iwidth
&&
((y_offset % grid_cfg.vspace >= grid_cfg.ispace
&&
y_offset % grid_cfg.vspace < grid_cfg.ioffset)
||
(grid_cfg.vspace - (y_offset % grid_cfg.vspace) >= grid_cfg.ispace
&&
grid_cfg.vspace - (y_offset % grid_cfg.vspace) < grid_cfg.ioffset)))
{
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
pix_composite (&dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
}
}