#include "file.h"
#include "filesystem.h"
#include "language.h"
+#include "overlayframe.h"
#include "scopewindow.h"
#include "theme.h"
uint8_t *vp = rows[iy] + ix*3 + (comp); \
int v = *vp+(iv); *vp = v>0xff ? 0xff : v; } \
}
-#define incr_points(rows,h, rv,gv,bv) { \
+#define incr_points(rows,h, rv,gv,bv, comps) { \
if(iy >= 0 && iy < h) { \
- uint8_t *vp = rows[iy] + ix*3; \
+ uint8_t *vp = rows[iy] + ix*comps; \
int v = *vp+(rv); *vp++ = v>0xff ? 0xff : v; \
v = *vp+(gv); *vp++ = v>0xff ? 0xff : v; \
v = *vp+(bv); *vp = v>0xff ? 0xff : v; } \
}
-#define decr_points(rows,h, rv,gv,bv) { \
+#define decr_points(rows,h, rv,gv,bv, comps) { \
if(iy >= 0 && iy < h) { \
- uint8_t *vp = rows[iy] + ix*3; \
+ uint8_t *vp = rows[iy] + ix*comps; \
int v = *vp-(rv); *vp++ = v<0 ? 0 : v; \
v = *vp-(gv); *vp++ = v<0 ? 0 : v; \
v = *vp-(bv); *vp = v<0 ? 0 : v; } \
float binc = yinc*(b-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \
int iy = wave_h - ((intensity - FLOAT_MIN) / \
(FLOAT_MAX - FLOAT_MIN) * wave_h); \
- incr_points(waveform_rows,wave_h, rinc, ginc, binc); \
+ incr_points(waveform_rows,wave_h, rinc, ginc, binc, 3); \
} \
} \
} \
int rv = r + 3; \
int gv = g + 3; \
int bv = b + 3; \
- incr_points(vector_rows,vector_h, rv,gv,bv); \
+ incr_points(vector_rows,vector_h, rv,gv,bv, 4); \
} \
else if(use_vector < 0) { \
double t = TO_RAD(-h); \
int ix = vector_cx + adjacent * (s) / (FLOAT_MAX) * radius; \
int iy = vector_cy - opposite * (s) / (FLOAT_MAX) * radius; \
CLAMP(ix, 0, vector_w - 1); \
- decr_points(vector_rows,vector_h, vinc,vinc,vinc); \
+ decr_points(vector_rows,vector_h, vinc,vinc,vinc, 4); \
} \
}
delete temp_frame;
delete wave_slider;
delete vect_slider;
- delete grad_image;
- delete grad_pixmap;
+ delete grat_image;
+ delete overlay;
}
void ScopeGUI::reset()
temp_frame = 0;
wave_slider = 0;
vect_slider = 0;
- grad_image = 0;
- grad_pixmap = 0;
- grad_idx = 0;
- vect_grads = 0;
+ grat_image = 0;
+ overlay = 0;
+ grat_idx = 0;
+ vect_grats = 0;
output_frame = 0;
data_frame = 0;
if( use_wave && use_wave_parade )
use_wave = 0;
if( !engine ) engine = new ScopeEngine(this, cpus);
- grad_idx = use_graticule; // last graticule
+ grat_idx = use_graticule; // last graticule
use_graticule = 0;
lock_window("ScopeGUI::create_objects");
y += smooth->get_h() + margin;
add_subwindow(scope_menu = new ScopeMenu(this, x, y));
scope_menu->create_objects();
- x += scope_menu->get_w() + margin;
- add_subwindow(value_text = new BC_Title(x, y, ""));
y += scope_menu->get_h() + margin;
create_panels();
vect_slider = new ScopeVectSlider(this, vx, vy, slider_w);
vect_slider->create_objects();
if( use_vector < 0 ) {
- vect_grads = new ScopeVectGrads(this, vector_x, 2*margin);
- add_subwindow(vect_grads);
- vect_grads->create_objects();
+ vect_grats = new ScopeVectGrats(this, vx, 2*margin);
+ add_subwindow(vect_grats);
+ vect_grats->create_objects();
}
}
else {
vectorscope->clear_box(0, 0, vector_w, vector_h);
vect_slider->reposition_window(vx, vy);
if( use_vector > 0 ) {
- delete vect_grads; vect_grads = 0;
+ delete vect_grats; vect_grats = 0;
}
- else if( !vect_grads ) {
- vect_grads = new ScopeVectGrads(this, vector_x, 2*margin);
- add_subwindow(vect_grads);
- vect_grads->create_objects();
+ else if( !vect_grats ) {
+ vect_grats = new ScopeVectGrats(this, vx, 2*margin);
+ add_subwindow(vect_grats);
+ vect_grats->create_objects();
}
else
- vect_grads->reposition_window(vector_x, 2*margin);
+ vect_grats->reposition_window(vx, 2*margin);
}
}
else if( !use_vector && vectorscope ) {
delete vectorscope; vectorscope = 0;
delete vect_slider; vect_slider = 0;
- delete vect_grads; vect_grads = 0;
+ delete vect_grats; vect_grats = 0;
}
if( (use_hist || use_hist_parade) ) {
waveform_vframe = new VFrame(w, h, BC_RGB888);
w = MAX(vector_w, xs16);
h = MAX(vector_h, ys16);
- vector_vframe = new VFrame(w, h, BC_RGB888);
+ vector_vframe = new VFrame(w, h, BC_RGBA8888);
+ vector_vframe->set_clear_color(BLACK, 0xff);
wheel_vframe = 0;
}
int vx = vector_x + vector_w - vect_slider->get_w() - margin;
int vy = vector_y - vect_slider->get_h() - margin;
vect_slider->reposition_window(vx, vy);
- if( vect_grads )
- vect_grads->reposition_window(vector_x, 2*margin);
+ if( vect_grats )
+ vect_grats->reposition_window(vx, 2*margin);
}
allocate_vframes();
clear_points(0);
- update_scope();
draw_overlays(1, 1, 1);
+ update_scope();
return 1;
}
}
// Vectorscope overlay
if( vectorscope && use_vector ) {
- draw_graticule();
set_color(text_color);
vectorscope->draw_point();
vectorscope->flash(0);
if(flush) this->flush();
}
-void ScopeGUI::draw_graticule()
+void ScopeGUI::draw_scope()
{
+ int graticule = use_vector < 0 ? grat_idx : 0;
+ if( grat_image && use_graticule != graticule ) {
+ delete grat_image; grat_image = 0;
+ }
+ if( !grat_image && graticule > 0 )
+ grat_image = VFramePng::vframe_png(grat_paths[graticule]);
+ if( grat_image ) {
+ if( !overlay )
+ overlay = new OverlayFrame(1);
+ int cx = vector_cx, cy = vector_cy, r = radius;
+ int iw = grat_image->get_w(), ih = grat_image->get_h();
+ overlay->overlay(vector_vframe, grat_image,
+ 0,0, iw, ih, cx-r,cy-r, cx+r, cy+r,
+ 1, TRANSFER_NORMAL, CUBIC_CUBIC);
+ }
+ use_graticule = graticule;
+ vectorscope->draw_vframe(vector_vframe);
if( use_vector > 0 ) {
int margin = theme->widget_border;
set_line_dashes(1);
float th = TO_RAD(90 + 32.875);
vectorscope->draw_radient(th, 0.1f, .75f, dark_color);
}
- else if( use_vector < 0 ) {
- if( grad_image && grad_idx != use_graticule ) {
- delete grad_image; grad_image = 0;
- use_graticule = 0;
- }
- if( !grad_image && grad_idx > 0 ) {
- grad_image = VFramePng::vframe_png(grad_paths[grad_idx]);
- }
- int rr = 2*radius;
- if( grad_pixmap && (!use_graticule ||
- rr != grad_pixmap->get_w() || rr != grad_pixmap->get_h()) ) {
- delete grad_pixmap; grad_pixmap = 0;
- use_graticule = 0;
- }
- if( !grad_pixmap && grad_image ) {
- VFrame grad(rr, rr, BC_RGBA8888);
- grad.transfer_from(grad_image);
- grad_pixmap = new BC_Pixmap(this, &grad, PIXMAP_ALPHA);
- use_graticule = grad_idx;
- }
- if( grad_pixmap ) {
- int px = vector_cx - radius, py = vector_cy - radius;
- vectorscope->draw_pixmap(grad_pixmap, px, py);
-// vectorscope->flash(0);
- }
- }
}
void ScopeGUI::update_graticule(int idx)
{
- grad_idx = idx;
+ grat_idx = idx;
update_scope();
toggle_event();
}
else {
r = bg_r; g = bg_g; b = bg_b;
}
- row[0] = r; row[1] = g; row[2] = b;
+ row[0] = r; row[1] = g; row[2] = b; row[3] = 0xff;
}
}
}
frame_w = data_frame->get_w();
bzero(waveform_vframe->get_data(), waveform_vframe->get_data_size());
if( use_vector > 0 )
- bzero(vector_vframe->get_data(), vector_vframe->get_data_size());
+ vector_vframe->clear_frame();
else if( use_vector < 0 ) {
if( wheel_vframe && (
wheel_vframe->get_w() != vector_w ||
delete wheel_vframe; wheel_vframe = 0;
}
if( !wheel_vframe ) {
- wheel_vframe = new VFrame(vector_w, vector_h, BC_RGB888);
+ wheel_vframe = new VFrame(vector_w, vector_h, BC_RGBA8888);
draw_colorwheel(wheel_vframe, BLACK);
}
vector_vframe->copy_from(wheel_vframe);
if( waveform )
waveform->draw_vframe(waveform_vframe);
if( vectorscope )
- vectorscope->draw_vframe(vector_vframe);
+ draw_scope();
draw_overlays(1, 0, 1);
unlock_window();
{
if( is_dragging ) {
is_dragging = 0;
+ hide_tooltip();
return 1;
}
return 0;
float value = ((float)get_h() - y) / get_h() * (FLOAT_MAX - FLOAT_MIN) + FLOAT_MIN;
char string[BCTEXTLEN];
sprintf(string, "X: %d Value: %.3f", frame_x, value);
- gui->value_text->update(string, 0);
+ show_tooltip(string);
draw_point();
flash(1);
char string[BCTEXTLEN];
sprintf(string, "Hue: %.3f Sat: %.3f", hue, saturation);
- gui->value_text->update(string, 0);
+ show_tooltip(string);
// Show it
draw_point();
char string[BCTEXTLEN];
sprintf(string, "Value: %.3f", value);
- gui->value_text->update(string, 0);
+ show_tooltip(string);
draw_point();
flash(1);
}
-ScopeVectGrads::ScopeVectGrads(ScopeGUI *gui, int x, int y)
+ScopeVectGrats::ScopeVectGrats(ScopeGUI *gui, int x, int y)
: BC_PopupMenu(x, y, _("Overlay"))
{
this->gui = gui;
}
#define SCOPE_SEARCHPATH "/scopes"
-void ScopeVectGrads::create_objects()
+void ScopeVectGrats::create_objects()
{
- gui->grad_paths.remove_all_objects();
- ScopeGradItem *item;
- add_item(item = new ScopeGradItem(this, _("none"), 0));
- if( item->idx == gui->grad_idx ) item->set_checked(1);
- gui->grad_paths.append(0);
+ gui->grat_paths.remove_all_objects();
+ ScopeGratItem *item;
+ add_item(item = new ScopeGratItem(this, _("none"), 0));
+ if( item->idx == gui->grat_idx ) item->set_checked(1);
+ gui->grat_paths.append(0);
FileSystem fs;
fs.set_filter("[*.png]");
char scope_path[BCTEXTLEN];
strcpy(scope_path, file_item->get_name());
char *cp = strrchr(scope_path, '.');
if( cp ) *cp = 0;
- add_item(item = new ScopeGradItem(this, scope_path, gui->grad_paths.size()));
- if( item->idx == gui->grad_idx ) item->set_checked(1);
- gui->grad_paths.append(cstrdup(file_item->get_path()));
+ add_item(item = new ScopeGratItem(this, scope_path, gui->grat_paths.size()));
+ if( item->idx == gui->grat_idx ) item->set_checked(1);
+ gui->grat_paths.append(cstrdup(file_item->get_path()));
}
}
-ScopeGradItem::ScopeGradItem(ScopeVectGrads *vect_grads, const char *text, int idx)
+ScopeGratItem::ScopeGratItem(ScopeVectGrats *vect_grats, const char *text, int idx)
: BC_MenuItem(text)
{
- this->vect_grads = vect_grads;
+ this->vect_grats = vect_grats;
this->idx = idx;
}
-int ScopeGradItem::handle_event()
+int ScopeGratItem::handle_event()
{
- for( int i=0,n=vect_grads->total_items(); i<n; ++i ) {
- ScopeGradItem *item = (ScopeGradItem *)vect_grads->get_item(i);
+ for( int i=0,n=vect_grats->total_items(); i<n; ++i ) {
+ ScopeGratItem *item = (ScopeGratItem *)vect_grats->get_item(i);
item->set_checked(item->idx == idx);
}
- vect_grads->gui->update_graticule(idx);
+ vect_grats->gui->update_graticule(idx);
return 1;
}
#include "guicast.h"
#include "loadbalance.h"
#include "mwindow.h"
+#include "overlayframe.inc"
#include "pluginclient.h"
#include "recordmonitor.inc"
#include "scopewindow.inc"
#define HISTOGRAM_MAX 110
#define FLOAT_MAX 1.1
-#define MIN_SCOPE_W xS(640)
+#define MIN_SCOPE_W xS(320)
#define MIN_SCOPE_H yS(320)
};
-class ScopeGradPaths : public ArrayList<const char *>
+class ScopeGratPaths : public ArrayList<const char *>
{
public:
- ScopeGradPaths() { set_array_delete(); }
- ~ScopeGradPaths() { remove_all_objects(); }
+ ScopeGratPaths() { set_array_delete(); }
+ ~ScopeGratPaths() { remove_all_objects(); }
};
-class ScopeGradItem : public BC_MenuItem
+class ScopeGratItem : public BC_MenuItem
{
public:
- ScopeGradItem(ScopeVectGrads *vect_grads, const char *text, int idx);
+ ScopeGratItem(ScopeVectGrats *vect_grats, const char *text, int idx);
int handle_event();
- ScopeVectGrads *vect_grads;
+ ScopeVectGrats *vect_grats;
int idx;
};
-class ScopeVectGrads : public BC_PopupMenu
+class ScopeVectGrats : public BC_PopupMenu
{
public:
- ScopeVectGrads(ScopeGUI *gui, int x, int y);
+ ScopeVectGrats(ScopeGUI *gui, int x, int y);
void create_objects();
ScopeGUI *gui;
void draw_overlays(int overlays, int borders, int flush);
void update_graticule(int idx);
void draw_colorwheel(VFrame *dst, int bg_color);
- void draw_graticule();
+ void draw_scope();
void process(VFrame *output_frame);
void draw(int flash, int flush);
void clear_points(int flash);
ScopeMenu *scope_menu;
ScopeWaveSlider *wave_slider;
ScopeVectSlider *vect_slider;
- ScopeVectGrads *vect_grads;
+ ScopeVectGrats *vect_grats;
ScopeSmooth *smooth;
- BC_Title *value_text;
- VFrame *grad_image;
- BC_Pixmap *grad_pixmap;
+ VFrame *grat_image;
+ OverlayFrame *overlay;
int x, y, w, h;
int vector_x, vector_y, vector_w, vector_h;
int hist_x, hist_y, hist_w, hist_h;
int text_color, dark_color;
- ScopeGradPaths grad_paths;
- int grad_idx, use_graticule;
+ ScopeGratPaths grat_paths;
+ int grat_idx, use_graticule;
int cpus;
int use_hist, use_wave, use_vector;