mtpaint 3.34+svn

Paint programs, vector editors, 3d modelers, animation editors, etc.
Message
Author
User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#16 Post by vovchik »

Dear wjaguar,

Everything works as you said it would. My mtpaintrc file looks like this:

Code: Select all

# choose a location (directory) for your mtpaint theme (icon dir)

pixmap_path "/root/.mtpaint-theme/"

# icon definitions go here 

style "mtPaint" { stock["mtpaint_brcosa"] = { { "mtpaint_brcosa.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_case"] = { { "mtpaint_case.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_centre"] = { { "mtpaint_centre.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_cline"] = { { "mtpaint_cline.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_clone"] = { { "mtpaint_clone.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_close"] = { { "mtpaint_close.png",*, *, * } } }
style "mtPaint" { stock["mtpaint_config"] = { { "mtpaint_config.png",*, *, * } } }

.... (and so on)

widget_class "*" style "mtPaint"
many thanks and kind regards,
vovchik

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#17 Post by ttuuxxx »

Hi vovchik when your finished could you please post a skinned version :) with the mtpaintrc and icons. That would save everybody a lot of time figuring it, I'm more foccused on 2.20 and don't have time figure this out from scratch.
Thanks
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#18 Post by vovchik »

Dear ttuuxxx,

Here is my mtpaintrc and my .mtpaint-theme (hidden) dir full of png icons. I bashed this set together quickly, using some of your icons and some others that are supposed to match my OSX GTK/KDE/QT/IceWM themes. All this should be unpacked in /root.

With kind regards,
vovchik

PS. More work could be done, as evidenced by my screen shot
Attachments
mtpaint-pic.jpg
(18.78 KiB) Downloaded 531 times
mtpaint-stuff.tar.gz
(69.12 KiB) Downloaded 560 times

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#19 Post by ttuuxxx »

vovchik wrote:Dear ttuuxxx,

Here is my mtpaintrc and my .mtpaint-theme (hidden) dir full of png icons. I bashed this set together quickly, using some of your icons and some others that are supposed to match my OSX GTK/KDE/QT/IceWM themes. All this should be unpacked in /root.

With kind regards,
vovchik

PS. More work could be done, as evidenced by my screen shot
vovchik it saves me a lot of time so thank you :)
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

wjaguar
Posts: 359
Joined: Wed 21 Jun 2006, 14:16

#20 Post by wjaguar »

vovchik wrote:Here is my mtpaintrc and my .mtpaint-theme (hidden) dir full of png icons.
Good that you included setting "gtk-icon-sizes" in your mtpaintrc. But for best results, the size which mtPaint uses should be set to precisely the unscaled size of the icons. Like this:

Code: Select all

gtk-icon-sizes="gtk-small-toolbar=22,22"
Because, see, GTK's image scaling code is completely braindead, and its results are of a very bad quality. :-(

And if an icon is originally larger than needed, it is better to rescale it with mtPaint, than leave the job to GTK+.
First, "Scale canvas" - with default "Blackman-Harris" method, gamma correction enabled, and "Sharper image reduction" in settings toggled on.
Then, "Unsharp mask" for improving the contrast - a good working recipe is one pass with radius 1 and amount 0.40, and then another with radius 30 and amount 0.10. (This is what Wikipedia engine does when serving reduced-size images, since 2007.)

BTW, image scaling was the reason why I got involved with mtPaint: no existing program was able to do it properly, so I had to implement it myself. :-)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#21 Post by technosaurus »

wjaguar has added many features - here is a build for testing
(no external images in this one - just the default builtins)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#22 Post by technosaurus »

I wanted to have more colors in my xpm files without adding unnecessary size, this tarball contains a patch to allow mtpaint to use 92 colors vs 64, it is also set up so that it can more easily be modified for more than 2 characters wide. (the tarball also has a few builtin xpms that were reduced by about 1kb total)

here is what it looks like:

Code: Select all

--- src/png.c~	2012-03-01 06:33:16.000000000 +0800
+++ src/png.c	2012-06-01 17:30:10.950797471 +0800
@@ -3925,8 +3925,8 @@ fail:	fclose(fp);
 	return (res);
 }
 
-static const char base64[] =
-	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
+static const char ascii[] =
+	"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",
 	hex[] = "0123456789ABCDEF";
 
 /* Extract valid C identifier from filename */
@@ -3947,7 +3947,7 @@ static int save_xpm(char *file_name, ls_
 {
 	unsigned char rgbmem[XPM_MAXCOL * 4], *src;
 	const char *ctb;
-	char ws[3], *buf, *tmp;
+	char ws[4], *buf, *tmp;
 	str_hash cuckoo;
 	FILE *fp;
 	int bpp = settings->bpp, w = settings->width, h = settings->height;
@@ -4001,7 +4001,8 @@ static int save_xpm(char *file_name, ls_
 		trans = settings->xpm_trans;
 	}
 
-	cpp = cols > 64 ? 2 : 1;
+	cpp = cols > (strlen(ascii)+1) ? 2 : 1;
+	/* cpp = cols > ((strlen(ascii)+1)*(strlen(ascii)+1)) ? 3 : cpp; */
 	buf = malloc(w * cpp + 16);
 	if (!buf) return -1;
 
@@ -4022,19 +4023,21 @@ static int save_xpm(char *file_name, ls_
 	else fprintf(fp, "\"%d %d %d %d\",\n", w, h, cols, cpp);
 
 	/* Create colortable */
-	ctb = cols > 16 ? base64 : hex;
-	ws[1] = ws[2] = '\0';
+	ctb = cols > 16 ? ascii : hex;
+	ws[1] = ws[2] = '\0'; /* ws[3]='\0'; */
 	for (i = 0; i < cols; i++)
 	{
 		if (i == trans)
 		{
 			ws[0] = ' ';
 			if (cpp > 1) ws[1] = ' ';
+			/* if (cpp > 2) ws[2] = ' '; */
 			fprintf(fp, "\"%s\tc None\",\n", ws);
 			continue;
 		}
-		ws[0] = ctb[i & 63];
-		if (cpp > 1) ws[1] = ctb[i >> 6];
+		ws[0] = ctb[i % strlen(ascii)];
+		if (cpp > 1) ws[1] = ctb[i / strlen(ascii)];
+		/* if (cpp > 2) ws[2] = ctb[i / (strlen(ascii)*strlen(ascii))]; */
 		src = rgbmem + i * 4;
 		fprintf(fp, "\"%s\tc #%02X%02X%02X\",\n", ws,
 			src[0], src[1], src[2]);
@@ -4052,8 +4055,10 @@ static int save_xpm(char *file_name, ls_
 			if (k == trans) tmp[0] = tmp[1] = ' ';
 			else
 			{
-				tmp[0] = ctb[k & 63];
-				tmp[1] = ctb[k >> 6];
+			
+				tmp[0] = ctb[k % strlen(ascii)];
+				tmp[1] = ctb[k / strlen(ascii)];
+				/* tmp[2] = ctb[k / (strlen(ascii)*strlen(ascii))]; */
 			}
 		}
 		strcpy(tmp, i < h - 1 ? "\",\n" : "\"\n};\n");
to add 3+ character wide support ws[3] would need to be increased to ws[4] and would need to compute ws[2] and tmp[2], which is basically i or k / (strlen(ascii)*strlen(ascii)) ... I think, if not, its a good place to start
Attachments
xpm_colors.patch.gz
updated patch fixes colors &gt; 184 and has 3 wide support commented out for future use
(1 KiB) Downloaded 387 times
fixed_icons.tar.gz
(2.45 KiB) Downloaded 380 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#23 Post by technosaurus »

I just realized the hex part may be broken... Need to test something with 16 colors, but it looks like it may be totally unnecessary anyways.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply