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 300503 - Ugly looking brick graphics.
Ugly looking brick graphics.
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: quadrapassel
2.10.x
Other All
: Normal enhancement
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2005-04-13 13:54 UTC by Milosz Tanski
Modified: 2012-01-31 23:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
SVG replacement for Graeme Worthy's PNG theme (2.23 KB, image/svg+xml)
2005-07-12 04:08 UTC, Richard Hoelscher
  Details
tetrinet-style theme (6.20 KB, image/svg+xml)
2005-07-12 04:10 UTC, Richard Hoelscher
  Details
patch for implementing nicer-looking gnometris theme in cairo (8.91 KB, patch)
2007-08-09 03:31 UTC, Scott Percival
committed Details | Review
fixes tango theme to work with the "show where block will land" feature (7.02 KB, patch)
2007-08-10 00:55 UTC, Scott Percival
committed Details | Review

Description Milosz Tanski 2005-04-13 13:54:39 UTC
Get the guy who did the ball design for the "Five or More", to create nice
bricks, that have a similar look to "Five or More" balls, it would improve the
consistency accross the gnome games. And using svg, would alow us to make our
tetris board, as small and as large as needed.

Other information:
Comment 1 Lionel Dricot 2005-04-13 14:43:06 UTC
I like the current one but I think SVG graphics would be perhaps better.
I confirm this bug as "New" but feel free to close it as "WONTFIX" if it's a
mistake.
Comment 2 Richard Hoelscher 2005-04-13 15:06:50 UTC
I've already got SVG replacements for Graeme Worthy's blocks, and a
tetrinet-inspired set of SVG blocks. I'll probably go ahead and upload them
before getting a new drawing system ready for gnometris just to close this bug.
Comment 3 Callum McKenzie 2005-04-13 23:22:00 UTC
I should point out that the guy who did the default theme for Five or More is 
also the guy who did the botched job on the same-gnome balls theme :).
Admittedly Richard cleaned up my Five or More theme.
Comment 4 Richard Hoelscher 2005-07-12 04:08:02 UTC
Created attachment 48996 [details]
SVG replacement for Graeme Worthy's PNG theme
Comment 5 Richard Hoelscher 2005-07-12 04:10:01 UTC
Created attachment 48997 [details]
tetrinet-style theme
Comment 6 Richard Hoelscher 2005-07-12 04:13:04 UTC
Comment on attachment 48996 [details]
SVG replacement for Graeme Worthy's PNG theme

I was holding on to these themes until finding a way to replace canvas in
gnometris, but since that didn't happen this cycle, I'm moving theme here. No
big rush on commiting these, I'd rather go ahead and make gnometris scalable
(the usual gnome-games way) first.

If there's a way to make gnometris blocks look like glines balls, I'm not the
man to do it. ;)
Comment 7 Jochen Eppler 2006-01-05 13:49:13 UTC
The new 2.13.3 blocks look really bad...
Are this just some first-get-it-workin' blocks or will they stay like this in
the 2.14 release?

Also I experience a very unpleasant delay and elongation of keypresses that
makes gnometris unplayable in levels > 11. If I want to push one block to the
right, for example, at least the next four blocks follow without me intending
this...
Comment 8 Callum McKenzie 2006-01-06 03:54:43 UTC
The current gnometris code is very experimental. How much it changes before 2.14 will be a matter of how much time I have. Hopefully it will change for the better.

The speed thing is worrying. It works OK for me, but by your description I suspect it is a key-repeat thing and we could easily have that set differently.


Comment 9 Andreas Røsdal 2006-12-28 22:15:49 UTC
What are the code changes required to rendre the bricks using the attached SVG pixmaps? Is there any code or patches for this anywhere?
Comment 10 Scott Percival 2007-08-09 03:31:12 UTC
Created attachment 93331 [details] [review]
patch for implementing nicer-looking gnometris theme in cairo
Comment 11 Scott Percival 2007-08-09 03:32:58 UTC
I've cobbled together some nicer-looking (well, to me) blocks in pure Cairo and extended Renderer to create a new class TangoBlock. They use the Tango colour scheme and somewhat resemble the blocks in the new Gnometris icon. It resembles Plain at the moment, but I could attack a Joined design based on how well received this is. It comes in two flavours, Flat and Shaded.



Attached is a proof-of-concept diff against the current SVN of gnome-games. This is literally my first ever patch; please criticize harshly if I've screwed up. Aesthetic criticism is also welcome. Now, don't get cross, but it does have a tiny impact on performance. Well, it would, when you consider how much nicer it looks than a filled rectangle. Attempts were made to optimise the drawing bits, but I threw them out as they made everything an order of magnitude slower.



Granted, this isn't a long-term fix like implementing SVG-based themes, but it's a damn sight improvement over the current implementation :P
Comment 12 Scott Percival 2007-08-09 05:47:25 UTC
Comment on attachment 93331 [details] [review]
patch for implementing nicer-looking gnometris theme in cairo

Index: gnometris/renderer.cpp

===================================================================

