Example #1
0
void JuliaTool::sizeEvent(bool toolIsActive)
{
    stop_rendering(&j_pre);

    int xw,yw;

    if ((JPRE_SIZE / img->ratio) < JPRE_SIZE)
    {
        xw = JPRE_SIZE;
        yw = int(JPRE_SIZE / img->ratio);

        if (yw == 0)
            yw = 1;
    }
    else
    {
        xw = int(JPRE_SIZE * img->ratio);

        if (xw == 0)
            xw = 1;

        yw = JPRE_SIZE;
    }

    j_pre.setSize(xw, yw, JPRE_AA_FACTOR);
    gtk_widget_set_size_request(j_pre.drawing_area, xw, yw);

    if (toolIsActive)
    {
        gtk_widget_hide(j_pre_window);
        gtk_widget_show(j_pre_window);

        start_rendering(&j_pre);
    }
}
Example #2
0
void JuliaTool::deactivate()
{
    stop_rendering(&j_pre);
    gtk_widget_hide(j_pre_window);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbarButton), FALSE);
}
Example #3
0
void CropTool::crop(void)
{
    GdkRectangle r = getRect();

    double oldW = img->finfo.xmax - img->finfo.xmin;
    double oldH = img->finfo.ymax - img->ymin();

    double xmin = img->getX(r.x);
    double xmax = img->getX(r.x + r.width);
    double ymax = img->getY(r.y);
    double ymin = img->getY(r.y + r.height);

    img->finfo.xmin = xmin;
    img->finfo.xmax = xmax;
    img->finfo.ymax = ymax;

    double newW = img->finfo.xmax - img->finfo.xmin;
    double newH = img->finfo.ymax - ymin;

    tool_deactivate();

    stop_rendering(img);

    img->setSize(std::max(1, int(img->user_width * (newW / oldW))),
                 std::max(1, int(img->user_height * (newH / oldH))),
                 img->aa_factor);

    image_size_changed();

    start_rendering(img);
}
void 												
World::render_scene(const std::vector<Pixel>& pixels) const {

	RGBColor	pixel_color;	 	
	Ray			ray;					
	int 		hres 	= vp.hres;
	int 		vres 	= vp.vres;
	float		s		= vp.s;
	float		zw		= 100.0;				// hardwired in
	
	list<RenderedPixel> render;   // for send every row
	RenderedPixel pixel;		  // "
	int count = 0;
	int jump  = 0;
	int depth = 0;

	ray.d = Vector3D(0, 0, -1);
	
	for(unsigned int i = 0; i< pixels.size(); i++)
	{			
			Pixel screen_pixel = pixels[i];		
			ray.o = Point3D(s * (screen_pixel.x - hres / 2.0 + 0.5), s * (screen_pixel.y - vres / 2.0 + 0.5), zw);
			pixel_color = tracer_ptr->trace_ray(ray, depth, count, jump);
			pixel.color = pixel_color;			// for send every row
			pixel.xy = Point2D(screen_pixel.x,screen_pixel.y);	// "
			render.push_back(pixel);    // "

				if(stop_rendering())       // if the program is asked to close, we need end this now
				{	display_pixel(render);  
					render.clear();	
					return; 	}	

				if(render_display() == EVERY_PIXEL)
				{	display_pixel(render);   // send to the screen buffer every pixel rendered
					render.clear();	
				}
				else if(render_display() == EVERY_ROW)
				{	
					if(i % (pixels.size()/10) == 0)
					{
						display_pixel(render);   // send to the screen buffer every pixel rendered
						render.clear();	
					}
				}
	}	
	if(render_display() == EVERY_JOB || render_display() == EVERY_ROW)
	{	display_pixel(render);   // send to the screen buffer every row of pixels rendered
		render.clear();	
	}		

	
}  
Example #5
0
void video_output_qt_widget::check_gl_thread()
{
    // XXX We need to know our current position on the screen (global pixel coordinates).
    // Querying our position in vo_pos_*() does not work since that function is called
    // from the GL thread and mapToGlocal() seems to block for some strange reason.
    // Therefore we record our current position here.
    _pos_x = mapToGlobal(QPoint(0, 0)).x();
    _pos_y = mapToGlobal(QPoint(0, 0)).y();
    if (_gl_thread.failure()) {
        stop_rendering();
        QMessageBox::critical(this, _("Error"), _gl_thread.exception().what());
        _vo->send_cmd(command::toggle_play);
    }
}