From 3d7a882d0808f456957f823454bd84ff8317a51a Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 17 Dec 2018 18:46:15 -0700 Subject: [PATCH] title color fader/tweaks, bg_color bcbitmap fix, inst.sh fix, lang fr pref tweaks --- cinelerra-5.1/cinelerra/colorpicker.C | 20 +- cinelerra-5.1/cinelerra/colorpicker.h | 1 + cinelerra-5.1/cinelerra/edit.C | 20 +- cinelerra-5.1/cinelerra/edit.h | 4 - cinelerra-5.1/cinelerra/editpopup.C | 24 +- cinelerra-5.1/cinelerra/editpopup.h | 2 +- cinelerra-5.1/cinelerra/mainsession.C | 3 + cinelerra-5.1/cinelerra/mainsession.h | 3 + cinelerra-5.1/cinelerra/mwindow.C | 40 +- cinelerra-5.1/cinelerra/mwindow.h | 1 + cinelerra-5.1/cinelerra/playbackprefs.C | 4 +- cinelerra-5.1/cinelerra/recordprefs.C | 2 +- cinelerra-5.1/cinelerra/resourcepixmap.C | 94 ++-- cinelerra-5.1/cinelerra/resourcepixmap.h | 1 + cinelerra-5.1/cinelerra/theme.C | 42 +- cinelerra-5.1/cinelerra/theme.h | 11 +- cinelerra-5.1/cinelerra/zoombar.C | 33 +- cinelerra-5.1/cinelerra/zoombar.h | 33 +- cinelerra-5.1/cinelerra/zoombar.inc | 11 + cinelerra-5.1/guicast/bcbitmap.C | 16 +- cinelerra-5.1/guicast/bcbitmap.h | 8 +- cinelerra-5.1/guicast/bcpixmap.C | 12 +- cinelerra-5.1/guicast/bcwindowdraw.C | 553 ++++++----------------- cinelerra-5.1/inst.sh | 4 +- 24 files changed, 345 insertions(+), 597 deletions(-) diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index 76692f0d..f40a95f8 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -311,7 +311,7 @@ void ColorWindow::update_display() int ColorWindow::handle_event() { - thread->handle_new_color(rgb888(), (int)(255*aph + 0.5)); + thread->handle_new_color(rgb888(), alpha8()); return 1; } @@ -360,8 +360,12 @@ int ColorWindow::button_release_event() void ColorWindow::update_rgb_hex(const char *hex) { - int color; + unsigned color; if( sscanf(hex,"%x",&color) == 1 ) { + if( thread->do_alpha ) { + aph = ((color>>24) & 0xff) / 255.; + aph_a->update(aph); + } float r = ((color>>16) & 0xff) / 255.; float g = ((color>>8) & 0xff) / 255.; float b = ((color>>0) & 0xff) / 255.; @@ -807,6 +811,7 @@ int PaletteAlpha::handle_event() { window->aph = get_value(); window->aph_a->update(window->aph); + window->hex_box->update(); window->handle_event(); return 1; } @@ -973,6 +978,12 @@ int ColorWindow::rgb888() bclamp(r, 0, 255); bclamp(g, 0, 255); bclamp(b, 0, 255); return (r<<16) | (g<<8) | (b<<0); } +int ColorWindow::alpha8() +{ + int a = 255*aph + 0.5; + bclamp(a, 0, 255); + return a; +} PaletteNum::PaletteNum(ColorWindow *window, int x, int y, float &output, float min, float max) @@ -1047,7 +1058,10 @@ PaletteHex::~PaletteHex() } void PaletteHex::update() { - char hex[BCSTRLEN]; sprintf(hex,"%06x",window->rgb888()); + char hex[BCSTRLEN], *cp = hex; + if( window->thread->do_alpha ) + cp += sprintf(cp,"%02x", window->alpha8()); + sprintf(cp,"%06x",window->rgb888()); BC_TextBox::update(hex); } diff --git a/cinelerra-5.1/cinelerra/colorpicker.h b/cinelerra-5.1/cinelerra/colorpicker.h index a5d203d2..5f8b1337 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.h +++ b/cinelerra-5.1/cinelerra/colorpicker.h @@ -83,6 +83,7 @@ public: void update_yuv(float y, float u, float v); void update_rgb_hex(const char *hex); int rgb888(); + int alpha8(); ColorPicker *thread; PaletteWheel *wheel; diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 347e9408..79e95f36 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -86,7 +86,7 @@ void Edit::reset() is_selected = 0; hard_left = 0; hard_right = 0; - color = -1; + color = 0; } Indexable* Edit::get_source() @@ -817,21 +817,3 @@ void Edit::get_title(char *title) } } -int Edit::get_hash_color() -{ - Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl; - if( !idxbl ) return -1; - int v = 0; - for( uint8_t *bp=(uint8_t*)idxbl->path; *bp; ++bp ) v += *bp; - int color = 0x303030; - if( v & 0x01 ) color ^= 0x000040; - if( v & 0x02 ) color ^= 0x004000; - if( v & 0x04 ) color ^= 0x400000; - if( v & 0x08 ) color ^= 0x080000; - if( v & 0x10 ) color ^= 0x000800; - if( v & 0x20 ) color ^= 0x000008; - if( v & 0x40 ) color ^= 0x202020; - if( v & 0x80 ) color ^= 0x101010; - return color; -} - diff --git a/cinelerra-5.1/cinelerra/edit.h b/cinelerra-5.1/cinelerra/edit.h index a23f92e1..67b09159 100644 --- a/cinelerra-5.1/cinelerra/edit.h +++ b/cinelerra-5.1/cinelerra/edit.h @@ -169,10 +169,6 @@ public: float zoom_units) { return 0; } virtual int64_t get_source_end(int64_t default_); void get_title(char *title); -// edit title bar color - int get_title_color(); -// default edit title bar color - int get_hash_color(); int dump(FILE *fp=stdout); virtual int dump_derived() { return 0; } diff --git a/cinelerra-5.1/cinelerra/editpopup.C b/cinelerra-5.1/cinelerra/editpopup.C index 7ba0e6a1..cbc57606 100644 --- a/cinelerra-5.1/cinelerra/editpopup.C +++ b/cinelerra-5.1/cinelerra/editpopup.C @@ -423,10 +423,11 @@ int EditPopupTitleColor::handle_event() { if( popup->edit ) { int color = popup->mwindow->get_title_color(popup->edit); - if( color < 0 ) color = popup->mwindow->theme->get_color_title_bg(); + if( !color ) color = popup->mwindow->theme->get_color_title_bg(); delete color_picker; - color_picker = new EditTitleColorPicker(popup); - color_picker->start_window(color, -1, 1); + color_picker = new EditTitleColorPicker(popup, color); + int alpha = (~color>>24) & 0xff; + color_picker->start_window(color & 0xffffff, alpha, 1); } return 1; } @@ -440,30 +441,31 @@ EditTitleColorDefault::EditTitleColorDefault( int EditTitleColorDefault::handle_event() { - int color = color_picker->popup->mwindow->theme->get_color_title_bg(); - color_picker->update_gui(color, -1); + color_picker->color = 0; + color_picker->update_gui(0, 0); return 1; } -EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup) - : ColorPicker(0, _("Bar Color")) +EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup, int color) + : ColorPicker(1, _("Bar Color")) { this->popup = popup; - color = -1; + this->color = color; } EditTitleColorPicker::~EditTitleColorPicker() { } void EditTitleColorPicker::create_objects(ColorWindow *gui) { - int y = gui->get_h() - BC_CancelButton::calculate_h() - 50; - int x = gui->get_w() - BC_GenericButton::calculate_w(gui, _("default")) - 15; + int y = gui->get_h() - BC_CancelButton::calculate_h() + 10; + int x = gui->get_w() - BC_CancelButton::calculate_w() - 10; + x -= BC_GenericButton::calculate_w(gui, _("default")) + 15; gui->add_subwindow(new EditTitleColorDefault(this, x, y)); } int EditTitleColorPicker::handle_new_color(int color, int alpha) { - this->color = color; + this->color = color | (~alpha << 24); return 1; } diff --git a/cinelerra-5.1/cinelerra/editpopup.h b/cinelerra-5.1/cinelerra/editpopup.h index f0ef10d6..90fd9ace 100644 --- a/cinelerra-5.1/cinelerra/editpopup.h +++ b/cinelerra-5.1/cinelerra/editpopup.h @@ -234,7 +234,7 @@ public: class EditTitleColorPicker : public ColorPicker { public: - EditTitleColorPicker(EditPopup *popup); + EditTitleColorPicker(EditPopup *popup, int color); ~EditTitleColorPicker(); void create_objects(ColorWindow *gui); int handle_new_color(int color, int alpha); diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index d8e563d6..ef81185a 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -68,6 +68,7 @@ MainSession::MainSession(MWindow *mwindow) zwindow_fullscreen = 0; selected_zwindow = -1; actual_frame_rate = 0; + title_bar_alpha = 0; window_config = 0; a_x11_host[0] = 0; b_x11_host[0] = 0; @@ -450,6 +451,7 @@ int MainSession::load_defaults(BC_Hash *defaults) current_tip = defaults->get("CURRENT_TIP", current_tip); actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1); + title_bar_alpha = defaults->get("TITLE_BAR_ALPHA", (float)0); boundaries(); return 0; @@ -569,6 +571,7 @@ int MainSession::save_defaults(BC_Hash *defaults) defaults->update("TRANSITIONDIALOG_H", transitiondialog_h); defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate); + defaults->update("TITLE_BAR_ALPHA", title_bar_alpha); defaults->update("CURRENT_TIP", current_tip); diff --git a/cinelerra-5.1/cinelerra/mainsession.h b/cinelerra-5.1/cinelerra/mainsession.h index 92e40a59..8cbc35c3 100644 --- a/cinelerra-5.1/cinelerra/mainsession.h +++ b/cinelerra-5.1/cinelerra/mainsession.h @@ -114,6 +114,9 @@ public: // filename of the current project for window titling and saving char filename[BCTEXTLEN]; +// title bar background blend + float title_bar_alpha; + int batchrender_x, batchrender_y, batchrender_w, batchrender_h; // Window positions diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 77c1eba1..263bbd98 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -3292,12 +3292,44 @@ void MWindow::hide_keyframe_gui(Plugin *plugin) keyframe_gui_lock->unlock(); } +int MWindow::get_hash_color(Edit *edit) +{ + Indexable *idxbl = edit->asset ? + (Indexable*)edit->asset : (Indexable*)edit->nested_edl; + if( !idxbl ) return 0; + char path[BCTEXTLEN]; + if( !edit->asset || edit->track->data_type != TRACK_VIDEO || + edl->session->proxy_scale == 1 || + ProxyRender::from_proxy_path(path, idxbl, edl->session->proxy_scale) ) + strcpy(path, idxbl->path); + char *cp = strrchr(path, '/'); + cp = !cp ? path : cp+1; + uint8_t *bp = (uint8_t*)cp; + int v = 0; + while( *bp ) v += *bp++; + int hash = 0x303030; + if( v & 0x01 ) hash ^= 0x000040; + if( v & 0x02 ) hash ^= 0x004000; + if( v & 0x04 ) hash ^= 0x400000; + if( v & 0x08 ) hash ^= 0x080000; + if( v & 0x10 ) hash ^= 0x000800; + if( v & 0x20 ) hash ^= 0x000008; + if( v & 0x40 ) hash ^= 0x404040; + if( v & 0x80 ) hash ^= 0x080808; + return hash; +} + int MWindow::get_title_color(Edit *edit) { - int color = edit->color; - if( color < 0 && preferences->autocolor_assets ) - color = edit->get_hash_color(); - return color; + unsigned color = edit->color; + if( !color ) { + if( !preferences->autocolor_assets ) return 0; + color = get_hash_color(edit); + } + unsigned alpha = (~edit->color>>24) & 0xff; + if( alpha == 0xff ) + alpha = session->title_bar_alpha*255; + return color | (~alpha<<24); } void MWindow::update_keyframe_guis() diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index ab2d8d58..4371099e 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -310,6 +310,7 @@ public: void hide_keyframe_guis(); void hide_keyframe_gui(Plugin *plugin); void update_keyframe_guis(); + int get_hash_color(Edit *edit); int get_title_color(Edit *edit); // ============================= editing commands ======================== diff --git a/cinelerra-5.1/cinelerra/playbackprefs.C b/cinelerra-5.1/cinelerra/playbackprefs.C index d8491313..264566f1 100644 --- a/cinelerra-5.1/cinelerra/playbackprefs.C +++ b/cinelerra-5.1/cinelerra/playbackprefs.C @@ -157,7 +157,7 @@ SET_TRACE SET_TRACE add_subwindow(title1 = new BC_Title(x, y, _("Scaling equation: Enlarge / Reduce "))); VScalingEquation *vscaling_equation = - new VScalingEquation(x + title1->get_w() + 10, y, + new VScalingEquation(x + title1->get_w() + 65, y, &pwindow->thread->edl->session->interpolation_type); add_subwindow(vscaling_equation); vscaling_equation->create_objects(); @@ -170,7 +170,7 @@ SET_TRACE subtitle_number = new PlaybackSubtitleNumber(x1, y, pwindow, this); subtitle_number->create_objects(); - x2 = x + title1->get_w() + 10 + subtitle_number->get_w() + 30; + x2 = x + title1->get_w() + 10 + subtitle_number->get_w() + 85; PlaybackSubtitle *subtitle_toggle; x1 += subtitle_number->get_w() + margin; add_subwindow(subtitle_toggle = new PlaybackSubtitle(x2, y, pwindow, this)); diff --git a/cinelerra-5.1/cinelerra/recordprefs.C b/cinelerra-5.1/cinelerra/recordprefs.C index 5a023a22..318cbfb4 100644 --- a/cinelerra-5.1/cinelerra/recordprefs.C +++ b/cinelerra-5.1/cinelerra/recordprefs.C @@ -205,7 +205,7 @@ void RecordPrefs::create_objects() x1 = x; add_subwindow(new BC_Title(x1, y, _("Positioning:"))); - x1 += 100; + x1 += 120; add_subwindow(textbox = new BC_TextBox(x1, y, 200, 1, "")); RecordPositioning *positioning = new RecordPositioning(pwindow,textbox); add_subwindow(positioning); diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index eb276561..0da77299 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -194,16 +194,13 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, refresh_w = pixmap_w; // Draw background image - if( refresh_w > 0 ) - mwindow->theme->draw_resource_bg(canvas, - this, - edit_x, - edit_w, - pixmap_x, - refresh_x, - y, - refresh_x + refresh_w, - mwindow->edl->local_session->zoom_track + y); + if( refresh_w > 0 ) { + int x1 = refresh_x, x2 = x1 + refresh_w; + int y1 = y, y2 = y1 + mwindow->edl->local_session->zoom_track; + int color = mwindow->get_title_color(edit); + mwindow->theme->draw_resource_bg(canvas, this, color, + edit_x, edit_w, pixmap_x, x1,y1, x2,y2); + } //printf("ResourcePixmap::draw_data 70\n"); @@ -214,28 +211,18 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas, { case TRACK_AUDIO: draw_audio_resource(canvas, - edit, - refresh_x, - refresh_w); + edit, refresh_x, refresh_w); break; case TRACK_VIDEO: - draw_video_resource(canvas, - edit, - edit_x, - edit_w, - pixmap_x, - pixmap_w, - refresh_x, - refresh_w, + draw_video_resource(canvas, edit, edit_x, edit_w, + pixmap_x, pixmap_w, refresh_x, refresh_w, mode); break; case TRACK_SUBTITLE: - draw_subttl_resource(canvas, - edit, - refresh_x, - refresh_w); + draw_subttl_resource(canvas, edit, + refresh_x, refresh_w); break; } } @@ -245,24 +232,57 @@ SET_TRACE VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color) { - if( color < 0 ) return title_bg; int colormodel = title_bg->get_color_model(); int bpp = BC_CModels::calculate_pixelsize(colormodel); - int tw = title_bg->get_w(), th = title_bg->get_h(); + int tw = title_bg->get_w(), tw1 = tw-1, th = title_bg->get_h(); VFrame *title_bar = new VFrame(tw, th, colormodel); uint8_t cr = (color>>16), cg = (color>>8), cb = (color>>0); uint8_t **bar_rows = title_bar->get_rows(); - for( int y=0; y 0 ) { + uint8_t *cp = bar_rows[0]; for( int x=0; x 3 ) cp[3] = 0xff; + cp += bpp; + } + } + for( int y=1; y 0 ) { + cp[0] = cp[1] = cp[2] = 0; + if( bpp > 3 ) cp[3] = 0xff; + cp += bpp; + } + for( int x=1; x 3 ) cp[3] = 0xff; cp += bpp; } + if( tw > 1 ) { + cp[0] = cp[1] = cp[2] = 0; + if( bpp > 3 ) cp[3] = 0xff; + } } return title_bar; } +VFrame *ResourcePixmap::change_picon_alpha(VFrame *picon_frame, int alpha) +{ + uint8_t **picon_rows = picon_frame->get_rows(); + int w = picon_frame->get_w(), h = picon_frame->get_h(); + VFrame *frame = new VFrame(w, h, BC_RGBA8888); + uint8_t **rows = frame->get_rows(); + for( int y=0; ytheme->get_image("title_bg_data"); int color = mwindow->get_title_color(edit); - VFrame *title_bar = color < 0 ? title_bg : + VFrame *title_bar = !color ? title_bg : change_title_color(title_bg, color); canvas->draw_3segmenth(x, 0, w, total_x, total_w, title_bar, this); if( title_bar != title_bg ) delete title_bar; @@ -592,8 +612,20 @@ void ResourcePixmap::draw_video_resource(TrackCanvas *canvas, mwindow->frame_cache->get_frame_ptr(speed_position, edit->channel, mwindow->edl->session->frame_rate, BC_RGB888, picon_w, picon_h, indexable->id); + int bg_color = gui->get_bg_color(); if( picon_frame ) { - draw_vframe(picon_frame, x, y, picon_w, picon_h, 0, 0); + VFrame *frame = picon_frame; + int color = mwindow->get_title_color(edit); + if( color ) { + int alpha = (~color >> 24) & 0xff; + frame = change_picon_alpha(picon_frame, alpha); + gui->set_bg_color(color & 0xffffff); + } + draw_vframe(frame, x, y, picon_w, picon_h, 0, 0); + if( frame != picon_frame ) { + delete frame; + gui->set_bg_color(bg_color); + } mwindow->frame_cache->unlock(); } else if( mode != IGNORE_THREAD ) { diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.h b/cinelerra-5.1/cinelerra/resourcepixmap.h index 931877fe..7f5fba2c 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.h +++ b/cinelerra-5.1/cinelerra/resourcepixmap.h @@ -61,6 +61,7 @@ public: void draw_wave(TrackCanvas *canvas, int x, double high, double low); VFrame *change_title_color(VFrame *title_bg, int color); + VFrame *change_picon_alpha(VFrame *picon_frame, int alpha); void draw_title(TrackCanvas *canvas, Edit *edit, int64_t edit_x, int64_t edit_w, int64_t pixmap_x, int64_t pixmap_w); diff --git a/cinelerra-5.1/cinelerra/theme.C b/cinelerra-5.1/cinelerra/theme.C index 5a1d95d6..55e2cbc0 100644 --- a/cinelerra-5.1/cinelerra/theme.C +++ b/cinelerra-5.1/cinelerra/theme.C @@ -896,36 +896,34 @@ void Theme::draw_rwindow_bg(RecordGUI *gui) } -void Theme::draw_resource_bg(TrackCanvas *canvas, - ResourcePixmap *pixmap, - int edit_x, - int edit_w, - int pixmap_x, - int x1, - int y1, - int x2, - int y2) +void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int color, + int edit_x, int edit_w, int pixmap_x, int x1, int y1, int x2, int y2) { - VFrame *image; + VFrame *image = 0; - switch(mwindow->edl->local_session->zoom_track) - { + switch(mwindow->edl->local_session->zoom_track) { case 1024: image = get_image("resource1024"); break; case 512: image = get_image("resource512"); break; case 256: image = get_image("resource256"); break; case 128: image = get_image("resource128"); break; case 64: image = get_image("resource64"); break; - default: - case 32: image = get_image("resource32"); break; } - - canvas->draw_3segmenth(x1, - y1, - x2 - x1, - edit_x - pixmap_x, - edit_w, - image, - pixmap); + if( !image ) + image = get_image("resource32"); + + VFrame *frame = image; + int bg_color = canvas->get_bg_color(); + if( color ) { + int alpha = (~color >> 24) & 0xff; + frame = pixmap->change_picon_alpha(image, alpha); + canvas->set_bg_color(color & 0xffffff); + } + canvas->draw_3segmenth(x1, y1, x2 - x1, + edit_x - pixmap_x, edit_w, frame, pixmap); + if( frame != image ) { + delete frame; + canvas->set_bg_color(bg_color); + } } diff --git a/cinelerra-5.1/cinelerra/theme.h b/cinelerra-5.1/cinelerra/theme.h index 028957cf..5873fcd8 100644 --- a/cinelerra-5.1/cinelerra/theme.h +++ b/cinelerra-5.1/cinelerra/theme.h @@ -104,15 +104,8 @@ public: virtual void draw_lwindow_bg(LevelWindowGUI *gui); virtual void draw_mwindow_bg(MWindowGUI *gui); virtual void draw_vwindow_bg(VWindowGUI *gui); - virtual void draw_resource_bg(TrackCanvas *canvas, - ResourcePixmap *pixmap, - int edit_x, - int edit_w, - int pixmap_x, - int x1, - int y1, - int x2, - int y2); + virtual void draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int color, + int edit_x, int edit_w, int pixmap_x, int x1, int y1, int x2, int y2); virtual void get_preferences_sizes(); virtual void draw_preferences_bg(PreferencesWindow *gui); diff --git a/cinelerra-5.1/cinelerra/zoombar.C b/cinelerra-5.1/cinelerra/zoombar.C index 408473d6..9f1c95bc 100644 --- a/cinelerra-5.1/cinelerra/zoombar.C +++ b/cinelerra-5.1/cinelerra/zoombar.C @@ -39,8 +39,6 @@ #include "zoombar.h" - - ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui) : BC_SubWindow(mwindow->theme->mzoom_x, mwindow->theme->mzoom_y, @@ -49,7 +47,6 @@ ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui) { this->gui = gui; this->mwindow = mwindow; - old_position = 0; } ZoomBar::~ZoomBar() @@ -107,14 +104,12 @@ void ZoomBar::create_objects() x += length_value->get_w() + 5; add_subwindow(to_value = new ToTextBox(mwindow, this, x, y)); x += to_value->get_w() + 5; + add_subwindow(title_alpha = new TitleBarAlpha(mwindow, this, x, y)); update_formatting(from_value); update_formatting(length_value); update_formatting(to_value); - add_subwindow(playback_value = new BC_Title(x, 100, "--", MEDIUMFONT, RED)); - - add_subwindow(zoom_value = new BC_Title(x, 100, "--", MEDIUMFONT, BLACK)); update(); } @@ -198,19 +193,21 @@ int ZoomBar::update_clocks() return 0; } -int ZoomBar::update_playback(int64_t new_position) +TitleBarAlpha::TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y) + : BC_FSlider(x, y, 0, 150, 200, 0, 1.0, mwindow->session->title_bar_alpha, 0) { - if(new_position != old_position) - { - Units::totext(string, new_position, - mwindow->edl->session->sample_rate, - mwindow->edl->session->time_format, - mwindow->edl->session->frame_rate, - mwindow->edl->session->frames_per_foot); - playback_value->update(string); - old_position = new_position; - } - return 0; + this->mwindow = mwindow; + this->zoombar = zoombar; + set_precision(0.01); + set_tooltip(_("TitleBar Alpha")); +} + +int TitleBarAlpha::handle_event() +{ + mwindow->session->title_bar_alpha = get_value(); + mwindow->gui->draw_trackmovement(); + mwindow->gui->flush(); + return 1; } int ZoomBar::resize_event(int w, int h) diff --git a/cinelerra-5.1/cinelerra/zoombar.h b/cinelerra-5.1/cinelerra/zoombar.h index 729a2266..c013b019 100644 --- a/cinelerra-5.1/cinelerra/zoombar.h +++ b/cinelerra-5.1/cinelerra/zoombar.h @@ -22,23 +22,13 @@ #ifndef ZOOMBAR_H #define ZOOMBAR_H -class FromTextBox; -class LengthTextBox; -class ToTextBox; - - -class SampleZoomPanel; -class AmpZoomPanel; -class TrackZoomPanel; -class AutoZoom; -class AutoTypeMenu; -class ZoomTextBox; - #include "guicast.h" #include "mwindow.inc" #include "mwindowgui.inc" +#include "zoombar.inc" #include "zoompanel.h" + class ZoomBar : public BC_SubWindow { public: @@ -66,12 +56,11 @@ public: AutoTypeMenu *auto_type; ZoomTextBox *auto_zoom_text; - BC_Title *zoom_value, *playback_value; LengthTextBox *length_value; FromTextBox *from_value; ToTextBox *to_value; + TitleBarAlpha *title_alpha; char string[256], string2[256]; - int64_t old_position; }; class SampleZoomPanel : public ZoomPanel @@ -138,12 +127,6 @@ public: }; - - - - - - class FromTextBox : public BC_TextBox { public: @@ -178,7 +161,13 @@ public: ZoomBar *zoombar; }; - - +class TitleBarAlpha : public BC_FSlider +{ +public: + TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y); + int handle_event(); + MWindow *mwindow; + ZoomBar *zoombar; +}; #endif diff --git a/cinelerra-5.1/cinelerra/zoombar.inc b/cinelerra-5.1/cinelerra/zoombar.inc index 3ba46a55..ceb7c66b 100644 --- a/cinelerra-5.1/cinelerra/zoombar.inc +++ b/cinelerra-5.1/cinelerra/zoombar.inc @@ -23,6 +23,17 @@ #define ZOOMBAR_INC class ZoomBar; +class SampleZoomPanel; +class AmpZoomPanel; +class TrackZoomPanel; +class AutoZoom; +class AutoTypeMenu; +class ZoomTextBox; +class FromTextBox; +class LengthTextBox; +class ToTextBox; +class TitleBarAlpha; + #define ZOOMBAR_PIXELS 24 #endif diff --git a/cinelerra-5.1/guicast/bcbitmap.C b/cinelerra-5.1/guicast/bcbitmap.C index e430c071..2d8b621f 100644 --- a/cinelerra-5.1/guicast/bcbitmap.C +++ b/cinelerra-5.1/guicast/bcbitmap.C @@ -329,7 +329,6 @@ int BC_Bitmap::initialize(BC_WindowBase *parent_window, this->use_shm = !use_shm ? 0 : need_shm(); this->shm_reply = this->use_shm && resources->shm_reply ? 1 : 0; // dont use shm for less than one page - this->bg_color = parent_window->bg_color; if( !this->avail_lock ) this->avail_lock = new Mutex("BC_Bitmap::avail_lock"); else @@ -483,12 +482,6 @@ int BC_Bitmap::need_shm() parent_window->get_resources()->use_shm > 0 ? 1 : 0; } -int BC_Bitmap::set_bg_color(int color) -{ - this->bg_color = color; - return 0; -} - int BC_Bitmap::invert() { for( int j=0; jget_bg_color()); +} + +int BC_Bitmap::read_frame(VFrame *frame, int x1, int y1, int x2, int y2, int bg_color) { return read_frame(frame, 0, 0, frame->get_w(), frame->get_h(), - x1, y1, x2 - x1, y2 - y1); + x1, y1, x2 - x1, y2 - y1, bg_color); } int BC_Bitmap::read_frame(VFrame *frame, int in_x, int in_y, int in_w, int in_h, - int out_x, int out_y, int out_w, int out_h) + int out_x, int out_y, int out_w, int out_h, int bg_color) { BC_BitmapImage *bfr = cur_bfr(); if( hardware_scaling() && frame->get_color_model() == color_model ) { diff --git a/cinelerra-5.1/guicast/bcbitmap.h b/cinelerra-5.1/guicast/bcbitmap.h index 221248b9..f065000a 100644 --- a/cinelerra-5.1/guicast/bcbitmap.h +++ b/cinelerra-5.1/guicast/bcbitmap.h @@ -178,8 +178,6 @@ class BC_Bitmap long best_buffer_size(); int need_shm(); -// Background color for using pngs - int bg_color; // Override top_level for small bitmaps int use_shm; BC_WindowBase *top_level; @@ -203,10 +201,13 @@ public: // transfer VFrame int read_frame(VFrame *frame, int in_x, int in_y, int in_w, int in_h, - int out_x, int out_y, int out_w, int out_h); + int out_x, int out_y, int out_w, int out_h, + int bg_color); // x1, y1, x2, y2 dimensions of output area int read_frame(VFrame *frame, int x1, int y1, int x2, int y2); + int read_frame(VFrame *frame, + int x1, int y1, int x2, int y2, int bg_color); // Reset bitmap to match the new parameters int match_params(int w, int h, int color_model, int use_shm); // Test if bitmap already matches parameters @@ -258,7 +259,6 @@ public: int is_unshared() { return type==bmXvImage || type==bmXImage; } int is_zombie() { return cur_bfr()->is_zombie(); } - int set_bg_color(int color); int invert(); }; diff --git a/cinelerra-5.1/guicast/bcpixmap.C b/cinelerra-5.1/guicast/bcpixmap.C index 1489f5be..08491aee 100644 --- a/cinelerra-5.1/guicast/bcpixmap.C +++ b/cinelerra-5.1/guicast/bcpixmap.C @@ -46,16 +46,10 @@ BC_Pixmap::BC_Pixmap(BC_WindowBase *parent_window, if(use_opaque()) { opaque_bitmap = new BC_Bitmap(parent_window, - frame->get_w(), - frame->get_h(), - parent_window->get_color_model(), - 0); - opaque_bitmap->set_bg_color(parent_window->get_bg_color()); + frame->get_w(), frame->get_h(), + parent_window->get_color_model(), 0); opaque_bitmap->read_frame(frame, - 0, - 0, - frame->get_w(), - frame->get_h()); + 0, 0, frame->get_w(), frame->get_h()); } diff --git a/cinelerra-5.1/guicast/bcwindowdraw.C b/cinelerra-5.1/guicast/bcwindowdraw.C index c81c3696..dd0aee2f 100644 --- a/cinelerra-5.1/guicast/bcwindowdraw.C +++ b/cinelerra-5.1/guicast/bcwindowdraw.C @@ -396,21 +396,18 @@ void BC_WindowBase::truncate_text(char *result, const char *text, int w) { int new_w = get_text_width(current_font, text); - if(new_w > w) - { + if( new_w > w ) { const char* separator = "..."; int separator_w = get_text_width(current_font, separator); // can't fit - if(separator_w >= w) - { + if( separator_w >= w ) { strcpy(result, separator); return; } int text_len = strlen(text); // widen middle gap until it fits - for(int i = text_len / 2; i > 0; i--) - { + for( int i=text_len/2; i>0; --i ) { strncpy(result, text, i); result[i] = 0; strcat(result, separator); @@ -425,10 +422,8 @@ void BC_WindowBase::truncate_text(char *result, const char *text, int w) strcpy(result, separator); return; } - else - { - strcpy(result, text); - } + + strcpy(result, text); } void BC_WindowBase::draw_center_text(int x, int y, const char *text, int length) @@ -442,19 +437,13 @@ void BC_WindowBase::draw_center_text(int x, int y, const char *text, int length) void BC_WindowBase::draw_line(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap) { BT // Some X drivers can't draw 0 length lines - if(x1 == x2 && y1 == y2) - { + if( x1 == x2 && y1 == y2 ) { draw_pixel(x1, y1, pixmap); } - else - { + else { XDrawLine(top_level->display, pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - x1, - y1, - x2, - y2); + top_level->gc, x1, y1, x2, y2); } } @@ -463,18 +452,14 @@ void BC_WindowBase::draw_polygon(ArrayList *x, ArrayList *y, BC_Pixmap int npoints = MIN(x->total, y->total); XPoint *points = new XPoint[npoints]; - for(int i = 0; i < npoints; i++) - { + for( int i=0; ivalues[i]; points[i].y = y->values[i]; } XDrawLines(top_level->display, - pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - points, - npoints, - CoordModeOrigin); + pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, + top_level->gc, points, npoints, CoordModeOrigin); delete [] points; } @@ -484,19 +469,14 @@ void BC_WindowBase::fill_polygon(ArrayList *x, ArrayList *y, BC_Pixmap int npoints = MIN(x->total, y->total); XPoint *points = new XPoint[npoints]; - for(int i = 0; i < npoints; i++) - { + for( int i=0; ivalues[i]; points[i].y = y->values[i]; } XFillPolygon(top_level->display, - pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - points, - npoints, - Nonconvex, - CoordModeOrigin); + pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, + top_level->gc, points, npoints, Nonconvex, CoordModeOrigin); delete [] points; } @@ -505,24 +485,13 @@ void BC_WindowBase::fill_polygon(ArrayList *x, ArrayList *y, BC_Pixmap void BC_WindowBase::draw_rectangle(int x, int y, int w, int h) { BT XDrawRectangle(top_level->display, - pixmap->opaque_pixmap, - top_level->gc, - x, - y, - w - 1, - h - 1); + pixmap->opaque_pixmap, top_level->gc, + x, y, w - 1, h - 1); } -void BC_WindowBase::draw_3d_border(int x, - int y, - int w, - int h, - int is_down) +void BC_WindowBase::draw_3d_border(int x, int y, int w, int h, int is_down) { - draw_3d_border(x, - y, - w, - h, + draw_3d_border(x, y, w, h, top_level->get_resources()->border_shadow2, top_level->get_resources()->border_shadow1, top_level->get_resources()->border_light1, @@ -530,14 +499,8 @@ void BC_WindowBase::draw_3d_border(int x, } -void BC_WindowBase::draw_3d_border(int x, - int y, - int w, - int h, - int light1, - int light2, - int shadow1, - int shadow2) +void BC_WindowBase::draw_3d_border(int x, int y, int w, int h, + int light1, int light2, int shadow1, int shadow2) { int lx, ly, ux, uy; @@ -561,15 +524,8 @@ void BC_WindowBase::draw_3d_border(int x, draw_line(x, y + h, x + w, y + h); } -void BC_WindowBase::draw_3d_box(int x, - int y, - int w, - int h, - int light1, - int light2, - int middle, - int shadow1, - int shadow2, +void BC_WindowBase::draw_3d_box(int x, int y, int w, int h, + int light1, int light2, int middle, int shadow1, int shadow2, BC_Pixmap *pixmap) { int lx, ly, ux, uy; @@ -851,13 +807,11 @@ void BC_WindowBase::draw_check(int x, int y) void BC_WindowBase::draw_tiles(BC_Pixmap *tile, int origin_x, int origin_y, int x, int y, int w, int h) { BT - if(!tile) - { + if( !tile ) { set_color(bg_color); draw_box(x, y, w, h); } - else - { + else { XSetFillStyle(top_level->display, top_level->gc, FillTiled); // Don't know how slow this is XSetTile(top_level->display, top_level->gc, tile->get_pixmap()); @@ -872,132 +826,77 @@ void BC_WindowBase::draw_top_tiles(BC_WindowBase *parent_window, int x, int y, i Window tempwin; int origin_x, origin_y; XTranslateCoordinates(top_level->display, - parent_window->win, - win, - 0, - 0, - &origin_x, - &origin_y, - &tempwin); - + parent_window->win, win, + 0, 0, &origin_x, &origin_y, &tempwin); draw_tiles(parent_window->bg_pixmap, - origin_x, - origin_y, - x, - y, - w, - h); + origin_x, origin_y, + x, y, w, h); } void BC_WindowBase::draw_top_background(BC_WindowBase *parent_window, - int x, - int y, - int w, - int h, - BC_Pixmap *pixmap) + int x, int y, int w, int h, BC_Pixmap *pixmap) { BT Window tempwin; int top_x, top_y; XLockDisplay(top_level->display); XTranslateCoordinates(top_level->display, - win, - parent_window->win, - x, - y, - &top_x, - &top_y, - &tempwin); + win, parent_window->win, + x, y, &top_x, &top_y, &tempwin); XCopyArea(top_level->display, parent_window->pixmap->opaque_pixmap, pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - top_x, - top_y, - w, - h, - x, - y); + top_level->gc, top_x, top_y, w, h, x, y); XUnlockDisplay(top_level->display); } void BC_WindowBase::draw_background(int x, int y, int w, int h) { - if(bg_pixmap) - { + if( bg_pixmap ) { draw_tiles(bg_pixmap, 0, 0, x, y, w, h); } - else - { + else { clear_box(x, y, w, h); } } -void BC_WindowBase::draw_bitmap(BC_Bitmap *bitmap, - int dont_wait, - int dest_x, - int dest_y, - int dest_w, - int dest_h, - int src_x, - int src_y, - int src_w, - int src_h, +void BC_WindowBase::draw_bitmap(BC_Bitmap *bitmap, int dont_wait, + int dest_x, int dest_y, int dest_w, int dest_h, + int src_x, int src_y, int src_w, int src_h, BC_Pixmap *pixmap) { BT // Hide cursor if video enabled update_video_cursor(); //printf("BC_WindowBase::draw_bitmap %d dest_y=%d\n", __LINE__, dest_y); - if(dest_w <= 0 || dest_h <= 0) - { + if( dest_w <= 0 || dest_h <= 0 ) { // Use hardware scaling to canvas dimensions if proper color model. - if(bitmap->get_color_model() == BC_YUV420P) - { + if( bitmap->get_color_model() == BC_YUV420P ) { dest_w = w; dest_h = h; } - else - { + else { dest_w = bitmap->get_w(); dest_h = bitmap->get_h(); } } - if(src_w <= 0 || src_h <= 0) - { + if( src_w <= 0 || src_h <= 0 ) { src_w = bitmap->get_w(); src_h = bitmap->get_h(); } - if(video_on) - { + if( video_on ) { bitmap->write_drawable(win, - top_level->gc, - src_x, - src_y, - src_w, - src_h, - dest_x, - dest_y, - dest_w, - dest_h, - dont_wait); + top_level->gc, src_x, src_y, src_w, src_h, + dest_x, dest_y, dest_w, dest_h, dont_wait); top_level->flush(); } - else - { + else { bitmap->write_drawable(pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - dest_x, - dest_y, - src_x, - src_y, - dest_w, - dest_h, - dont_wait); + top_level->gc, dest_x, dest_y, src_x, src_y, dest_w, dest_h, dont_wait); } //printf("BC_WindowBase::draw_bitmap 2\n"); } @@ -1007,40 +906,22 @@ void BC_WindowBase::draw_pixel(int x, int y, BC_Pixmap *pixmap) { BT XDrawPoint(top_level->display, pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, - top_level->gc, - x, - y); + top_level->gc, x, y); } void BC_WindowBase::draw_pixmap(BC_Pixmap *pixmap, - int dest_x, - int dest_y, - int dest_w, - int dest_h, - int src_x, - int src_y, - BC_Pixmap *dst) + int dest_x, int dest_y, int dest_w, int dest_h, + int src_x, int src_y, BC_Pixmap *dst) { BT pixmap->write_drawable(dst ? dst->opaque_pixmap : this->pixmap->opaque_pixmap, - dest_x, - dest_y, - dest_w, - dest_h, - src_x, - src_y); + dest_x, dest_y, dest_w, dest_h, src_x, src_y); } void BC_WindowBase::draw_vframe(VFrame *frame, - int dest_x, - int dest_y, - int dest_w, - int dest_h, - int src_x, - int src_y, - int src_w, - int src_h, - BC_Pixmap *pixmap) + int dest_x, int dest_y, int dest_w, int dest_h, + int src_x, int src_y, int src_w, int src_h, + BC_Pixmap *pixmap) { if(dest_w <= 0) dest_w = frame->get_w() - src_x; if(dest_h <= 0) dest_h = frame->get_h() - src_y; @@ -1051,38 +932,17 @@ void BC_WindowBase::draw_vframe(VFrame *frame, if(src_x + src_w > frame->get_w()) src_w = frame->get_w() - src_x; if(src_y + src_h > frame->get_h()) src_h = frame->get_h() - src_y; - if(!temp_bitmap) temp_bitmap = new BC_Bitmap(this, - dest_w, - dest_h, - get_color_model(), - 0); - - temp_bitmap->match_params(dest_w, - dest_h, - get_color_model(), - 0); + if( !temp_bitmap ) + temp_bitmap = new BC_Bitmap(this, dest_w, dest_h, get_color_model(), 0); + temp_bitmap->match_params(dest_w, dest_h, get_color_model(), 0); temp_bitmap->read_frame(frame, - src_x, - src_y, - src_w, - src_h, - 0, - 0, - dest_w, - dest_h); - - draw_bitmap(temp_bitmap, - 0, - dest_x, - dest_y, - dest_w, - dest_h, - 0, - 0, - -1, - -1, - pixmap); + src_x, src_y, src_w, src_h, + 0, 0, dest_w, dest_h, bg_color); + + draw_bitmap(temp_bitmap, 0, + dest_x, dest_y, dest_w, dest_h, + 0, 0, -1, -1, pixmap); } void BC_WindowBase::draw_tooltip(const char *text) @@ -1324,12 +1184,8 @@ void BC_WindowBase::draw_3segmenth(int x, pixmap); } -void BC_WindowBase::draw_3segmenth(int x, - int y, - int w, - int total_x, - int total_w, - VFrame *image, +void BC_WindowBase::draw_3segmenth(int x, int y, int w, + int total_x, int total_w, VFrame *image, BC_Pixmap *pixmap) { if(total_w <= 0 || w <= 0 || h <= 0) return; @@ -1392,90 +1248,44 @@ void BC_WindowBase::draw_3segmenth(int x, } if(!temp_bitmap) temp_bitmap = new BC_Bitmap(top_level, - image->get_w(), - image->get_h(), - get_color_model(), - 0); - temp_bitmap->match_params(image->get_w(), - image->get_h(), - get_color_model(), - 0); + image->get_w(), image->get_h(), + get_color_model(), 0); + temp_bitmap->match_params(image->get_w(), image->get_h(), + get_color_model(), 0); temp_bitmap->read_frame(image, - 0, - 0, - image->get_w(), - image->get_h()); - - + 0, 0, image->get_w(), image->get_h(), bg_color); +// src width and height are meaningless in video_off mode //printf("BC_WindowBase::draw_3segment 2 left_out_x=%d left_out_w=%d center_out_x=%d center_out_w=%d right_out_x=%d right_out_w=%d\n", // left_out_x, left_out_w, center_out_x, center_out_w, right_out_x, right_out_w); - if(left_out_w > 0) - { - draw_bitmap(temp_bitmap, - 0, - left_out_x, - y, - left_out_w, - image->get_h(), - left_in_x, - 0, - -1, // src width and height are meaningless in video_off mode - -1, - pixmap); + if(left_out_w > 0) { + draw_bitmap(temp_bitmap, 0, + left_out_x, y, left_out_w, image->get_h(), + left_in_x, 0, -1, -1, pixmap); } - if(right_out_w > 0) - { - draw_bitmap(temp_bitmap, - 0, - right_out_x, - y, - right_out_w, - image->get_h(), - right_in_x, - 0, - -1, // src width and height are meaningless in video_off mode - -1, - pixmap); + if(right_out_w > 0) { + draw_bitmap(temp_bitmap, 0, + right_out_x, y, right_out_w, image->get_h(), + right_in_x, 0, -1, -1, pixmap); } - for(int pixel = center_out_x; - pixel < center_out_x + center_out_w; - pixel += half_image) - { + for( int pixel = center_out_x; + pixel < center_out_x + center_out_w; + pixel += half_image ) { int fragment_w = half_image; if(fragment_w + pixel > center_out_x + center_out_w) fragment_w = (center_out_x + center_out_w) - pixel; //printf("BC_WindowBase::draw_3segment 2 pixel=%d fragment_w=%d\n", pixel, fragment_w); - draw_bitmap(temp_bitmap, - 0, - pixel, - y, - fragment_w, - image->get_h(), - third_image, - 0, - -1, // src width and height are meaningless in video_off mode - -1, - pixmap); + draw_bitmap(temp_bitmap, 0, + pixel, y, fragment_w, image->get_h(), + third_image, 0, -1, -1, pixmap); } } - - - - - - -void BC_WindowBase::draw_3segmenth(int x, - int y, - int w, - int total_x, - int total_w, - BC_Pixmap *src, - BC_Pixmap *dst) +void BC_WindowBase::draw_3segmenth(int x, int y, int w, int total_x, int total_w, + BC_Pixmap *src, BC_Pixmap *dst) { if(w <= 0 || total_w <= 0) return; if(!src) printf("BC_WindowBase::draw_3segmenth src=0\n"); @@ -1724,10 +1534,7 @@ void BC_WindowBase::draw_3segmentv(int x, get_color_model(), 0); temp_bitmap->read_frame(src, - 0, - 0, - src->get_w(), - src->get_h()); + 0, 0, src->get_w(), src->get_h(), bg_color); if(left_out_h > 0) @@ -2045,12 +1852,8 @@ void BC_WindowBase::draw_9segment(int x, } -void BC_WindowBase::draw_9segment(int x, - int y, - int w, - int h, - VFrame *src, - BC_Pixmap *dst) +void BC_WindowBase::draw_9segment(int x, int y, int w, int h, + VFrame *src, BC_Pixmap *dst) { if(w <= 0 || h <= 0) return; @@ -2092,190 +1895,90 @@ void BC_WindowBase::draw_9segment(int x, get_color_model(), 0); temp_bitmap->read_frame(src, - 0, - 0, - src->get_w(), - src->get_h()); + 0, 0, src->get_w(), src->get_h(), bg_color); // Segment 1 - draw_bitmap(temp_bitmap, - 0, - x + out_x1, - y + out_y1, - out_x2 - out_x1, - out_y2 - out_y1, - in_x1, - in_y1, - in_x2 - in_x1, - in_y2 - in_y1, + draw_bitmap(temp_bitmap, 0, + x + out_x1, y + out_y1, out_x2 - out_x1, out_y2 - out_y1, + in_x1, in_y1, in_x2 - in_x1, in_y2 - in_y1, dst); - // Segment 2 * n - for(int i = out_x2; i < out_x3; i += in_x3 - in_x2) - { - if(out_x3 - i > 0) - { + for( int i = out_x2; i < out_x3; i += in_x3 - in_x2 ) { + if( out_x3 - i > 0 ) { int w = MIN(in_x3 - in_x2, out_x3 - i); - draw_bitmap(temp_bitmap, - 0, - x + i, - y + out_y1, - w, - out_y2 - out_y1, - in_x2, - in_y1, - w, - in_y2 - in_y1, + draw_bitmap(temp_bitmap, 0, + x + i, y + out_y1, w, out_y2 - out_y1, + in_x2, in_y1, w, in_y2 - in_y1, dst); } } - - - - // Segment 3 - draw_bitmap(temp_bitmap, - 0, - x + out_x3, - y + out_y1, - out_x4 - out_x3, - out_y2 - out_y1, - in_x3, - in_y1, - in_x4 - in_x3, - in_y2 - in_y1, + draw_bitmap(temp_bitmap, 0, + x + out_x3, y + out_y1, out_x4 - out_x3, out_y2 - out_y1, + in_x3, in_y1, in_x4 - in_x3, in_y2 - in_y1, dst); - - // Segment 4 * n - for(int i = out_y2; i < out_y3; i += in_y3 - in_y2) - { - if(out_y3 - i > 0) - { + for( int i = out_y2; i < out_y3; i += in_y3 - in_y2 ) { + if( out_y3 - i > 0 ) { int h = MIN(in_y3 - in_y2, out_y3 - i); - draw_bitmap(temp_bitmap, - 0, - x + out_x1, - y + i, - out_x2 - out_x1, - h, - in_x1, - in_y2, - in_x2 - in_x1, - h, + draw_bitmap(temp_bitmap, 0, + x + out_x1, y + i, out_x2 - out_x1, h, + in_x1, in_y2, in_x2 - in_x1, h, dst); } } - // Segment 5 * n * n - for(int i = out_y2; i < out_y3; i += in_y3 - in_y2) - { - if(out_y3 - i > 0) - { + for( int i = out_y2; i < out_y3; i += in_y3 - in_y2 ) { + if( out_y3 - i > 0 ) { int h = MIN(in_y3 - in_y2, out_y3 - i); - - for(int j = out_x2; j < out_x3; j += in_x3 - in_x2) - { + for( int j = out_x2; j < out_x3; j += in_x3 - in_x2 ) { int w = MIN(in_x3 - in_x2, out_x3 - j); if(out_x3 - j > 0) - draw_bitmap(temp_bitmap, - 0, - x + j, - y + i, - w, - h, - in_x2, - in_y2, - w, - h, + draw_bitmap(temp_bitmap, 0, + x + j, y + i, w, h, + in_x2, in_y2, w, h, dst); } } } // Segment 6 * n - for(int i = out_y2; i < out_y3; i += in_y_third) - { - if(out_y3 - i > 0) - { + for( int i = out_y2; i < out_y3; i += in_y_third ) { + if( out_y3 - i > 0 ) { int h = MIN(in_y_third, out_y3 - i); - draw_bitmap(temp_bitmap, - 0, - x + out_x3, - y + i, - out_x4 - out_x3, - h, - in_x3, - in_y2, - in_x4 - in_x3, - h, + draw_bitmap(temp_bitmap, 0, + x + out_x3, y + i, out_x4 - out_x3, h, + in_x3, in_y2, in_x4 - in_x3, h, dst); } } - - - // Segment 7 - draw_bitmap(temp_bitmap, - 0, - x + out_x1, - y + out_y3, - out_x2 - out_x1, - out_y4 - out_y3, - in_x1, - in_y3, - in_x2 - in_x1, - in_y4 - in_y3, + draw_bitmap(temp_bitmap, 0, + x + out_x1, y + out_y3, out_x2 - out_x1, out_y4 - out_y3, + in_x1, in_y3, in_x2 - in_x1, in_y4 - in_y3, dst); - // Segment 8 * n - for(int i = out_x2; i < out_x3; i += in_x_third) - { - if(out_x3 - i > 0) - { + for( int i = out_x2; i < out_x3; i += in_x_third ) { + if( out_x3 - i > 0 ) { int w = MIN(in_x_third, out_x3 - i); - draw_bitmap(temp_bitmap, - 0, - x + i, - y + out_y3, - w, - out_y4 - out_y3, - in_x2, - in_y3, - w, - in_y4 - in_y3, + draw_bitmap(temp_bitmap, 0, + x + i, y + out_y3, w, out_y4 - out_y3, + in_x2, in_y3, w, in_y4 - in_y3, dst); } } - - // Segment 9 - draw_bitmap(temp_bitmap, - 0, - x + out_x3, - y + out_y3, - out_x4 - out_x3, - out_y4 - out_y3, - in_x3, - in_y3, - in_x4 - in_x3, - in_y4 - in_y3, + draw_bitmap(temp_bitmap, 0, + x + out_x3, y + out_y3, out_x4 - out_x3, out_y4 - out_y3, + in_x3, in_y3, in_x4 - in_x3, in_y4 - in_y3, dst); } - - - - - - - - diff --git a/cinelerra-5.1/inst.sh b/cinelerra-5.1/inst.sh index e7a20c4c..27f7a706 100755 --- a/cinelerra-5.1/inst.sh +++ b/cinelerra-5.1/inst.sh @@ -1,13 +1,11 @@ #!/bin/bash -e # inst.sh -cr=' -' dir="$1"; shift 1 mkdir -p "$dir" if [ "$*" = "*" ]; then exit; fi for f in "$@"; do - if [ -f "$f" ]; then ( umask 755; cp "$f" "$dir" ); continue; fi + if [ -f "$f" ]; then cp "$f" "$dir"; continue; fi if [ -d "$f" ]; then ( cd $f; $inst_sh "$dir/$f" * ) else echo "*** Error - inst.sh $f in $dir failed." 1>&2; exit 1; fi done -- 2.26.2