--- gnometris/renderer.cpp	(revision 6592)

+++ gnometris/renderer.cpp	(working copy)

@@ -26,6 +26,8 @@

 

 const ThemeTableEntry ThemeTable[] = {{N_("Plain"), "plain"},

                                       {N_("Joined"), "joined"},

+                                      {N_("Tango Flat"), "tangoflat"},

+                                      {N_("Tango Shaded"), "tangoshaded"},

                                       {NULL, NULL}};

 

 

@@ -54,11 +56,15 @@

                             int h, int pxw, int pxh)

 {

         switch (id) {

+        case 3:

+                return new TangoBlock (dst, bg, src, w, h, pxw, pxh, TRUE);

+        case 2:

+                return new TangoBlock (dst, bg, src, w, h, pxw, pxh, FALSE);

         case 1:

                 return new JoinedUp (dst, bg, src, w, h, pxw, pxh);

         case 0:

         default:

-                return  new Renderer (dst, bg, src, w, h, pxw, pxh);

+                return new Renderer (dst, bg, src, w, h, pxw, pxh);

         }

 }

 

@@ -339,3 +345,149 @@

 

         cairo_restore (cr);

 }

+

+/*--------------------------------------------------------*/

+

+TangoBlock::TangoBlock (cairo_surface_t * dst, cairo_surface_t * bg, Block ** src,

+	    int w, int h, int pxw, int pxh, gboolean grad) : Renderer (dst, bg, src, w, h, pxw, pxh)

+{

+        usegrads = grad;

+}

+

+void TangoBlock::drawCell (cairo_t *cr, gint x, gint y)

+{

+

+        int i;

+        cairo_pattern_t *pat;

+        /* the following garbage is derived from the official tango style guide */

+        const gdouble colours[8][3][3] = {

+                                          {{0.93725490196078431, 0.16078431372549021, 0.16078431372549021}, 

+                                           {0.8, 0.0, 0.0}, 

+                                           {0.64313725490196083, 0.0, 0.0}}, /* red */

+

+				          {{0.54117647058823526, 0.88627450980392153, 0.20392156862745098}, 

+                                           {0.45098039215686275, 0.82352941176470584, 0.086274509803921567}, 

+                                           {0.30588235294117649, 0.60392156862745094, 0.023529411764705882}}, /* green */

+

+				          {{0.44705882352941179, 0.62352941176470589, 0.81176470588235294}, 

+                                           {0.20392156862745098, 0.396078431372549, 0.64313725490196083}, 

+                                           {0.12549019607843137, 0.29019607843137257, 0.52941176470588236}}, /* blue */

+

+				          {{0.93333333333333335, 0.93333333333333335, 0.92549019607843142}, 

+                                           {0.82745098039215681, 0.84313725490196079, 0.81176470588235294}, 

+                                           {0.72941176470588232, 0.74117647058823533, 0.71372549019607845}}, /* white */

+

+				          {{0.9882352941176471, 0.9137254901960784, 0.30980392156862746}, 

+                                           {0.92941176470588238, 0.83137254901960789, 0.0}, 

+                                           {0.7686274509803922, 0.62745098039215685, 0.0}}, /* yellow */

+

+				          {{0.67843137254901964, 0.49803921568627452, 0.6588235294117647}, 

+                                           {0.45882352941176469, 0.31372549019607843, 0.4823529411764706}, 

+                                           {0.36078431372549019, 0.20784313725490197, 0.4}}, /* purple */

+				          

+                                          {{0.9882352941176471, 0.68627450980392157, 0.24313725490196078}, 

+                                           {0.96078431372549022, 0.47450980392156861, 0.0}, 

+                                           {0.80784313725490198, 0.36078431372549019, 0.0}}, /* orange (replacing cyan) */

+

+                                          {{0.33, 0.34, 0.32},

+                                           {0.18, 0.2, 0.21},

+                                           {0.10, 0.12, 0.13}} /* grey */

+                                         };

+

+        if (data[x][y].what == EMPTY)

+	        return;

+

+        if (data[x][y].what == TARGET) {

+                i = 7;

+        } else {

+                i = data[x][y].color;                       

+                i = CLAMP (i, 0, 6);

+        }

+        

+        if (usegrads) {

+                 pat = cairo_pattern_create_linear (x+0.35, y, x+0.55, y+0.9);

+                 cairo_pattern_add_color_stop_rgb (pat, 0.0, colours[i][0][0],

+                                                   colours[i][0][1],

+                                                   colours[i][0][2]);

+                 cairo_pattern_add_color_stop_rgb (pat, 1.0, colours[i][1][0],

+                                                   colours[i][1][1],

+                                                   colours[i][1][2]);

+                 cairo_set_source (cr, pat);

+        } else {

+                 cairo_set_source_rgb (cr, colours[i][0][0],

+                                       colours[i][0][1],

+                                       colours[i][0][2]);

+        }

+        

+        drawRoundedRectangle (cr, x+0.05, y+0.05, 0.9, 0.9, 0.2);

+        cairo_fill_preserve (cr);  /* fill with shaded gradient */

+        

+

+        if (usegrads) 

+                cairo_pattern_destroy(pat);

+        cairo_set_source_rgb(cr, colours[i][2][0],

+                             colours[i][2][1],

+                             colours[i][2][2]);

+        

+        cairo_set_line_width (cr, 0.1);

+        cairo_stroke (cr);  /* add darker outline */

+

+        drawRoundedRectangle (cr, x+0.15, y+0.15, 0.7, 0.7, 0.08);

+        if (data[x][y].what != TARGET) { 

+                if (usegrads) {

+                        pat = cairo_pattern_create_linear (x-0.3, y-0.3, x+0.8, y+0.8);

+                        switch (i) { /* yellow and white blocks need a brighter highlight */

+                        case 3:

+                        case 4:

+                                cairo_pattern_add_color_stop_rgba (pat, 0.0, 1.0,

+                                                                   1.0,

+                                                                   1.0,

+                                                                   1.0);

+                                cairo_pattern_add_color_stop_rgba (pat, 1.0, 1.0,

+                                                                   1.0,

+                                                                   1.0,

+                                                                   0.0);

+                                break;

+                        default:

+                                cairo_pattern_add_color_stop_rgba (pat, 0.0, 0.9295,

+                                                                   0.9295,

+                                                                   0.9295,

+                                                                   1.0);

+                                cairo_pattern_add_color_stop_rgba (pat, 1.0, 0.9295,

+                                                                   0.9295,

+                                                                   0.9295,

+                                                                   0.0);

+                                break;

+                        }

+                        cairo_set_source (cr, pat);

+                } else {

+                        cairo_set_source_rgba (cr, 1.0,

+                                               1.0,

+                                               1.0,

+                                               0.35);

+                }

+        } else {

+                cairo_set_source_rgba (cr, 1.0,

+                                       1.0,

+                                       1.0,

+                                       0.15);

+        }

+        cairo_stroke (cr);

+        

+        if (usegrads && (data[x][y].what != TARGET)) 

+                cairo_pattern_destroy (pat);

+}

