[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
[Patch gfont] adds border
- From: Denis Barbier <nospam@thanx>
- Date: Wed, 30 Dec 1998 10:17:50 +0100 (CET)
Hi,
this patch adds 2 self-explanatory options to gfont:
--border -B border width (default 0)
--bordercolor -C border color (default black)
--- gfont-1.0.2/gfont_main.c Tue Sep 16 10:09:22 1997
+++ gfont-1.0.2/gfont_main.c.border Mon Dec 21 14:33:36 1998
@@ -216,6 +216,8 @@
fprintf(stderr, "Rendering Parameters:\n");
fprintf(stderr, " -b, --background=RRGGBB set background color (default: `ffffff')\n");
fprintf(stderr, " -f, --foreground=RRGGBB set foreground color (default: `000000')\n");
+ fprintf(stderr, " -B, --border=N set border width (default: `0')\n");
+ fprintf(stderr, " -C, --bordercolor=RRGGBB set border color (default: `000000')\n");
fprintf(stderr, " -F, --fontname=NAME set specific font (default `CMBoldface-V')\n");
fprintf(stderr, " -G, --gdf-path=DIR add DIR to the path where GdF files are searched\n");
fprintf(stderr, "\n");
@@ -244,6 +246,8 @@
{ "output-file", 1, NULL, 'o' },
{ "verbose", 0, NULL, 'v' },
{ "version", 0, NULL, 'V' },
+ { "border", 1, NULL, 'B' },
+ { "bordercolor", 1, NULL, 'C' },
{ "help", 0, NULL, 'h' }
};
@@ -268,6 +272,8 @@
char *outputfile = "out.gif";
int bg_r, bg_g, bg_b;
int fg_r, fg_g, fg_b;
+ int bfg, bfg_r, bfg_g, bfg_b;
+ int border = 0;
char c;
char *string;
char *font = "CMBoldface-V";
@@ -282,10 +288,11 @@
hextriple2gdcolor("ffffff", &bg_r, &bg_g, &bg_b);
hextriple2gdcolor("000000", &fg_r, &fg_g, &fg_b);
+ hextriple2gdcolor("000000", &bfg_r, &bfg_g, &bfg_b);
/* parse the option arguments */
opterr = 0;
- while ((c = getopt_long(argc, argv, ":b:f:a:F:G:cir:o:vVh", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, ":b:f:B:C:a:F:G:cir:o:vVh", options, NULL)) != -1) {
if (optarg == NULL)
optarg = "(null)";
switch (c) {
@@ -296,6 +303,12 @@
case 'f':
hextriple2gdcolor(optarg, &fg_r, &fg_g, &fg_b);
break;
+ case 'B':
+ border = atoi(optarg);
+ break;
+ case 'C':
+ hextriple2gdcolor(optarg, &bfg_r, &bfg_g, &bfg_b);
+ break;
case 'a':
antialias = atoi(optarg);
break;
@@ -498,7 +511,16 @@
Verbose("Freeing old image: ");
gdImageDestroy(ip);
ip = ipn;
+ w = nW;
+ h = nH;
Verbose("Done\n");
+ }
+ if (border) {
+ Verbose("Border: %d pixels :",border);
+ bfg = gdImageColorAllocate(ip, bfg_r, bfg_g, bfg_b);
+ for (x = 0; x < border; x++)
+ gdImageRectangle(ip, x, x, w-1-x, h-1-x, bfg);
+ Verbose("Done\n");
}
Verbose("Exporting image to GIF file: ");
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com