After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 97732 - using dot line for opened mine
using dot line for opened mine
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: gnomine
2.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Games maintainers
Gregory Leblanc
: 103343 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-11-05 14:10 UTC by Feiyun Wang
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
screenshot of the dot_line patch (12.88 KB, image/png)
2002-11-07 13:01 UTC, Feiyun Wang
Details

Description Feiyun Wang 2002-11-05 14:10:47 UTC
Description of Problem:
This is a UI enhancement request.
I have some trouble to distinguish opened mine
(without number in it) from untouched mine,
especially in big minefield.
I suggest using dot line instead of solid line to
draw all opened mines.

Additional Information:
Index: minefield.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gnomine/minefield.c,v
retrieving revision 1.34
diff -r1.34 minefield.c
259a260,278
> static void gtk_mine_draw_dot_line(GdkDrawable
*drawable, GdkGC *gc,
>               gint x1, gint y1, gint x2, gint y2)
> {
>       gint x, y;
>
>       if (y1==y2) {           /* vertical */
>               for (x=x1; x<x2; x+=2) {
>                       gdk_draw_point(drawable,
gc, x, y1);
>               }
>               return;
>       } else if (x1==x2) {    /* horizontal */
>               for (y=y1; y<y2; y+=2) {
>                       gdk_draw_point(drawable,
gc, x1, y);
>               }
>       } else {
>               /* oops, this should never happen! */
>       }
> }
>
282c301
<                      
gdk_draw_line(widget->window,   /* top */
---
>                      
gtk_mine_draw_dot_line(widget->window,  /* top */
290c309
<                      
gdk_draw_line(widget->window,   /* left */
---
>                      
gtk_mine_draw_dot_line(widget->window,  /* left */
297c316
<               gdk_draw_line(widget->window,   /*
right */
---
>              
gtk_mine_draw_dot_line(widget->window,  /* right */
303c322
<               gdk_draw_line(widget->window,   /*
bottom */
---
>              
gtk_mine_draw_dot_line(widget->window,  /* bottom */

I have tested the above patch in Redhat 8.0.
Comment 1 Feiyun Wang 2002-11-06 12:27:31 UTC
not a good patch. Better use gdk_draw_points(). :) 
Comment 2 Giles Hamlin 2002-11-07 09:42:30 UTC
This is a fair comment - with aa fonts enabled, it is quite hard to
tell the difference between ground that has yet to be sweeped, and
ground that has been sweeped but is just empty (ie: it has neither a
number indicating the proximity of a mine, or a flag indicating a mine).
Comment 3 Giles Hamlin 2002-11-07 09:49:23 UTC
A quick thought - shouldn't ground that has been uncovered, but is
empty be shaded a slightly darker grey, to give the visual impression
of uncovered ground?

http://www.mat.bham.ac.uk/R.W.Kaye/minesw/fig3.gif shows how windoze
deals with this - uncovered tiles do not have white 3D shading giving
a depth illusion and making uncovered tiles appear a darker color.
Comment 4 Feiyun Wang 2002-11-07 12:13:25 UTC
To be fair, I think the look of windoze minesweeper will be OK.
Be ware that the comments (horizontal/vertical) in the previous patch
is wrong.
Here is the new gtk_mine_draw_dot_line() using gdk_draw_points().
static void gtk_mine_draw_dot_line(GdkDrawable *drawable, GdkGC *gc,
                gint x1, gint y1, gint x2, gint y2)
{
        gint n, i;
        GdkPoint *points;

        if (y1==y2) {           /* horizontal */
                n = (x2-x1)/2+1;
                points = malloc(sizeof(*points)*n);
                if (!points) return;
                for (i=0; i<n; i++) {
                        points[i].x = x1;
                        points[i].y = y1;
                        x1 += 2;
                }
                return;
        } else if (x1==x2) {    /* vertical */
                n = (y2-y1)/2+1;
                points = malloc(sizeof(*points)*n);
                if (!points) return;
                for (i=0; i<n; i++) {
                        points[i].x = x1;
                        points[i].y = y1;
                        y1 += 2;
                }
        } else {
                return; /* oops, this should never happen! */
        }
        gdk_draw_points(drawable, gc, points, n);
        free(points);
}
Comment 5 Feiyun Wang 2002-11-07 12:19:16 UTC
Sorry, bug in the previous function:
should remove "return;" before "} else if (x1==x2) {    /* vertical */".
Comment 6 Giles Hamlin 2002-11-07 12:37:27 UTC
As per the terms of my degree course, I'm stuck in Windows XP hell 
right now - can somebody please check out the patch, and is it 
possible to post up a screenshot of the patch in action?
Comment 7 Feiyun Wang 2002-11-07 13:01:15 UTC
Created attachment 12124 [details]
screenshot of the dot_line patch
Comment 8 Giles Hamlin 2002-11-07 15:59:11 UTC
That's certainly an improvement :)  Is it possible to thicken the 
borders a little bit to get a slightly more "3D" effect?
Comment 9 Ross Burton 2002-11-07 16:08:06 UTC
These patches just missed the GNOME 2.2 feature freeze, hopefully we
can get something sorted for 2.4 though.
Comment 10 Jonathan Blandford 2002-11-07 16:34:40 UTC
Actually, I think this patch should be fine for the feature freeze. 
This is more along the lines of a bug fix or cleanup.  Ross, feel free
to commit if you feel it's necessary.
Comment 11 Ross Burton 2002-11-07 16:38:49 UTC
Cool, I'll do this tonight then I hope.
Comment 12 Jonathan Blandford 2002-11-07 17:00:13 UTC
Hrm.  Now that I look at the code, I think it should be cleaned up a
bit.  Some comments:
 * In general, you should use g_malloc/g_free in GNOME code.
 * A better way to draw the points would be to use a stipple on the gc.
You can do something like (untested code):

#define stipple_width 2
#define stipple_height 2
static char stipple_data[] = { 0x02, 0x01, };

static GdkPixmap *stipple = NULL;

if (stipple == NULL) {
	stipple = gdk_bitmap_create_from_data (NULL,
					       stipple_data,
					       stipple_width,
					       stipple_height);
}

gdk_gc_set_stipple (gc, stipple);
gdk_gc_set_fill (gc, GDK_STIPPLED);
gdk_draw_line (...);
gdk_gc_set_stipple (gc, NULL);
gdk_gc_set_fill (gc, GDK_SOLID);

to do this.
Comment 13 Callum McKenzie 2003-05-12 09:38:45 UTC
I've just applied this suggestion to CVS (should be out in 2.3.2). I
used Jonathans stipple suggestion for the actual code, although I had
to use an even coarser dash to make it look right (the lighter look
from a one-pixel dot still didn't work for some themes). It now looks
right using all the themes shipped with gnome, judging by the
improvements I don't think there should be any trouble with other
themes. Amusingly the "high contrast" theme was the worst for showing
no contrast.

Closing.
Comment 14 Callum McKenzie 2003-05-12 09:45:36 UTC
*** Bug 103343 has been marked as a duplicate of this bug. ***