aboutsummaryrefslogtreecommitdiff
path: root/src/mandelbrot-zoom.c
diff options
context:
space:
mode:
authorLeonard Kugis <leonardkugis@gmail.com>2018-01-16 01:21:27 +0100
committerLeonard Kugis <leonardkugis@gmail.com>2018-01-16 01:21:27 +0100
commitc4b5e0a48835b6bdbf4d3d92fd42b29a22662ed4 (patch)
tree807f2c1ac0010ce91f5560d6bf852ecca45a221a /src/mandelbrot-zoom.c
parent9d46c7e44b0c8e0625894dbb688e9b2804d83c9d (diff)
Mandelbrot drawing possible
Diffstat (limited to 'src/mandelbrot-zoom.c')
-rw-r--r--src/mandelbrot-zoom.c124
1 files changed, 63 insertions, 61 deletions
diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c
index 7aecae4..3d15b3d 100644
--- a/src/mandelbrot-zoom.c
+++ b/src/mandelbrot-zoom.c
@@ -14,118 +14,120 @@ int main(int argc, char **argv)
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "C:/Users/Superleo1810/eclipse-workspace/mandelbrot-zoom/glade/settings.glade", NULL); // gtk = zu behindert für relative pfade
- ui.settings = GTK_WINDOW(gtk_builder_get_object(builder, "settings"));
+ ui_settings.settings = GTK_WINDOW(gtk_builder_get_object(builder, "settings"));
//gtk_builder_connect_signals(builder, NULL);
- ui.iterationsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "iterationsSp"));
- ui.colorFromBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorFromBtn"));
- ui.colorToBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorToBtn"));
- ui.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb"));
- ui.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd"));
- ui.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp"));
- ui.heightSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "heightSp"));
- ui.fpsRenderSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsRenderSp"));
- ui.fpsVideoSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsVideoSp"));
- ui.bitrateSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "bitrateSp"));
- ui.exportTf = GTK_ENTRY(gtk_builder_get_object(builder, "exportTf"));
- ui.startBtn = GTK_BUTTON(gtk_builder_get_object(builder, "startBtn"));
- ui.exitBtn = GTK_BUTTON(gtk_builder_get_object(builder, "exitBtn"));
- ui.colorDialog = GTK_COLOR_SELECTION_DIALOG(gtk_builder_get_object(builder, "colorDialog"));
-
- gtk_spin_button_set_increments(ui.iterationsSp, 1, 2);
- gtk_spin_button_set_increments(ui.widthSp, 1, 2);
- gtk_spin_button_set_increments(ui.heightSp, 1, 2);
- gtk_spin_button_set_increments(ui.fpsRenderSp, 1, 2);
- gtk_spin_button_set_increments(ui.fpsVideoSp, 1, 2);
- gtk_spin_button_set_increments(ui.bitrateSp, 1, 2);
-
- gtk_spin_button_set_value(ui.iterationsSp, 1000);
- gtk_spin_button_set_value(ui.widthSp, 1920);
- gtk_spin_button_set_value(ui.heightSp, 1080);
- gtk_spin_button_set_value(ui.fpsRenderSp, 30);
- gtk_spin_button_set_value(ui.fpsVideoSp, 30);
- gtk_spin_button_set_value(ui.bitrateSp, 1000);
-
- gtk_spin_button_set_range(ui.iterationsSp, 1, 16777215); // 3 bytes á 8 bit = 24 bit
- gtk_spin_button_set_range(ui.widthSp, 1, 1920);
- gtk_spin_button_set_range(ui.heightSp, 1, 1080);
- gtk_spin_button_set_range(ui.fpsRenderSp, 1, 60);
- gtk_spin_button_set_range(ui.fpsVideoSp, 1, 60);
- gtk_spin_button_set_range(ui.bitrateSp, 1, 65535);
-
- g_signal_connect(ui.iterationsSp, "value-changed", G_CALLBACK(on_iterationsSp_valueChanged), NULL);
- g_signal_connect(ui.colorFromBtn, "clicked", G_CALLBACK(on_colorFromBtn_clicked), NULL);
- g_signal_connect(ui.colorToBtn, "clicked", G_CALLBACK(on_colorToBtn_clicked), NULL);
- g_signal_connect(ui.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
- g_signal_connect(ui.widthSp, "value-changed", G_CALLBACK(on_widthSp_valueChanged), NULL);
- g_signal_connect(ui.heightSp, "value-changed", G_CALLBACK(on_heightSp_valueChanged), NULL);
- g_signal_connect(ui.fpsRenderSp, "value-changed", G_CALLBACK(on_fpsRenderSp_valueChanged), NULL);
- g_signal_connect(ui.fpsVideoSp, "value-changed", G_CALLBACK(on_fpsVideoSp_valueChanged), NULL);
- g_signal_connect(ui.bitrateSp, "value-changed", G_CALLBACK(on_bitrateSp_valueChanged), NULL);
- g_signal_connect(ui.exportTf, "changed", G_CALLBACK(on_exportTf_changed), NULL);
- g_signal_connect(ui.startBtn, "clicked", G_CALLBACK(on_startBtn_clicked), NULL);
- g_signal_connect(ui.exitBtn, "clicked", G_CALLBACK(on_exitBtn_clicked), NULL);
+ ui_settings.iterationsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "iterationsSp"));
+ ui_settings.colorFromBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorFromBtn"));
+ ui_settings.colorToBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorToBtn"));
+ ui_settings.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb"));
+ ui_settings.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd"));
+ ui_settings.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp"));
+ ui_settings.heightSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "heightSp"));
+ ui_settings.fpsRenderSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsRenderSp"));
+ ui_settings.fpsVideoSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsVideoSp"));
+ ui_settings.bitrateSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "bitrateSp"));
+ ui_settings.exportTf = GTK_ENTRY(gtk_builder_get_object(builder, "exportTf"));
+ ui_settings.startBtn = GTK_BUTTON(gtk_builder_get_object(builder, "startBtn"));
+ ui_settings.exitBtn = GTK_BUTTON(gtk_builder_get_object(builder, "exitBtn"));
+ ui_settings.colorDialog = GTK_COLOR_SELECTION_DIALOG(gtk_builder_get_object(builder, "colorDialog"));
+
+ gtk_spin_button_set_increments(ui_settings.iterationsSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.widthSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.heightSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.fpsRenderSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.fpsVideoSp, 1, 2);
+ gtk_spin_button_set_increments(ui_settings.bitrateSp, 1, 2);
+
+ gtk_spin_button_set_value(ui_settings.iterationsSp, 1000);
+ gtk_spin_button_set_value(ui_settings.widthSp, 1920);
+ gtk_spin_button_set_value(ui_settings.heightSp, 1080);
+ gtk_spin_button_set_value(ui_settings.fpsRenderSp, 30);
+ gtk_spin_button_set_value(ui_settings.fpsVideoSp, 30);
+ gtk_spin_button_set_value(ui_settings.bitrateSp, 1000);
+
+ gtk_spin_button_set_range(ui_settings.iterationsSp, 1, 16777215); // 3 bytes á 8 bit = 24 bit
+ gtk_spin_button_set_range(ui_settings.widthSp, 1, 1920);
+ gtk_spin_button_set_range(ui_settings.heightSp, 1, 1080);
+ gtk_spin_button_set_range(ui_settings.fpsRenderSp, 1, 60);
+ gtk_spin_button_set_range(ui_settings.fpsVideoSp, 1, 60);
+ gtk_spin_button_set_range(ui_settings.bitrateSp, 1, 65535);
+
+ g_signal_connect(ui_settings.iterationsSp, "value-changed", G_CALLBACK(on_iterationsSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.colorFromBtn, "clicked", G_CALLBACK(on_colorFromBtn_clicked), NULL);
+ g_signal_connect(ui_settings.colorToBtn, "clicked", G_CALLBACK(on_colorToBtn_clicked), NULL);
+ g_signal_connect(ui_settings.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
+ g_signal_connect(ui_settings.widthSp, "value-changed", G_CALLBACK(on_widthSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.heightSp, "value-changed", G_CALLBACK(on_heightSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.fpsRenderSp, "value-changed", G_CALLBACK(on_fpsRenderSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.fpsVideoSp, "value-changed", G_CALLBACK(on_fpsVideoSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.bitrateSp, "value-changed", G_CALLBACK(on_bitrateSp_valueChanged), NULL);
+ g_signal_connect(ui_settings.exportTf, "changed", G_CALLBACK(on_exportTf_changed), NULL);
+ g_signal_connect(ui_settings.startBtn, "clicked", G_CALLBACK(on_startBtn_clicked), NULL);
+ g_signal_connect(ui_settings.exitBtn, "clicked", G_CALLBACK(on_exitBtn_clicked), NULL);
g_object_unref(builder);
- gtk_widget_show(GTK_WIDGET(ui.settings));
+ gtk_widget_show(GTK_WIDGET(ui_settings.settings));
gtk_main();
return 0;
}
void on_iterationsSp_valueChanged()
{
- config.iterations = gtk_spin_button_get_value(ui.widthSp);
+ config.iterations = gtk_spin_button_get_value(ui_settings.iterationsSp);
}
void on_colorFromBtn_clicked()
{
currentColor = COLOR_FROM;
- gtk_dialog_run(ui.colorDialog);
+ gtk_dialog_run(ui_settings.colorDialog);
}
void on_colorToBtn_clicked()
{
currentColor = COLOR_TO;
- gtk_dialog_run(ui.colorDialog);
+ gtk_dialog_run(ui_settings.colorDialog);
}
void on_exportCb_toggled()
{
- config.video = gtk_toggle_button_get_active(ui.exportCb);
+ config.video = gtk_toggle_button_get_active(ui_settings.exportCb);
}
void on_exportTf_changed()
{
- config.path = CHAR_PTR(gtk_entry_get_text(ui.exportTf));
+ config.path = CHAR_PTR(gtk_entry_get_text(ui_settings.exportTf));
}
void on_widthSp_valueChanged()
{
- config.width = gtk_spin_button_get_value(ui.widthSp);
+ config.width = gtk_spin_button_get_value(ui_settings.widthSp);
}
void on_heightSp_valueChanged()
{
- config.height = gtk_spin_button_get_value(ui.heightSp);
+ config.height = gtk_spin_button_get_value(ui_settings.heightSp);
}
void on_fpsRenderSp_valueChanged()
{
- config.renderFPS = gtk_spin_button_get_value(ui.fpsRenderSp);
+ config.renderFPS = gtk_spin_button_get_value(ui_settings.fpsRenderSp);
}
void on_fpsVideoSp_valueChanged()
{
- config.videoFPS = gtk_spin_button_get_value(ui.fpsVideoSp);
+ config.videoFPS = gtk_spin_button_get_value(ui_settings.fpsVideoSp);
}
void on_bitrateSp_valueChanged()
{
- config.bitrate = gtk_spin_button_get_value(ui.bitrateSp);
+ config.bitrate = gtk_spin_button_get_value(ui_settings.bitrateSp);
}
void on_startBtn_clicked()
{
- printf("config {\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path);
+ printf("config {\n\t.iterations = %u\n\t.video = %u\n\t.filetype = %u\n\t.width = %u\n\t.height = %u\n\t.renderFPS = %u\n\t.videoFPS = %u\n\t.bitrate = %u\n\t.path = %s\n}\n", config.iterations, config.video, 0, config.width, config.height, config.renderFPS, config.videoFPS, config.bitrate, config.path);
+ render_init(&config, mandelbrot_r);
+ render_show();
}
void on_exitBtn_clicked()