aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/VectorRender
diff options
context:
space:
mode:
authorSean Dague2009-02-18 12:56:36 +0000
committerSean Dague2009-02-18 12:56:36 +0000
commit383f8b3ac601baef7b2cb322f53fb36b69367286 (patch)
treef90b2535f102be4f3ba50a41bb2668dc2cb956f2 /OpenSim/Region/CoreModules/Scripting/VectorRender
parentremove legacy pre-migration code for mysql grid adapter, who knew this (diff)
downloadopensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.zip
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.gz
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.bz2
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.xz
From: Christopher Yeoh <yeohc@au1.ibm.com>
The attached patch implements osGetDrawStringSize that looks like: vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) in LSL. It is meant to be used in conjunction with the osDraw* functions. It returns accurate information on the size that a given string will be rendered given the specified font and font size. This allows for nicely formatted and positioned text on the generated image.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 6a348a3..c3e39ad 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -89,6 +89,20 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
89 return true; 89 return true;
90 } 90 }
91 91
92 public void GetDrawStringSize(string text, string fontName, int fontSize,
93 out double xSize, out double ySize)
94 {
95 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
96 Graphics graph = Graphics.FromImage(bitmap);
97
98 Font myFont = new Font(fontName, fontSize);
99 SizeF stringSize = new SizeF();
100 stringSize = graph.MeasureString(text, myFont);
101 xSize = stringSize.Width;
102 ySize = stringSize.Height;
103 }
104
105
92 #endregion 106 #endregion
93 107
94 #region IRegionModule Members 108 #region IRegionModule Members