Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » StreamRaster::LoadAnyFile -- not exist in distribution? 
	
		
		
			   StreamRaster::LoadAnyFile -- not exist in distribution? [message #5626] | 
			Fri, 06 October 2006 13:04   | 
		 
		
			
				
				
				
					
						  
						temer
						 Messages: 5 Registered: October 2006  Location: Kyiv, Ukraine
						
					 | 
					Promising Member  | 
					 
  | 
		 
		 
	 | 
 
	
		I can not find out how to use this function in my code. I've tried to compile U++ example from U++ website and it writes that there is no StreamRaster::LoadAnyFile. Indeed, both "StreamRaster" and "LoadAnyFile" are absent in distribution. How can this happen? How can I use this function? 
 
Thanks. 
 
The example code follows: 
 
#include <CtrlLib/CtrlLib.h>
 
struct MyApp : public TopWindow {
    Image   img;
    FileSel fs;
 
    void Open();
 
    virtual void Paint(Draw& w);
    virtual void LeftDown(Point, dword) { Open(); }
    
    typedef MyApp CLASSNAME;
    MyApp();
};
 
MyApp::MyApp()
{
    fs.Type("Image file", "*.bmp;*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.gif");
    Sizeable();
}
 
void MyApp::Paint(Draw& w)
{
    w.DrawRect(GetSize(), White);
    if(img)
        w.DrawImage(0, 0, img);
    else
        w.DrawText(0, 0, "No image loaded!", Arial(30).Italic());
}
 
void MyApp::Open()
{
    if(fs.ExecuteOpen("Choose the image file to open")) {
        img = StreamRaster::LoadFileAny(~fs);
        Refresh();
    }
}
 
GUI_APP_MAIN
{
    MyApp app;
    app.Open();
    app.Run();
}
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	
		
		
			| Re: StreamRaster::LoadAnyFile -- not exist in distribution? [message #5635 is a reply to message #5632] | 
			Fri, 06 October 2006 18:17    | 
		 
		
			
				
				
				
					
						  
						temer
						 Messages: 5 Registered: October 2006  Location: Kyiv, Ukraine
						
					 | 
					Promising Member  | 
					 
  | 
		 
		 
	 | 
 
	
		OK, I've downloaded dev version and it's there. 
 
Could you, please, help me with the following? 
 
I want to insert a smiley (.gif file from disk) to rich text view. How do I do it? I'm stucked. 
 
I can make QtfRichObject from vector Drawing with usage of CreateDrawingObject(), but I want to use raster smileys, not vector one. 
And I can't see how to make a QtfRichObject from an Image.  
 
 
 
So, I have 
 
Image img = StreamRaster::LoadFileAny("c:\\385.gif");
 
and I want to add its contents to a RichTextView1. 
 
 
 
And the last, is it possible to use animated images in RichTextView? Probably, not  . 
 
Thank you in advance. 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: StreamRaster::LoadAnyFile -- not exist in distribution? [message #5639 is a reply to message #5635] | 
			Fri, 06 October 2006 20:33    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		| temer wrote on Fri, 06 October 2006 12:17 |   OK, I've downloaded dev version and it's there. 
 
Could you, please, help me with the following? 
 
I want to insert a smiley (.gif file from disk) to rich text view. How do I do it? I'm stucked. 
 
I can make QtfRichObject from vector Drawing with usage of CreateDrawingObject(), but I want to use raster smileys, not vector one. 
And I can't see how to make a QtfRichObject from an Image.  
 
 
 
So, I have 
 
Image img = StreamRaster::LoadFileAny("c:\\385.gif");
 
and I want to add its contents to a RichTextView1. 
 
 
 
And the last, is it possible to use animated images in RichTextView? Probably, not  . 
 
Thank you in advance. 
  |  
  
 
 
#include <CtrlLib/CtrlLib.h>
RichObject CreateImageObject(const Image& img)
{
	return RichObject("image", StoreImageAsString(img));
}
GUI_APP_MAIN
{
	QtfRichObject pict(CreateImageObject(StreamRaster::LoadFileAny("d:/jachym.bmp")));
	String qtf;
	qtf << "[A6 This is some drawing in QTF: " << pict << "&";
	qtf << "[C3*@B And now in the table: {{1:1 " << pict << ":: Another cell " << pict << "}}";
	PromptOK(qtf);
}
 
 
Anyway, as this is quite common request, I have added CreateImageObject to RichText package....
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:39:43 CET 2025 
 Total time taken to generate the page: 0.04744 seconds 
 |