Bob van Loosen wrote:
Hi everyone,

I added outlines for the title effect, you can see an example movie here: http://www.xs4all.nl/~loosen/test.mpg <http://www.xs4all.nl/%7Eloosen/test.mpg>
I'll post a patch tomorrow (once I figure out how).
Can someone explain to me what the existing outlines code is about? It doesn't seem to be working.

Greetings,

Bob van Loosen

Here is the patch, hope it works.

Bob.
diff -Naur hvirtual-clean/plugins/titler/title.C 
hvirtual-outlines-clean/plugins/titler/title.C
--- hvirtual-clean/plugins/titler/title.C       2007-10-07 15:22:10.000000000 
+0200
+++ hvirtual-outlines-clean/plugins/titler/title.C      2007-10-07 
15:25:04.000000000 +0200
@@ -45,7 +45,7 @@
 {
        style = 0;
        color = BLACK;
-       color_stroke = 0xff0000;
+       color_stroke = 0xffffff;
        size = 24;
        motion_strategy = NO_MOTION;
        loop = 0;
@@ -1899,12 +1899,101 @@
        }
 //printf("TitleMain::overlay_mask 1\n");
 
+       if(config.stroke_width >= 1) //hack for font outlines
+       {
+               int i;
+
+               for (i = config.stroke_width * -1; i <= config.stroke_width; i 
+= 2)
+               {
+                               text_x1 += i;
+                               text_x2 += i;
+                               mask_y1 += config.stroke_width * -1;
+                               mask_y2 += config.stroke_width * -1;
+                               if(text_x1 < input->get_w() && text_x1 + text_w 
> 0 &&
+                                       mask_y1 < input->get_h() && mask_y2 > 0)
+                               {
+                                       if(!translate) translate = new 
TitleTranslate(this, PluginClient::smp + 1);
+               // Do 2 passes if dropshadow.
+                                       int temp_color = config.color;
+                                       //config.color = 0x0;
+                                       config.color = config.color_stroke;
+                                       translate->process_packages();
+                                       config.color = temp_color;
+                               }
+                               //text_x1 -= i;
+                               //text_x2 -= i;
+                               mask_y1 -= config.stroke_width * -1;
+                               mask_y2 -= config.stroke_width * -1;
+                       
+                               //text_x1 += i;
+                               //text_x2 += i;
+                               mask_y1 += config.stroke_width;
+                               mask_y2 += config.stroke_width;
+                               if(text_x1 < input->get_w() && text_x1 + text_w 
> 0 &&
+                                       mask_y1 < input->get_h() && mask_y2 > 0)
+                               {
+                                       if(!translate) translate = new 
TitleTranslate(this, PluginClient::smp + 1);
+               // Do 2 passes if dropshadow.
+                                       int temp_color = config.color;
+                                       //config.color = 0x0;
+                                       config.color = config.color_stroke;
+                                       translate->process_packages();
+                                       config.color = temp_color;
+                               }
+                               text_x1 -= i;
+                               text_x2 -= i;
+                               mask_y1 -= config.stroke_width;
+                               mask_y2 -= config.stroke_width;
+                       
+                               text_x1 += config.stroke_width * -1;
+                               text_x2 += config.stroke_width * -1;
+                               mask_y1 += i;
+                               mask_y2 += i;
+                               if(text_x1 < input->get_w() && text_x1 + text_w 
> 0 &&
+                                       mask_y1 < input->get_h() && mask_y2 > 0)
+                               {
+                                       if(!translate) translate = new 
TitleTranslate(this, PluginClient::smp + 1);
+               // Do 2 passes if dropshadow.
+                                       int temp_color = config.color;
+                                       //config.color = 0x0;
+                                       config.color = config.color_stroke;
+                                       translate->process_packages();
+                                       config.color = temp_color;
+                               }
+                               text_x1 -= config.stroke_width * -1;
+                               text_x2 -= config.stroke_width * -1;
+                               //mask_y1 -= i;
+                               //mask_y2 -= i;
+                       
+                               text_x1 += config.stroke_width;
+                               text_x2 += config.stroke_width;
+                               //mask_y1 += i;
+                               //mask_y2 += i;
+                               if(text_x1 < input->get_w() && text_x1 + text_w 
> 0 &&
+                                       mask_y1 < input->get_h() && mask_y2 > 0)
+                               {
+                                       if(!translate) translate = new 
TitleTranslate(this, PluginClient::smp + 1);
+               // Do 2 passes if dropshadow.
+                                       int temp_color = config.color;
+                                       //config.color = 0x0;
+                                       config.color = config.color_stroke;
+                                       translate->process_packages();
+                                       config.color = temp_color;
+                               }
+                               text_x1 -= config.stroke_width;
+                               text_x2 -= config.stroke_width;
+                               mask_y1 -= i;
+                               mask_y2 -= i;
+               }       
+       }       
+       
+       
        if(text_x1 < input->get_w() && text_x1 + text_w > 0 &&
                mask_y1 < input->get_h() && mask_y2 > 0)
        {
                if(!translate) translate = new TitleTranslate(this, 
PluginClient::smp + 1);
                translate->process_packages();
-               if (config.stroke_width >= ZERO &&
+               /*if (config.stroke_width >= ZERO &&
                        (config.style & FONT_OUTLINE)) 
                {
                        int temp_color = config.color;
@@ -1915,7 +2004,7 @@
                        translate->process_packages();
                        config.color = temp_color;
                        this->text_mask = tmp_text_mask;
-               }
+               }*/
        }
 //printf("TitleMain::overlay_mask 200\n");
 }
