Re: wxEuphoria image scaling

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thank you again Greg... much food for thought in your reply.

After some study, I have revised my original procedures as below..

procedure onPaint_HelloWin( atom this, atom event, atom it, atom event_type )  
	atom bmp2 
  
	dc = create(wxPaintDC,{this}) -- should always use 'this' parameter here  
	begin_drawing( dc )  
		set_font(dc, Arial)  
		set_text_color ( dc, BrightRed )  
		wx_puts( {HelloWin,10,10,dc}, "Hello, World!")		-- add 'dc' parameter here to get color  
		 
		filename = "c://Euphoria//relatives//Genealogy//Scans//ROS_jr_youth.jpg" 
		bmp = create( wxBitmap, {BM_FROM_FILE, filename, wxBITMAP_TYPE_ANY} ) 
		bmp2 = convert_to_image ( bmp ) 
		bmp_size = get_bitmap_size( bmp2 ) 
		rescale ( bmp2, floor(bmp_size[1] * .1),floor(bmp_size[2] * .1), 0) 
		bmp = create( wxBitmap, {BM_FROM_IMAGE, bmp2} )  
		draw_bitmap( dc, bmp, 10,500, wxFalse ) 
		 
	end_drawing( dc )  
	delete_instance( dc )  
end procedure  
set_event_handler( HelloWin, get_id(HelloWin), wxEVT_PAINT, routine_id( "onPaint_HelloWin" ))  
  
procedure onPaint_HelloBox( atom this, atom event, atom it, atom event_type ) 
atom bmp2 
  
	dc = create(wxPaintDC,{this}) -- should always use 'this' parameter here  
	begin_drawing( dc )  
		set_pen( dc, BrightBlue) set_brush( dc,BlueBrush)  
		draw_rectangle(dc,0,0,400,400)				-- needs to start at 0,0 (relative to HelloBox)  
		set_pen( dc, BrightRed) set_brush( dc,RedBrush)  
		draw_rectangle(dc,100,100,40,40)  
		set_font(dc, Arial)  
		set_text_color ( dc, BrightRed )  
		wx_puts( {HelloBox,10,10,dc}, "Hello, World!")		-- add 'dc' parameter here to get color  
		 
		filename = "c://Euphoria//relatives//notebook.png" 
		bmp = create( wxBitmap, {BM_FROM_FILE, filename, wxBITMAP_TYPE_ANY} ) 
		draw_bitmap( dc, bmp, 105,105, wxFalse ) 
		 
		filename = "c://Euphoria//relatives//Genealogy//Scans//ROS_jr_youth.jpg" 
		bmp = create( wxBitmap, {BM_FROM_FILE, filename, wxBITMAP_TYPE_ANY} ) 
		bmp2 = convert_to_image ( bmp ) 
		bmp_size = get_bitmap_size( bmp2 ) 
		rescale ( bmp2, floor(bmp_size[1] * .1),floor(bmp_size[2] * .1), 0) 
		bmp = create( wxBitmap, {BM_FROM_IMAGE, bmp2} )  
		draw_bitmap( dc, bmp, 10,150, wxFalse ) 
 
	end_drawing( dc )  
	delete_instance( dc )  
end procedure  
set_event_handler( HelloBox, get_id(HelloBox), wxEVT_PAINT, routine_id( "onPaint_HelloBox" ))  
  
 

Would not be able to complete this project without your aid and assistance..

Sure is nice when things work out!

Buzzo

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu