void load_data() { //I'm lazy, so I'll use ImageWindow's loadData instead of directly //using Aaron's Image2D class. So much unneccessary memory //allocation and deallocation... int n1 = scannum*2-1; int n2 = scannum*2; iw1->loadData(arglist[n1]); iw2->loadData(arglist[n2]); fname1 = arglist[n1]; fname2 = arglist[n2]; iw1->label(arglist[n1]); iw2->label(arglist[n2]); if ((iw1->w != iw2->w) || (iw1->h != iw2->h)) { fprintf(stderr, "Images %s and %s are not the same size!\n", arglist[n1], arglist[n2]); exit(-1); } wid = iw1->w; hgt = iw1->h; origdata1 = new int[wid*hgt]; origdata2 = new int[wid*hgt]; data1 = new int[wid*hgt]; data2 = new int[wid*hgt]; for (int i=0; i<wid*hgt; i++) { origdata1[i] = iw1->data[i]; origdata2[i] = iw2->data[i]; } update_images(); }
// The start of the Application int App::start(const std::vector<CL_String> &args) { quit = false; // Set the window CL_DisplayWindowDescription desc; desc.set_title("ClanLib App Example"); desc.set_size(CL_Size(1200, 500), true); desc.set_allow_resize(true); CL_DisplayWindow window(desc); // Connect the Window close event CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close); // Connect a keyboard handler to on_key_up() CL_Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &App::on_input_up); // Get the graphic context CL_GraphicContext gc = window.get_gc(); // Load a sprite from a png-file tux = CL_PixelBuffer("Resources/tux.png"); tux_original = CL_Image(gc, tux, tux.get_size()); current_format = cl_rgba8; //current_format = cl_rgba8; //current_format = cl_rgb8; //current_format = cl_bgra8; //current_format = cl_bgr8; //current_format = cl_r8; //current_format = cl_r8_snorm; //current_format = cl_r16; //current_format = cl_r16_snorm; //current_format = cl_rg8; //current_format = cl_rg8_snorm; //current_format = cl_rg16; //current_format = cl_rg16_snorm; //current_format = cl_r3_g3_b2; //current_format = cl_rgb4; //current_format = cl_rgb5; //current_format = cl_rgb8_snorm; //current_format = cl_rgb10; //current_format = cl_rgb12; // XX //current_format = cl_rgb16; //current_format = cl_rgb16_snorm; //current_format = cl_rgba2; // XX //current_format = cl_rgba4; //current_format = cl_rgb5_a1; //current_format = cl_rgba8_snorm; //current_format = cl_rgb10_a2; //current_format = cl_rgba12; // X //current_format = cl_rgba16; //current_format = cl_rgba16_snorm; //current_format = cl_srgb8; //current_format = cl_srgb8_alpha8; //current_format = cl_r16f; //current_format = cl_rg16f; //current_format = cl_rgb16f; //current_format = cl_rgba16f; //current_format = cl_r32f; current_format = cl_rg32f; //current_format = cl_rgb32f; //current_format = cl_rgba32f; //current_format = cl_r11f_g11f_b10f; // X //current_format = cl_rgb9_e5; // X //current_format = cl_r8i; //current_format = cl_r8ui; //current_format = cl_r16i; //current_format = cl_r16ui; //current_format = cl_r32i; //current_format = cl_r32ui; //current_format = cl_rg8i; //current_format = cl_rg8ui; //current_format = cl_rg16i; //current_format = cl_rg16ui; //current_format = cl_rg32i; //current_format = cl_rg32ui; //current_format = cl_rgb8i; //current_format = cl_rgb8ui; //current_format = cl_rgb16i; //current_format = cl_rgb16ui; //current_format = cl_rgb32i; //current_format = cl_rgb32ui; //current_format = cl_rgba8i; //current_format = cl_rgba8ui; //current_format = cl_rgba16i; //current_format = cl_rgba16ui; //current_format = cl_rgba32i; //current_format = cl_rgba32ui; //current_format = cl_depth_component16; //current_format = cl_depth_component24; //current_format = cl_depth_component32; //current_format = cl_depth_component32f; //current_format = cl_depth24_stencil8; //current_format = cl_depth32f_stencil8; //current_format = cl_compressed_red; //current_format = cl_compressed_rg; //current_format = cl_compressed_rgb; //current_format = cl_compressed_rgba; //current_format = cl_compressed_srgb; //current_format = cl_compressed_srgb_alpha; //current_format = cl_compressed_red_rgtc1; //current_format = cl_compressed_signed_red_rgtc1; //current_format = cl_compressed_rg_rgtc2; //current_format = cl_compressed_signed_rg_rgtc2; //current_format = cl_compressed_rgb_s3tc_dxt1; //current_format = cl_compressed_rgba_s3tc_dxt1; //current_format = cl_compressed_rgba_s3tc_dxt3; //current_format = cl_compressed_rgba_s3tc_dxt5; //current_format = cl_compressed_srgb_s3tc_dxt1; //current_format = cl_compressed_srgb_alpha_s3tc_dxt1; //current_format = cl_compressed_srgb_alpha_s3tc_dxt3; //current_format = cl_compressed_srgb_alpha_s3tc_dxt5; display_gc = &gc; update_images(); CL_Font font(gc, "tahoma", 24); // Run until someone presses escape while (!quit) { gc.clear(CL_Colorf(0.0f,0.0f,0.2f)); tux_original.draw(gc, 0, 0); tux_convert.draw(gc, 400, 0); tux_unconvert.draw(gc, 800, 0); font.draw_text(gc, 10, 400, "cl_rgba8"); if (gl_supported) { font.draw_text(gc, 410, 400, "converted"); } else { font.draw_text(gc, 410, 400, "NOT SUPPORTED BY clanGL"); } font.draw_text(gc, 810, 400, "converted back to cl_rgba8"); window.flip(1); // This call processes user input and other events CL_KeepAlive::process(0); } return 0; }
static void cb_angle_value(Fl_Value_Input*, void*) { angle_roller->value(angle_value->value()); update_images(); }
static void cb_angle_roller(Fl_Roller*, void*) { angle_value->value(angle_roller->value()); update_images(); }