1
/***************************************************************************
2
DIA_crop.cpp - description
5
GUI for cropping including autocrop
7
+Autocrop now in RGB space (more accurate)
10
copyright : (C) 2002/2007 by mean
11
email : fixounet@free.fr
12
***************************************************************************/
14
/***************************************************************************
16
* This program is free software; you can redistribute it and/or modify *
17
* it under the terms of the GNU General Public License as published by *
18
* the Free Software Foundation; either version 2 of the License, or *
19
* (at your option) any later version. *
21
***************************************************************************/
28
#define Ui_Dialog Ui_asharpDialog
29
#include "ui_asharp.h"
33
#include "ADM_toolkit/toolkit.hxx"
34
#include "ADM_image.h"
35
#include "ADM_video/ADM_genvideo.hxx"
36
#include "ADM_colorspace/ADM_rgb.h"
37
#include "ADM_assert.h"
38
#include "DIA_flyDialog.h"
39
#include "DIA_flyDialogQt4.h"
40
#include "ADM_videoFilter/ADM_vidASharp_param.h"
41
#include "DIA_flyAsharp.h"
44
// Video is in YV12 Colorspace
47
class Ui_asharpWindow : public QDialog
55
Ui_asharpWindow(ASHARP_PARAM *param,AVDMGenericVideoStream *in);
59
void gather(ASHARP_PARAM *param);
62
void sliderUpdate(int foo);
63
void valueChanged(int foo);
68
Ui_asharpWindow::Ui_asharpWindow(ASHARP_PARAM *param,AVDMGenericVideoStream *in)
70
uint32_t width,height;
73
// Allocate space for green-ised video
74
width=in->getInfo()->width;
75
height=in->getInfo()->height;
77
canvas=new ADM_QCanvas(ui.graphicsView,width,height);
79
myCrop=new flyASharp( width, height,in,canvas,ui.horizontalSlider);
80
memcpy(&(myCrop->param),param,sizeof(ASHARP_PARAM));
83
myCrop->sliderChanged();
86
connect( ui.horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(sliderUpdate(int)));
87
#define SPINNER(x) connect( ui.doubleSpinBox##x,SIGNAL(valueChanged(int)),this,SLOT(valueChanged(int)));
91
connect( ui.checkBox,SIGNAL(stateChanged(int)),this,SLOT(valueChanged(int)));
94
void Ui_asharpWindow::sliderUpdate(int foo)
96
myCrop->sliderChanged();
98
void Ui_asharpWindow::gather(ASHARP_PARAM *param)
102
memcpy(param,&(myCrop->param),sizeof(ASHARP_PARAM));
104
Ui_asharpWindow::~Ui_asharpWindow()
106
if(myCrop) delete myCrop;
108
if(canvas) delete canvas;
111
void Ui_asharpWindow::valueChanged( int f )
119
#define MYSPIN(x) w->doubleSpinBox##x
120
//************************
121
uint8_t flyASharp::upload(void)
123
Ui_asharpDialog *w=(Ui_asharpDialog *)_cookie;
125
MYSPIN(Treshold)->setValue(param.t);
126
MYSPIN(Strength)->setValue(param.d);
127
MYSPIN(Block)->setValue(param.b);
129
//w->bf->w->checkBox->isChecked();
130
w->checkBox->setChecked(param.bf);
134
uint8_t flyASharp::download(void)
136
Ui_asharpDialog *w=(Ui_asharpDialog *)_cookie;
137
param.t= MYSPIN(Treshold)->value();
138
param.d= MYSPIN(Strength)->value();
139
param.b= MYSPIN(Block)->value();
141
//w->spinBoxBottom->setValue(bottom);
142
param.bf=w->checkBox->isChecked();
146
\fn DIA_getCropParams
147
\brief Handle crop dialog
149
uint8_t DIA_getASharp(ASHARP_PARAM *param, AVDMGenericVideoStream *in)
153
Ui_asharpWindow dialog(param,in);
154
if(dialog.exec()==QDialog::Accepted)
156
dialog.gather(param);
161
//____________________________________