STATE_engine_render_on_bitmap

 

 


  Like STATE_engine_render() only that it renders on a HBITMAP
  A HBITMAP is a WIN32 type (nothing to do with STATE) for more information
  about HBITMAP check your compiler help.
  The size of the created bitmap will match the size of the window that
  was last used for regular rendering.
  Note that there is no need to free the HBITMAP that is created. The engine will automatically
  delete the old HBITMAP when calling STATE_engine_render_on_bitmap() again.
   Return value: on failure returns NULL. On success returns an HBITMAP
   
  
  Example A: Taking a screenshot
  
  		HBITMAP hbm=STATE_engine_render_on_bitmap(your_window_or_null, your_camera_or_null);
  		STATE_utilities_save_bitmap(hbm, "d:\\screenshots\\shot.bmp");
  
   Example B: Using the rendered image as a regular bitmap that
  			  can be put on a polygon.
  
  		HBITMAP hbm=STATE_engine_render_on_bitmap(NULL, NULL);
  		STATE_utilities_save_bitmap(hbm, "d:\\screenshots\\shot.bmp");
  		DWORD STATE_bmp=STATE_bitmap_load("d:\\screenshots\\shot.bmp", -1);
  		DWORD test_poly=STATE_polygon_get_first_polygon();
  		STATE_polygon_set_bitmap_fill(test_poly, STATE_bmp);
  
   Please note that Example B uses the harddisk to do the conversion between 
   a HBITMAP and a bitmap that can be used with STATE_bitmap API.
   Currently there is no other way to do this. This is not as bad as it sounds
   Since the operating system will use its buffers so when we will do
   STATE_bitmap_load() it doesnt wait for the file to be written to the disk
   it takes the file immediately from the operation system buffers.
  
   See also STATE_utilities_save_bitmap(), STATE_engine_render_on_dc()

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com