betajaen wrote:Hey, I have an idea.
You could take advantage of the Ogre resource system, by creating a small function wrapper as URI:data's, by reading in the image data, "base64'ing" it and creating a URI:data string.
You could take it a step further with RenderToTexture.
Oh wow, what a fantastic idea. This is definitely do-able, I'll get right to it!
Also after a little contemplation of programmatically creating HTML files and transferring them to Gecko using data URI's, I realized that the flaw in this is the inability to use local protocol specifiers (local://) to access local resources (such as MyPage.css, other local pages, etc.).
Therefore, I am making a few API changes to allow the translation of such local resource specifiers (which fits in nicely with your new idea), let me break it down:
Pure-programmatically generated pages will not be able to be sent NaviData because currently that conflicts with how data URI's work. Instead, a user will have to do his own dynamic editing of data. For example, let's say we want to create a dialog box that displays a message and then lets the user click 'OK'.
Programmatically, this is done something like this:
Code: Select all
std::string myDialogMessage = "Click OK to close this box";
std::stringstream myDialogPage;
myDialogPage << "<html><head><script type="text/javascript" src="local:\\Navi.js"></script>";
myDialogPage << "<script type="text/javascript">";
myDialogPage << "function SendClick(){ NaviData myData = new NaviData("DialogClicked"); myData.send();";
myDialogPage << "</script>";
myDialogPage << "<link rel="stylesheet" type="text/css" href="local:\\myDialogStyle.css" />";
myDialogPage << "</head><body>";
myDialogPage << "<center>" << myDialogMessage << "</center>";
myDialogPage << "<br/><br/><input type="button" class="myButtonStyle" id="okButton" value="OK" onclick="SendClick()"/>";
myDialogPage << "</body></html>";
Then all you would need to do is make the Navi and navigate it to this programatically-created page like this:
Code: Select all
NaviManager::Get().createNavi("myDialogNavi", toDataURI(myDialogPage.str()), Center, 256, 256);
The toDataURI(std::string) function would basically replace all instances of 'local://' with the correct 'file:///C:\My\Application\Directory\NaviLocal\' equivalent and then subsequently encode the resulting string into a data URI.
We can use the same sort of thinking to do something like this:
Code: Select all
<img src="image://General/MyOgreResourceImage.png" />
Where 'General' is the Resource Group Name, and 'MyOgreResourceImage.png' would be the actual filename of the image resource.
Wow, this is so exciting!