10 #include <QGraphicsView>
11 #include <QGraphicsScene>
19 file = QFileDialog::getOpenFileName(
this, tr(
"Open File"),
"/home/kapf/tmp",tr(
"Images (*.jpeg *.jpg *.png *.bmp *.gif *.tif)"));
25 image =
image.convertToFormat(QImage::Format_ARGB32,Qt::AutoColor);
49 QApplication::setOverrideCursor(Qt::ArrowCursor);
67 file_masked_image_save = QFileDialog::getSaveFileName(
this, tr(
"Save Masked Image"),
"/home/kapf/tmp",tr(
"Images (*.png)"));
90 file_save = QFileDialog::getSaveFileName(
this, tr(
"Save File"),
"/home/kapf/tmp",tr(
"tycho IC (*.tyc)"));
93 if(file.suffix().isEmpty())
file_save +=
".tyc";
98 fd = fopen(filename.toUtf8(),
"w");
99 fprintf(fd,
"This is a TYCHO boundary condition file.\n");
100 fprintf(fd,
"X %i\n",
image.width());
101 fprintf(fd,
"Y %i\n",
image.height());
103 fseek(fd, 200, SEEK_SET);
104 for (
int j = 0; j <
image.width(); j++) {
105 for (
int k = 0; k <
image.height(); k++) {
107 tmp1 =
image.pixel(j,k);
110 for (
int i = 0; i <
ui->
image_depth->text().toInt(); i++)
if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
114 for (
int i = 0; i <
ui->
image_depth->text().toInt(); i++)
if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
140 file_save = QFileDialog::getSaveFileName(
this, tr(
"Save File"),
"/home/kapf/tmp",tr(
"tycho IC (*.tyc)"));
143 if(file.suffix().isEmpty())
file_save +=
".tyc";
148 fd = fopen(filename.toUtf8(),
"w");
149 fprintf(fd,
"This is a TYCHO soundemitter file.\n");
150 fprintf(fd,
"X %i\n",
image.width());
151 fprintf(fd,
"Y %i\n",
image.height());
153 fseek(fd, 200, SEEK_SET);
154 for (
int j = 0; j <
image.width(); j++) {
155 for (
int k = 0; k <
image.height(); k++) {
157 tmp1 =
image.pixel(j,k);
160 for (
int i = 0; i <
ui->
image_depth->text().toInt(); i++)
if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
164 for (
int i = 0; i <
ui->
image_depth->text().toInt(); i++)
if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
188 file_save = QFileDialog::getSaveFileName(
this, tr(
"Save Wind - Emitter"),
"/home/kapf/tmp",tr(
"tycho IC (*.tyc)"));
191 if(file.suffix().isEmpty())
file_save +=
".tyc";
196 fd = fopen(filename.toUtf8(),
"w");
197 fprintf(fd,
"This is a TYCHO wind-emitter file.\n");
198 fprintf(fd,
"X %i\n",
image.width());
199 fprintf(fd,
"Y %i\n",
image.height());
201 fseek(fd, 200, SEEK_SET);
202 for (
int j = 0; j <
image.width(); j++) {
203 for (
int k = 0; k <
image.height(); k++) {
208 if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;
212 if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
216 if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
220 if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;
224 if (!fwrite(&tmp, 1,
sizeof (
int), fd))
break;;