mxGraphViewImageReader.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:Tarski 作者:
/**
 * Creates the image for the given display XML input source. (Note: The XML is an encoded
 * mxGraphView, not mxGraphModel.)
 * 
 * @param inputSource Input source that contains the display XML.
 * @return Returns an image representing the display XML input source.
 */
public static BufferedImage convert(InputSource inputSource, mxGraphViewImageReader viewReader)
    throws ParserConfigurationException, SAXException, IOException {
  BufferedImage result = null;
  SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
  XMLReader reader = parser.getXMLReader();

  reader.setContentHandler(viewReader);
  reader.parse(inputSource);

  if (viewReader.getCanvas() instanceof mxImageCanvas) {
    result = ((mxImageCanvas) viewReader.getCanvas()).destroy();
  }

  return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号