diff -Naur hvirtual-clean/plugins/titler/titlewindow.C 
hvirtual-outlines-clean/plugins/titler/titlewindow.C
--- hvirtual-clean/plugins/titler/titlewindow.C 2007-10-07 15:22:10.000000000 
+0200
+++ hvirtual-outlines-clean/plugins/titler/titlewindow.C        2007-10-07 
15:25:04.000000000 +0200
@@ -252,6 +252,9 @@
        encoding = new TitleEncoding(client, this, x, y + 20);
        encoding->create_objects();
 
+
+       
+       
 #ifdef USE_OUTLINE
        x += 160;
        add_tool(strokewidth_title = new BC_Title(x, y, _("Outline width:")));
@@ -946,6 +949,8 @@
        client->send_configure_change();
        return 1;
 }
+
+
 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow 
*window)
  : ColorThread()
 {
@@ -953,7 +958,8 @@
        this->window = window;
 }
 
-int TitleColorStrokeThread::handle_event(int output)
+//int TitleColorStrokeThread::handle_event(int output)
+int TitleColorStrokeThread::handle_new_color(int output, int /*alpha*/)
 {
        client->config.color_stroke = output;
        window->update_color();
diff -Naur hvirtual-clean/plugins/titler/titlewindow.h 
hvirtual-outlines-clean/plugins/titler/titlewindow.h
--- hvirtual-clean/plugins/titler/titlewindow.h 2007-10-07 15:22:10.000000000 
+0200
+++ hvirtual-outlines-clean/plugins/titler/titlewindow.h        2007-10-07 
15:25:09.000000000 +0200
@@ -1,6 +1,8 @@
 #ifndef TITLEWINDOW_H
 #define TITLEWINDOW_H
 
+#define USE_OUTLINE
+
 #include "guicast.h"
 
 class TitleThread;
@@ -362,7 +364,8 @@
 {
 public:
        TitleColorStrokeThread(TitleMain *client, TitleWindow *window);
-       int handle_event(int output);
+       //int handle_event(int output);
+       virtual int handle_new_color(int output, int alpha);
        TitleMain *client;
        TitleWindow *window;
 };

Reply via email to