SilverScreen Solid Modeler



Previous topic Next topic  


Previous topic Next topic JavaScript is required for the print function  




SS_IMAGE_HANDLE ss_image_capture(left, right, top, bottom);


int left;    // Left-most pixel of capture area

int right;   // Right-most pixel of capture area

int top;     // Top-most pixel of capture area

int bottom;  // Bottom-most pixel of capture area




#include "silver.h"


The ss_image_capture function captures a rectangular portion of the viewport for later display. It is often used to remove interactive items that track the cursor.




left is the left-most pixel boundary of the area to be captured.


right is the right-most pixel boundary of the area to be captured.


top is the top-most pixel boundary of the area to be captured.


bottom is the bottom-most pixel boundary of the area to be captured.



Return Value

ss_image_capture returns a handle that can be used to restore the area of the display bounded by the capture rectangle if successful, otherwise it returns NULL




You must call ss_image_destroy with a handle you obtained from ss_image_capture when you are finished with it.


If all of the parameters are 0, then the entire viewport will be captured. Parameters which exceed the boundaries of the viewport are adjusted to the viewport extremities.



See Also

ss_image_display, ss_image_destroy, paint_begin, paint_end



The following illustrates the typical way in which ss_image_capture is paired with ss_image_display and ss_image_destroy to provide interactive visualizations that track the cursor


C / C++ Code


 #include "silver.h"



 void main(void)



    BOOLEAN           done = FALSE;

    int               ich;

    int               my_color;

    SS_XYZ            square_pts[4];



    // The contents of the viewport are saved, thereby providing the

    // means to remove anything we hereafter draw to the viewport.


    scr = ss_image_capture(0, 0, 0, 0);


    if ( ! scr )


       error_message("ERROR: Unable to capture the screen);





    my_color = color_yellow | COLOR_WIDE;



    // Enter a cursor-tracking modal loop, restoring, then displaying at

    // each event in a position that tracks the cursor.


    while ( ! done )


       paint_begin(); // Signal the start of drawing


          // Restore the image we have captured




          // Display a yellow square in current cursor location.


          // Note: Setting the square_pts array is excluded for the

          //       purpose of clarity



          draw_world_line(&square_pts[0], &square_pts[1], my_color);

          draw_world_line(&square_pts[1], &square_pts[2], my_color);

          draw_world_line(&square_pts[2], &square_pts[3], my_color);

          draw_world_line(&square_pts[3], &square_pts[0], my_color);


       paint_end();   // Signal the end of drawing




       // Retrieve the next key or mouse event


       ich = inchar();



       // Process the key or mouse event to change square_pts.