+

+void TangoBlock::drawRoundedRectangle (cairo_t * cr, gdouble x, gdouble y, gdouble w, gdouble h, gdouble r)

+{

+        cairo_move_to(cr, x+r, y);

+        cairo_line_to(cr, x+w-r, y);

+        cairo_curve_to(cr, x+w-(r/2), y, x+w, y+(r/2), x+w, y+r);

+        cairo_line_to(cr, x+w, y+h-r);

+        cairo_curve_to(cr, x+w, y+h-(r/2), x+w-(r/2), y+h, x+w-r, y+h);

+        cairo_line_to(cr, x+r, y+h);

+        cairo_curve_to(cr, x+(r/2), y+h, x, y+h-(r/2), x, y+h-r);

+        cairo_line_to(cr, x, y+r);

+        cairo_curve_to(cr, x, y+(r/2), x+(r/2), y, x+r, y);

+}

+

Index: gnometris/renderer.h

===================================================================

--- gnometris/renderer.h	(revision 6592)

+++ gnometris/renderer.h	(working copy)

@@ -77,4 +77,17 @@

   void drawVEdge (cairo_t * cr);

 };

 

+class TangoBlock:public Renderer {

+public:

+  TangoBlock (cairo_surface_t * dst, cairo_surface_t * bg, Block ** src,

+	    int w, int h, int pxw, int pxh, gboolean grad);

+

+protected:

+  virtual void drawCell (cairo_t * cr, gint x, gint y);

+  gboolean usegrads;

+

+private:

+  void drawRoundedRectangle (cairo_t * cr, gdouble x, gdouble y, gdouble w, gdouble h, gdouble r); 

+};

+

 #endif // __renderer_h__
Comment 13 Scott Percival 2007-08-09 05:59:58 UTC
Argh, that came out wrong. Sorry for making a big mess :(
Comment 14 Andreas Røsdal 2007-08-09 16:36:54 UTC
Scott, thanks for the excellent theme! I have committed it to SVN trunk:

http://svn.gnome.org/viewcvs/gnome-games?view=revision&revision=6600

This change introduces a new string, which will have to be announced to gnome-i18n@gnome.org...

(Even though Gnometris doesn't have "ugly looking brick graphics", I'm keeping this report open for now).
Comment 15 Scott Percival 2007-08-10 00:54:01 UTC
Phwoar! That's awesome it got committed :)
I've had another look at my theme in the cruel harsh light of morning, and it turns out I forgot to accommodate for the "show where the block is about to land" feature. Whoops. So here's a second remedial patch against the latest SVN.
Comment 16 Scott Percival 2007-08-10 00:55:54 UTC
Created attachment 93407 [details] [review]
fixes tango theme to work with the "show where block will land" feature
Comment 17 Robert Ancell 2012-01-31 23:24:56 UTC
This bug is being reassigned to the "quadrapassel" component so we can close the gnometris bugzilla component.  Apologies for the mass email!