diff options
author | Adam Frisby | 2007-10-20 00:09:07 +0000 |
---|---|---|
committer | Adam Frisby | 2007-10-20 00:09:07 +0000 |
commit | 5adafd538ae98073127f890d8a3db13745e6b716 (patch) | |
tree | 15b4d17d33abe3d6859c42721aff7ad77bee18b8 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD | |
parent | * IRC ChatModule extension should now be more stable. (diff) | |
download | opensim-SC_OLD-5adafd538ae98073127f890d8a3db13745e6b716.zip opensim-SC_OLD-5adafd538ae98073127f890d8a3db13745e6b716.tar.gz opensim-SC_OLD-5adafd538ae98073127f890d8a3db13745e6b716.tar.bz2 opensim-SC_OLD-5adafd538ae98073127f890d8a3db13745e6b716.tar.xz |
* Fixed an issue whereby avatar chat distances were being calculated against the region corner due to a zero vector.
* Bonus Commit: Fixed the Raster class in libTerrain.
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs index 4f98af1..8359f8e 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs | |||
@@ -39,6 +39,11 @@ namespace libTerrain | |||
39 | int h; | 39 | int h; |
40 | Bitmap bmp; | 40 | Bitmap bmp; |
41 | 41 | ||
42 | /// <summary> | ||
43 | /// Creates a new Raster channel for use with bitmap or GDI functions | ||
44 | /// </summary> | ||
45 | /// <param name="width">Width in pixels</param> | ||
46 | /// <param name="height">Height in pixels</param> | ||
42 | public Raster(int width, int height) | 47 | public Raster(int width, int height) |
43 | { | 48 | { |
44 | w = width; | 49 | w = width; |
@@ -46,6 +51,10 @@ namespace libTerrain | |||
46 | bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 51 | bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
47 | } | 52 | } |
48 | 53 | ||
54 | /// <summary> | ||
55 | /// Converts a raster image to a channel by averaging the RGB values to a single 0..1 heightmap | ||
56 | /// </summary> | ||
57 | /// <returns>A libTerrain Channel</returns> | ||
49 | public Channel ToChannel() | 58 | public Channel ToChannel() |
50 | { | 59 | { |
51 | Channel chan = new Channel(bmp.Width, bmp.Height); | 60 | Channel chan = new Channel(bmp.Width, bmp.Height); |
@@ -63,12 +72,21 @@ namespace libTerrain | |||
63 | return chan; | 72 | return chan; |
64 | } | 73 | } |
65 | 74 | ||
75 | /// <summary> | ||
76 | /// Draws a piece of text into the specified raster | ||
77 | /// </summary> | ||
78 | /// <param name="txt">The text string to print</param> | ||
79 | /// <param name="font">The font to use to draw the specified image</param> | ||
80 | /// <param name="size">Font size (points) to use</param> | ||
66 | public void DrawText(string txt, string font, double size) | 81 | public void DrawText(string txt, string font, double size) |
67 | { | 82 | { |
68 | Graphics gd = Graphics.FromImage(bmp); | 83 | Rectangle area = new Rectangle(0, 0, 256, 256); |
69 | //gd.DrawString(txt, | 84 | StringFormat sf = new StringFormat(); |
85 | sf.Alignment = StringAlignment.Center; | ||
86 | sf.LineAlignment = StringAlignment.Center; | ||
70 | 87 | ||
71 | 88 | Graphics gd = Graphics.FromImage(bmp); | |
89 | gd.DrawString(txt, new Font(font, (float)size), new SolidBrush(Color.White), area, sf); | ||
72 | } | 90 | } |
73 | } | 91 | } |
74 | } | 92 | } |