maxGraph/dotnet/docs/html/classcom_1_1mxgraph_1_1mxIm...

217 lines
11 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mxGraph: com.mxgraph.mxImageBundle Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">mxGraph
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacecom.html">com</a></li><li class="navelem"><a class="el" href="namespacecom_1_1mxgraph.html">mxgraph</a></li><li class="navelem"><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html">mxImageBundle</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="classcom_1_1mxgraph_1_1mxImageBundle-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">com.mxgraph.mxImageBundle Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Maps from keys to base64 encoded images or file locations. All values must be URLs or use the format data:image/format followed by a comma and the base64 encoded image data, eg. "data:image/gif,XYZ", where XYZ is the base64 encoded image data.
<a href="classcom_1_1mxgraph_1_1mxImageBundle.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac08a8c7641c7c68aed104a90e0b7dbe9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html#ac08a8c7641c7c68aed104a90e0b7dbe9">PutImage</a> (String key, String value)</td></tr>
<tr class="memdesc:ac08a8c7641c7c68aed104a90e0b7dbe9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds the specified entry to the map. <a href="#ac08a8c7641c7c68aed104a90e0b7dbe9">More...</a><br /></td></tr>
<tr class="separator:ac08a8c7641c7c68aed104a90e0b7dbe9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb573dee291df27a7297be30c18fda38"><td class="memItemLeft" align="right" valign="top">String&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html#aeb573dee291df27a7297be30c18fda38">GetImage</a> (String key)</td></tr>
<tr class="memdesc:aeb573dee291df27a7297be30c18fda38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the value for the given key. <a href="#aeb573dee291df27a7297be30c18fda38">More...</a><br /></td></tr>
<tr class="separator:aeb573dee291df27a7297be30c18fda38"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:af8808b2694bb6efcba40a5879b5cb505"><td class="memItemLeft" align="right" valign="top">Dictionary&lt; String, String &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html#af8808b2694bb6efcba40a5879b5cb505">images</a> = new Dictionary&lt;String, String&gt;()</td></tr>
<tr class="memdesc:af8808b2694bb6efcba40a5879b5cb505"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maps from keys to images. <a href="#af8808b2694bb6efcba40a5879b5cb505">More...</a><br /></td></tr>
<tr class="separator:af8808b2694bb6efcba40a5879b5cb505"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:ae9680e72d45e7c06aa42e950ef765b63"><td class="memItemLeft" align="right" valign="top">Dictionary&lt; String, String &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html#ae9680e72d45e7c06aa42e950ef765b63">Images</a><code> [get]</code></td></tr>
<tr class="memdesc:ae9680e72d45e7c06aa42e950ef765b63"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the images. <a href="#ae9680e72d45e7c06aa42e950ef765b63">More...</a><br /></td></tr>
<tr class="separator:ae9680e72d45e7c06aa42e950ef765b63"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Maps from keys to base64 encoded images or file locations. All values must be URLs or use the format data:image/format followed by a comma and the base64 encoded image data, eg. "data:image/gif,XYZ", where XYZ is the base64 encoded image data. </p>
<p>To add a new image bundle to an existing graph, the following code is used:</p>
<p><a class="el" href="classcom_1_1mxgraph_1_1mxImageBundle.html" title="Maps from keys to base64 encoded images or file locations. All values must be URLs or use the format ...">mxImageBundle</a> bundle = new mxImageBundle(); bundle.PutImage("myImage", "data:image/gif,R0lGODlhEAAQAMIGAAAAAICAAICAgP" + "//AOzp2O3r2////////yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQBCgAHACwAAAAA" + "EAAQAAADTXi63AowynnAMDfjPUDlnAAJhmeBFxAEloliKltWmiYCQvfVr6lBPB1ggxN1hi" + "laSSASFQpIV5HJBDyHpqK2ejVRm2AAgZCdmCGO9CIBADs="); graph.AddImageBundle(bundle);</p>
<p>The image can then be referenced in any cell style using image=myImage.</p>
<p>To convert a given Image to a base64 encoded String, the following code can be used:</p>
<p>MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); byte[] data = ms.ToArray(); Console.WriteLine("base64="+Convert.ToBase64String(data));</p>
<p>The value is decoded in <a class="el" href="classcom_1_1mxgraph_1_1mxUtils.html#a2a71827c05120b140caa51409a363282" title="Loads an image from the local filesystem, a data URI or any other URL. ">mxUtils.LoadImage</a>. The keys for images are resolved and the short format above is converted to a data URI in mxGraph.postProcessCellStyle. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="aeb573dee291df27a7297be30c18fda38"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeb573dee291df27a7297be30c18fda38">&#9670;&nbsp;</a></span>GetImage()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">String com.mxgraph.mxImageBundle.GetImage </td>
<td>(</td>
<td class="paramtype">String&#160;</td>
<td class="paramname"><em>key</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the value for the given key. </p>
<p class="reference">Referenced by <a class="el" href="classcom_1_1mxgraph_1_1mxGraph.html#abcf2c8640c3a2645b92bc899a40bda57">com.mxgraph.mxGraph.GetImageFromBundles()</a>.</p>
</div>
</div>
<a id="ac08a8c7641c7c68aed104a90e0b7dbe9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac08a8c7641c7c68aed104a90e0b7dbe9">&#9670;&nbsp;</a></span>PutImage()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void com.mxgraph.mxImageBundle.PutImage </td>
<td>(</td>
<td class="paramtype">String&#160;</td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">String&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds the specified entry to the map. </p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="af8808b2694bb6efcba40a5879b5cb505"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8808b2694bb6efcba40a5879b5cb505">&#9670;&nbsp;</a></span>images</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Dictionary&lt;String, String&gt; com.mxgraph.mxImageBundle.images = new Dictionary&lt;String, String&gt;()</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Maps from keys to images. </p>
</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a id="ae9680e72d45e7c06aa42e950ef765b63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae9680e72d45e7c06aa42e950ef765b63">&#9670;&nbsp;</a></span>Images</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Dictionary&lt;String, String&gt; com.mxgraph.mxImageBundle.Images</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the images. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/utils/mxImageBundle.cs</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>