annotate TOOLS/subfont-gimp/mplayer_subfont @ 15231:e183a591efee

More fixes by The Wanderer
author rtognimp
date Wed, 20 Apr 2005 22:07:08 +0000
parents 22996ab2d78f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1469
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
1 #!/usr/bin/perl
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
2 use 5.6.0;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
3 use warnings;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
4 use strict;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
5 use Gtk; # just so that compilation fails without it
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
6 use Gimp qw(:auto);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
7 use Gimp::Feature qw(gimp-1.2);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
8 use Gimp::Fu;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
9
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
10 my $head = <<EOF;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
11 [files]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
12 alpha arpi_osd_a.raw
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
13 bitmap arpi_osd_b.raw
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
14
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
15 [characters]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
16 0x01 0 36
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
17 0x02 35 71
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
18 0x03 70 106
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
19 0x04 116 152
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
20 0x05 164 200
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
21 0x06 209 245
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
22 0x07 256 292
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
23 0x08 305 342
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
24 0x09 354 400
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
25 0x0A 407 442
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
26 0x0B 457 494
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
27
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
28 [files]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
29 alpha arpi_progress_a.raw
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
30 bitmap arpi_progress_b.raw
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
31
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
32 [characters]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
33 0x10 4 21
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
34 0x11 30 41
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
35 0x12 50 66
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
36 0x13 74 85
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
37
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
38 EOF
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
39
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
40 sub geninfo {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
41 my ($font, $height) = @_;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
42
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
43 my $size = (split("-", $font))[7];
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
44 $font = (split("-", $font))[2];
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
45
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
46 return(sprintf(<<EOF, $font, $size, int($size/2), -3-int($size/10), $size));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
47 [info]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
48 name "%s \@%d; created in gimp; plugin by lanzz\@lanzz.org"
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
49 descversion 1
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
50 spacewidth %d
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
51 charspace %d
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
52 height %d
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
53
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
54 EOF
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
55 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
56
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
57 sub basename($) {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
58 my ($f) = @_;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
59 $f =~ m#([^/]*)$#;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
60 return($1);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
61 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
62
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
63 sub render_subfont {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
64 my ($font, $bfile, $afile, $dfile, $keep) = @_;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
65
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
66 my ($raw) = gimp_procedural_db_query("^file_raw_save\$", "","","","","","");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
67 if ($raw ne "file_raw_save") {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
68 gimp_message("HSI Raw plugin not installed");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
69 return(undef);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
70 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
71
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
72 unless (open(D, "> $dfile")) {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
73 gimp_message("Cannot write to $dfile");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
74 return(undef);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
75 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
76
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
77 my @size = xlfd_size($font);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
78 $size[0] *= 2;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
79
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
80 my (undef, $h) = gimp_text_get_extents_fontname(join("", map(chr($_), 33 .. 255)), @size, $font);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
81 $h += 10;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
82 my $w = 0;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
83 gimp_palette_set_foreground([255, 255, 255]);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
84 gimp_palette_set_background([0, 0, 0]);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
85
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
86 my $img = gimp_image_new(1, $h, GRAY);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
87 gimp_image_undo_disable($img);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
88 gimp_image_set_filename($img, $bfile);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
89 my $draw = gimp_layer_new($img, 1, $h, GRAY_IMAGE, "subfont", 100, NORMAL_MODE);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
90 gimp_image_add_layer($img, $draw, 0);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
91 gimp_edit_fill($draw, BG_IMAGE_FILL);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
92
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
93 my $x = 0;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
94 print D (geninfo($font));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
95 print D ($head);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
96 printf D (<<EOF, basename($afile), basename($bfile));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
97 [files]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
98 alpha %s
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
99 bitmap %s
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
100
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
101 EOF
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
102
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
103 print D ("[characters]\n");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
104 gimp_progress_init("Rendering font...");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
105 for (my $c = 33; $c <= 255; $c++) {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
106 my ($cw) = gimp_text_get_extents_fontname(chr($c), @size, $font);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
107 printf D ("0x%02X %d %d\n", $c, int($x / 2), int(($x + $cw + 5) / 2));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
108 $cw = (int($cw / 8) + 2) * 8;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
109 $w += $cw;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
110 gimp_image_resize($img, $w, $h, 0, 0);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
111 gimp_layer_resize($draw, $w, $h, 0, 0);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
112 gimp_floating_sel_anchor(gimp_text_fontname($img, $draw, $x + 5, 5, chr($c), -1, 1, @size, $font));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
113 $x += $cw;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
114 gimp_progress_update(($c - 33) / 222);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
115 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
116 close(D);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
117
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
118 gimp_image_scale($img, int($w / 2), int($h / 2));
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
119 gimp_image_undo_enable($img);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
120 file_raw_save($img, $draw, $bfile, $bfile);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
121
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
122 my $aimg = gimp_channel_ops_duplicate($img);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
123 gimp_image_undo_disable($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
124 gimp_image_set_filename($aimg, $afile);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
125 $draw = gimp_image_flatten($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
126 gimp_by_color_select($draw, [0, 0, 0], 15, REPLACE, 1, 0, 0, 0);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
127 gimp_selection_invert($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
128 gimp_selection_grow($aimg, 1);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
129 gimp_edit_fill($draw, FG_IMAGE_FILL);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
130 gimp_selection_clear($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
131 plug_in_gauss_rle2($img, $draw, 3, 3);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
132 gimp_image_undo_enable($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
133 file_raw_save($aimg, $draw, $afile, $afile);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
134
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
135 gimp_message(<<EOF);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
136 Render done.
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
137
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
138 Bitmap: $bfile
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
139 Alpha: $afile
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
140 Desc: $dfile
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
141 EOF
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
142 if ($keep) {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
143 gimp_image_clean_all($img);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
144 gimp_image_clean_all($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
145 return($img, $aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
146 } else {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
147 return(undef);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
148 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
149 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
150
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
151 sub render_subfont_alpha {
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
152 my ($img) = @_;
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
153
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
154 my $aimg = gimp_channel_ops_duplicate($img);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
155 gimp_image_undo_disable($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
156 gimp_image_set_filename($aimg, "alpha.raw");
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
157 my $draw = gimp_image_flatten($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
158 gimp_by_color_select($draw, [0, 0, 0], 15, REPLACE, 1, 0, 0, 0);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
159 gimp_selection_invert($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
160 gimp_selection_grow($aimg, 1);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
161 gimp_edit_fill($draw, FG_IMAGE_FILL);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
162 gimp_selection_clear($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
163 plug_in_gauss_rle2($img, $draw, 3, 3);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
164 gimp_image_undo_enable($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
165
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
166 return($aimg);
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
167 }
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
168
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
169 register(
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
170 "render_subfont",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
171 "Render a grayscale MPlayer subtitle font",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
172 "No help (yet)",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
173 "lanzz\@lanzz.org",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
174 "Copyright 2001, lanzz\@lanzz.org",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
175 "2001-07-31",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
176 "<Toolbox>/Xtns/MPlayer/Render Subfont",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
177 undef,
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
178 [
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
179 [PF_FONT, "font", "", "-*-arial-medium-r-normal-*-16-*-*-*-*-*-*-*", undef],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
180 [PF_FILE, "bitmap", "", "bitmap.raw", undef],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
181 [PF_FILE, "alpha", "", "alpha.raw", undef],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
182 [PF_FILE, "desc", "", "font.desc", undef],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
183 [PF_TOGGLE, "toggle", "Keep images opened", 0, undef]
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
184 ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
185 [ ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
186 [ ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
187 \&render_subfont
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
188 );
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
189
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
190 register(
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
191 "render_subfont_alpha",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
192 "Render alpha shadow for MPlayer subtitle font",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
193 "No help (yet)",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
194 "lanzz\@lanzz.org",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
195 "Copyright 2001, lanzz\@lanzz.org",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
196 "2001-07-31",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
197 "<Image>/Filters/MPlayer/Render Shadow",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
198 "GRAY",
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
199 [ ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
200 [ PF_IMAGE ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
201 [ ],
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
202 \&render_subfont_alpha
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
203 );
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
204
22996ab2d78f mplayer font-generator GIMP plugin by lanzz@lanzz.org
arpi
parents:
diff changeset
205 exit(main());