void HtmlWriter::writeTextTag(const InstanceInfo& obj) { m_Output << (obj.type == "text" ? "<Text " :"<Paragraph ") << endl; m_Output << "shader_id=\"" << obj.getAttribute("shader",m_DefaultShaderId) << "\" "; if(obj.hasAttribute("font_size")){ m_Output << "font_size=\""<<obj.getAttribute("font_size")<<"\" "; } if(obj.hasAttribute("col")){ m_Output << "col=\""<<obj.getAttribute("col")<<"\" "; } if(obj.hasAttribute("text_col")){ m_Output << "text_col=\""<<obj.getAttribute("text_col")<<"\" "; } if(obj.hasAttribute("back_col")){ m_Output << "back_col=\""<<obj.getAttribute("back_col")<<"\" "; } if(obj.hasAttribute("back_alpha")){ m_Output << "back_alpha=\""<<obj.getAttribute("back_alpha")<<"\" "; } SUPoint3D pos = { 0.0f, -3.5f, 0.0f }; writeTransform(m_Output,obj.transform,true, pos); m_Output << " scale=\"" << getTransformScale(obj.transform) << "\" >"; m_Output << obj.value; m_Output << (obj.type == "text" ? "</Text>" :"</Paragraph>") << endl; }
VOID HtmlWriter::writeImageTag(const InstanceInfo& obj) { m_Output << "<Image id=\"" << obj.value << "\" "; writeTransform(m_Output,obj.transform, false, obj.offset); m_Output << "shader_id=\"" << obj.getAttribute("shader",m_DefaultShaderId) << "\" "; if(obj.hasAttribute("scale")) { m_Output << "scale=\"" << obj.getAttribute("scale") << "\" "; } else { m_Output << "scale=\"" << length(xaxis*obj.transform) << " " << length(yaxis*obj.transform) << " 0\" "; } m_Output <<" />" << endl; }
void HtmlWriter::writeObjectTag(const InstanceInfo& obj) { m_Output << "<Object id=\"" << obj.modelId << "\" "; m_Output << " shader_id=\"" << obj.getAttribute("shader",m_DefaultShaderId) << "\""; m_Output << " locked=\"true\" "; if(obj.type != "nonsolid" && obj.modelName[0] != '+' ) { m_Output << " collision_id=\"" << obj.modelId <<"\" "; } if(obj.hasAttribute("rotate_speed")){ m_Output << " rotate_deg_per_sec=\"" << obj.getAttribute("rotate_speed") << "\" rotate_axis=\"" << obj.getAttribute("rotate_axis", "0 0 1") << "\" "; } writeTransform(m_Output, obj.transform, false); m_Output << " scale=\"" << getTransformScale(obj.transform) << "\"/>" << endl; }
void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, const AffineTransform& transform) { const int w = sourceImage.getWidth(); const int h = sourceImage.getHeight(); writeClip(); out << "gsave "; writeTransform (transform.translated ((float) stateStack.getLast()->xOffset, (float) stateStack.getLast()->yOffset) .scaled (1.0f, -1.0f)); RectangleList imageClip; sourceImage.createSolidAreaMask (imageClip, 0.5f); out << "newpath "; int itemsOnLine = 0; for (RectangleList::Iterator i (imageClip); i.next();) { if (++itemsOnLine == 6) { out << '\n'; itemsOnLine = 0; } const Rectangle<int>& r = *i.getRectangle(); out << r.getX() << ' ' << r.getY() << ' ' << r.getWidth() << ' ' << r.getHeight() << " pr "; } out << " clip newpath\n"; out << w << ' ' << h << " scale\n"; out << w << ' ' << h << " 8 [" << w << " 0 0 -" << h << ' ' << (int) 0 << ' ' << h << " ]\n"; writeImage (sourceImage, 0, 0, w, h); out << "false 3 colorimage grestore\n"; needToClip = true; }
inline ostream& operator<<(ostream& html, Transform t) { return writeTransform(html,t); }