X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Ftitler%2Ftitler.h;h=0f887d017f5b01287d9ec53a4c4ff17a4315b027;hp=2b957a2c511358ac53f2e236f3428595c71cde73;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=25bafacda1fe9d8a9520cad451547a75d934c1bb diff --git a/cinelerra-5.1/plugins/titler/titler.h b/cinelerra-5.1/plugins/titler/titler.h index 2b957a2c..0f887d01 100644 --- a/cinelerra-5.1/plugins/titler/titler.h +++ b/cinelerra-5.1/plugins/titler/titler.h @@ -21,6 +21,22 @@ #ifndef TITLE_H #define TITLE_H +#define USE_STROKER + +#define KW_NUDGE N_("nudge") +#define KW_COLOR N_("color") +#define KW_ALPHA N_("alpha") +#define KW_FONT N_("font") +#define KW_SIZE N_("size") +#define KW_BOLD N_("bold") +#define KW_ITALIC N_("italic") +#define KW_CAPS N_("caps") +#define KW_UL N_("ul") +#define KW_BLINK N_("blink") +#define KW_FIXED N_("fixed") +#define KW_ALIAS N_("smooth") +#define KW_SUP N_("sup") +#define KW_PNG N_("png") class TitleConfig; class TitleGlyph; @@ -53,6 +69,7 @@ class TitleCurCaps; class TitleCurUnder; class TitleCurBlink; class TitleCurFixed; +class TitleCurAlias; class TitleCurSuper; class TitleCurNudge; class TitleParser; @@ -64,7 +81,7 @@ class TitleMain; #include "indexable.inc" #include "loadbalance.h" #include "mutex.h" -#include "overlayframe.inc" +#include "overlayframe.h" #include "pluginvclient.h" #include "renderengine.inc" #include "titlerwindow.h" @@ -72,6 +89,8 @@ class TitleMain; #include #include FT_FREETYPE_H #include +#include +#include // Motion strategy #define TOTAL_PATHS 5 @@ -94,6 +113,7 @@ class TitleMain; // char types #define CHAR_GLYPH 0 #define CHAR_IMAGE 1 + // flags #define FLAG_UNDER 0x0001 #define FLAG_FIXED 0x0002 @@ -101,6 +121,8 @@ class TitleMain; #define FLAG_SUBER 0x0008 #define FLAG_BLINK 0x0010 +#define FONT_ALIAS 0x08 + class TitleConfig { public: @@ -139,7 +161,7 @@ public: double fade_in, fade_out; float pixels_per_second; // Speed of motion // Text to display - wchar_t wtext[BCTEXTLEN]; + wchar_t wtext[3*BCTEXTLEN]; int wlen; // Position in frame relative to top left float title_x, title_y; @@ -363,55 +385,6 @@ public: int pass; }; - -// Overlay text mask with fractional translation -// We don't use OverlayFrame to enable alpha blending on non alpha -// output. -class TitleTranslatePackage : public LoadPackage -{ -public: - TitleTranslatePackage(); - int y1, y2; -}; - -typedef struct { - int in_x1; - float in_fraction1; - int in_x2; // Might be same as in_x1 for boundary - float in_fraction2; - float output_fraction; -} transfer_table_f; - -class TitleTranslateUnit : public LoadClient -{ -public: - TitleTranslateUnit(TitleMain *plugin, TitleTranslate *server); - - static void translation_array_f(transfer_table_f* &table, - float out_x1, float out_x2, int out_total, - float in_x1, float in_x2, int in_total, - int &x1_out, int &x2_out); - void process_package(LoadPackage *package); - TitleMain *plugin; -}; - -class TitleTranslate : public LoadServer -{ -public: - TitleTranslate(TitleMain *plugin, int cpus); - ~TitleTranslate(); - void init_packages(); - void run_packages(); - LoadClient* new_client(); - LoadPackage* new_package(); - TitleMain *plugin; - transfer_table_f *y_table; - transfer_table_f *x_table; - VFrame *xlat_mask; - int out_x1, out_x2; - int out_y1, out_y2; -}; - template class TitleStack : public ArrayList { typ &last() { return ArrayList::last(); } @@ -513,6 +486,12 @@ public: int set(const char *txt); }; +class TitleCurAlias : public TitleStack { +public: + TitleCurAlias(TitleParser *parser, TitleMain *plugin); + int set(const char *txt); +}; + class TitleCurSuper : public TitleStack { public: TitleCurSuper(TitleParser *parser, TitleMain *plugin); @@ -532,6 +511,8 @@ public: int wcur() { return eof() ? -1 : *out; } int wnext() { return eof() ? -1 : *out++; } int wget(wchar_t &wch); + int tget(wchar_t &wch); + wchar_t wid[BCSTRLEN], wtxt[BCTEXTLEN]; char id[BCSTRLEN], text[BCTEXTLEN]; int set_attributes(int ret); @@ -546,12 +527,51 @@ public: TitleCurUnder cur_under; TitleCurBlink cur_blink; TitleCurFixed cur_fixed; + TitleCurAlias cur_alias; TitleCurSuper cur_super; TitleParser(TitleMain *main); }; +// Overlay text mask with fractional translation +// We don't use OverlayFrame to enable alpha blending on non alpha +// output. +class TitleTranslatePackage : public LoadPackage +{ +public: + TitleTranslatePackage(); + int y1, y2; +}; + +class TitleTranslateUnit : public LoadClient +{ +public: + TitleTranslateUnit(TitleMain *plugin, TitleTranslate *server); + + void process_package(LoadPackage *package); + TitleMain *plugin; +}; + +class TitleTranslate : public LoadServer +{ +public: + TitleTranslate(TitleMain *plugin, int cpus); + ~TitleTranslate(); + + TitleMain *plugin; + VFrame *input; + float in_w, in_h, out_w, out_h; + float ix1, iy1, ix2, iy2; + float ox1, oy1, ox2, oy2; + + void copy(VFrame *input); + LoadClient* new_client(); + LoadPackage* new_package(); + void init_packages(); +}; + + class TitleMain : public PluginVClient { public: @@ -566,7 +586,7 @@ public: void update_gui(); void save_data(KeyFrame *keyframe); void read_data(KeyFrame *keyframe); - void insert_text(const char *txt, int pos); + void insert_text(const wchar_t *wtxt, int pos); void build_previews(TitleWindow *gui); void reset_render(); @@ -594,7 +614,7 @@ public: Indexable *open_background(const char *filename); int read_background(VFrame *frame, int64_t position, int color_model); void draw_background(); - BC_FontEntry* get_font(const char *font_name, int style); + static BC_FontEntry* get_font(const char *font_name, int style); BC_FontEntry* config_font(); TitleGlyph *get_glyph(FT_ULong char_code, BC_FontEntry *font, int size, int style); int get_width(TitleGlyph *cur, TitleGlyph *nxt); @@ -626,7 +646,8 @@ public: int window_w, window_h; int fuzz, fuzz1, fuzz2; - int title_x, title_y, title_w, title_h; + float title_x, title_y; + int title_w, title_h; float text_x, text_y, text_w, text_h; float text_x1, text_y1, text_x2, text_y2;