Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Loading Image into qtf
Re: Loading Image into qtf [message #11212 is a reply to message #11211] Mon, 27 August 2007 19:57 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
[quote title=forlano wrote on Mon, 27 August 2007 19:32]
guido wrote on Sat, 09 June 2007 14:18

luzr wrote on Fri, 08 June 2007 15:58

try

dw.DrawImage(0, 0, img);

(You are drawing outside the area at 500, 500).

Or perhaps you really wanted

dw.DrawImage(0, 0, 500, 500, img)

- stretches the image to fill the area.

Anyway, that is still too ineffective, there is a nice function:

RichObject CreateImageObject(const Image& img, int cx = 0, int cy = 0);

which produces RichObject directly, without the need of ImageDraw.
Guido


Hello Guido,

I am facing your same problem, that to load a file image in a qtf document. It seems you have resolved this problem.
If you have still the correct test case may I ask you to post it?
Many thanks,
Luigi


No prob, I found the answer just in the reference:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	DrawingDraw dw(500, 500);
	Image img = StreamRaster::LoadFileAny("C:\\MyApps\\qtfimage\\ita.png");        
    dw.DrawImage(0, 0, 500, 500, img);	
	QtfRichObject pict(CreateDrawingObject(dw.GetResult(), Size(500, 500), Size(500, 500)));
	
	String qtf;
    qtf << pict; 
	PromptOK(qtf);
}

that is practically your initial code (it didn't work at my first experiment). But still I have not uderstood the Mirek's suggestion about the use of
RichObject CreateImageObject(const Image& img, int cx = 0, int cy = 0);

luigi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rendering qtf into a window: horrible flicker
Next Topic: Failed to set String format in report from SQLite3
Goto Forum:
  


Current Time: Wed May 15 19:13:22 CEST 2024

Total time taken to generate the page: 0.01782 seconds