diff options
author | Adam Frisby | 2008-04-30 21:16:36 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-30 21:16:36 +0000 |
commit | f5c312bc3c2567449c7268a54a08a54119f58d53 (patch) | |
tree | 424668a4bbec6873ebc5b8256f3671db102f5e9c /OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |
parent | * Adds the AuthbuyerID field to sqlite and makes use of it. (diff) | |
download | opensim-SC-f5c312bc3c2567449c7268a54a08a54119f58d53.zip opensim-SC-f5c312bc3c2567449c7268a54a08a54119f58d53.tar.gz opensim-SC-f5c312bc3c2567449c7268a54a08a54119f58d53.tar.bz2 opensim-SC-f5c312bc3c2567449c7268a54a08a54119f58d53.tar.xz |
* Refactored Environment/Modules directory - modules now reside in their own directory with any associated module-specific classes.
* Each module directory is currently inside one of the following category folders: Agent (Anything relating to do with Client<->Server communications.), Avatar (Anything to do with the avatar or presence inworld), Framework (Classes modules can use), Grid (Grid traffic, new OGS2 grid comms), Scripting (Scripting functions, etc), World (The enrivonment/scene, IE Sun/Tree modules.)
* This should be moved into a seperate project file.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs (renamed from OpenSim/Region/Environment/Modules/DynamicTextureModule.cs) | 554 |
1 files changed, 277 insertions, 277 deletions
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index 02354f1..63eee97 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -1,277 +1,277 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenJPEGNet; | 34 | using OpenJPEGNet; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.Modules | 39 | namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture |
40 | { | 40 | { |
41 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 41 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager |
42 | { | 42 | { |
43 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 43 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
44 | 44 | ||
45 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = | 45 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = |
46 | new Dictionary<string, IDynamicTextureRender>(); | 46 | new Dictionary<string, IDynamicTextureRender>(); |
47 | 47 | ||
48 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 48 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
49 | 49 | ||
50 | public void Initialise(Scene scene, IConfigSource config) | 50 | public void Initialise(Scene scene, IConfigSource config) |
51 | { | 51 | { |
52 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) | 52 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
53 | { | 53 | { |
54 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); | 54 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); |
55 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | 55 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | public void PostInitialise() | 59 | public void PostInitialise() |
60 | { | 60 | { |
61 | } | 61 | } |
62 | 62 | ||
63 | public void Close() | 63 | public void Close() |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
67 | public string Name | 67 | public string Name |
68 | { | 68 | { |
69 | get { return "DynamicTextureModule"; } | 69 | get { return "DynamicTextureModule"; } |
70 | } | 70 | } |
71 | 71 | ||
72 | public bool IsSharedModule | 72 | public bool IsSharedModule |
73 | { | 73 | { |
74 | get { return true; } | 74 | get { return true; } |
75 | } | 75 | } |
76 | 76 | ||
77 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 77 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
78 | { | 78 | { |
79 | if (!RenderPlugins.ContainsKey(handleType)) | 79 | if (!RenderPlugins.ContainsKey(handleType)) |
80 | { | 80 | { |
81 | RenderPlugins.Add(handleType, render); | 81 | RenderPlugins.Add(handleType, render); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | public void ReturnData(LLUUID id, byte[] data) | 85 | public void ReturnData(LLUUID id, byte[] data) |
86 | { | 86 | { |
87 | if (Updaters.ContainsKey(id)) | 87 | if (Updaters.ContainsKey(id)) |
88 | { | 88 | { |
89 | DynamicTextureUpdater updater = Updaters[id]; | 89 | DynamicTextureUpdater updater = Updaters[id]; |
90 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 90 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
91 | { | 91 | { |
92 | Scene scene = RegisteredScenes[updater.SimUUID]; | 92 | Scene scene = RegisteredScenes[updater.SimUUID]; |
93 | updater.DataReceived(data, scene); | 93 | updater.DataReceived(data, scene); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 99 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
100 | string extraParams, int updateTimer) | 100 | string extraParams, int updateTimer) |
101 | { | 101 | { |
102 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); | 102 | return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); |
103 | } | 103 | } |
104 | 104 | ||
105 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 105 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
106 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | 106 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) |
107 | { | 107 | { |
108 | if (RenderPlugins.ContainsKey(contentType)) | 108 | if (RenderPlugins.ContainsKey(contentType)) |
109 | { | 109 | { |
110 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 110 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
111 | 111 | ||
112 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 112 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
113 | updater.SimUUID = simID; | 113 | updater.SimUUID = simID; |
114 | updater.PrimID = primID; | 114 | updater.PrimID = primID; |
115 | updater.ContentType = contentType; | 115 | updater.ContentType = contentType; |
116 | updater.Url = url; | 116 | updater.Url = url; |
117 | updater.UpdateTimer = updateTimer; | 117 | updater.UpdateTimer = updateTimer; |
118 | updater.UpdaterID = LLUUID.Random(); | 118 | updater.UpdaterID = LLUUID.Random(); |
119 | updater.Params = extraParams; | 119 | updater.Params = extraParams; |
120 | updater.BlendWithOldTexture = SetBlending; | 120 | updater.BlendWithOldTexture = SetBlending; |
121 | updater.FrontAlpha = AlphaValue; | 121 | updater.FrontAlpha = AlphaValue; |
122 | 122 | ||
123 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 123 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
124 | { | 124 | { |
125 | Updaters.Add(updater.UpdaterID, updater); | 125 | Updaters.Add(updater.UpdaterID, updater); |
126 | } | 126 | } |
127 | 127 | ||
128 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 128 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
129 | return updater.UpdaterID; | 129 | return updater.UpdaterID; |
130 | } | 130 | } |
131 | return LLUUID.Zero; | 131 | return LLUUID.Zero; |
132 | } | 132 | } |
133 | 133 | ||
134 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 134 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
135 | string extraParams, int updateTimer) | 135 | string extraParams, int updateTimer) |
136 | { | 136 | { |
137 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); | 137 | return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); |
138 | } | 138 | } |
139 | 139 | ||
140 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 140 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
141 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) | 141 | string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) |
142 | { | 142 | { |
143 | if (RenderPlugins.ContainsKey(contentType)) | 143 | if (RenderPlugins.ContainsKey(contentType)) |
144 | { | 144 | { |
145 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 145 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
146 | updater.SimUUID = simID; | 146 | updater.SimUUID = simID; |
147 | updater.PrimID = primID; | 147 | updater.PrimID = primID; |
148 | updater.ContentType = contentType; | 148 | updater.ContentType = contentType; |
149 | updater.BodyData = data; | 149 | updater.BodyData = data; |
150 | updater.UpdateTimer = updateTimer; | 150 | updater.UpdateTimer = updateTimer; |
151 | updater.UpdaterID = LLUUID.Random(); | 151 | updater.UpdaterID = LLUUID.Random(); |
152 | updater.Params = extraParams; | 152 | updater.Params = extraParams; |
153 | updater.BlendWithOldTexture = SetBlending; | 153 | updater.BlendWithOldTexture = SetBlending; |
154 | updater.FrontAlpha = AlphaValue; | 154 | updater.FrontAlpha = AlphaValue; |
155 | 155 | ||
156 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 156 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
157 | { | 157 | { |
158 | Updaters.Add(updater.UpdaterID, updater); | 158 | Updaters.Add(updater.UpdaterID, updater); |
159 | } | 159 | } |
160 | 160 | ||
161 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 161 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
162 | return updater.UpdaterID; | 162 | return updater.UpdaterID; |
163 | } | 163 | } |
164 | return LLUUID.Zero; | 164 | return LLUUID.Zero; |
165 | } | 165 | } |
166 | 166 | ||
167 | public class DynamicTextureUpdater | 167 | public class DynamicTextureUpdater |
168 | { | 168 | { |
169 | public LLUUID SimUUID; | 169 | public LLUUID SimUUID; |
170 | public LLUUID UpdaterID; | 170 | public LLUUID UpdaterID; |
171 | public string ContentType; | 171 | public string ContentType; |
172 | public string Url; | 172 | public string Url; |
173 | public string BodyData; | 173 | public string BodyData; |
174 | public LLUUID PrimID; | 174 | public LLUUID PrimID; |
175 | public int UpdateTimer; | 175 | public int UpdateTimer; |
176 | public LLUUID LastAssetID; | 176 | public LLUUID LastAssetID; |
177 | public string Params; | 177 | public string Params; |
178 | public bool BlendWithOldTexture = false; | 178 | public bool BlendWithOldTexture = false; |
179 | public bool SetNewFrontAlpha = false; | 179 | public bool SetNewFrontAlpha = false; |
180 | public byte FrontAlpha = 255; | 180 | public byte FrontAlpha = 255; |
181 | 181 | ||
182 | public DynamicTextureUpdater() | 182 | public DynamicTextureUpdater() |
183 | { | 183 | { |
184 | LastAssetID = LLUUID.Zero; | 184 | LastAssetID = LLUUID.Zero; |
185 | UpdateTimer = 0; | 185 | UpdateTimer = 0; |
186 | BodyData = null; | 186 | BodyData = null; |
187 | } | 187 | } |
188 | 188 | ||
189 | public void DataReceived(byte[] data, Scene scene) | 189 | public void DataReceived(byte[] data, Scene scene) |
190 | { | 190 | { |
191 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 191 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); |
192 | byte[] assetData; | 192 | byte[] assetData; |
193 | AssetBase oldAsset = null; | 193 | AssetBase oldAsset = null; |
194 | if (BlendWithOldTexture) | 194 | if (BlendWithOldTexture) |
195 | { | 195 | { |
196 | LLUUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; | 196 | LLUUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; |
197 | oldAsset = scene.AssetCache.GetAsset(lastTextureID, true); | 197 | oldAsset = scene.AssetCache.GetAsset(lastTextureID, true); |
198 | if (oldAsset != null) | 198 | if (oldAsset != null) |
199 | { | 199 | { |
200 | assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); | 200 | assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); |
201 | } | 201 | } |
202 | else | 202 | else |
203 | { | 203 | { |
204 | assetData = new byte[data.Length]; | 204 | assetData = new byte[data.Length]; |
205 | Array.Copy(data, assetData, data.Length); | 205 | Array.Copy(data, assetData, data.Length); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
210 | assetData = new byte[data.Length]; | 210 | assetData = new byte[data.Length]; |
211 | Array.Copy(data, assetData, data.Length); | 211 | Array.Copy(data, assetData, data.Length); |
212 | } | 212 | } |
213 | 213 | ||
214 | //TODO delete the last asset(data), if it was a dynamic texture | 214 | //TODO delete the last asset(data), if it was a dynamic texture |
215 | AssetBase asset = new AssetBase(); | 215 | AssetBase asset = new AssetBase(); |
216 | asset.FullID = LLUUID.Random(); | 216 | asset.FullID = LLUUID.Random(); |
217 | asset.Data = assetData; | 217 | asset.Data = assetData; |
218 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | 218 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); |
219 | asset.Type = 0; | 219 | asset.Type = 0; |
220 | asset.Description = "dynamic image"; | 220 | asset.Description = "dynamic image"; |
221 | asset.Local = false; | 221 | asset.Local = false; |
222 | asset.Temporary = true; | 222 | asset.Temporary = true; |
223 | scene.AssetCache.AddAsset(asset); | 223 | scene.AssetCache.AddAsset(asset); |
224 | 224 | ||
225 | LastAssetID = asset.FullID; | 225 | LastAssetID = asset.FullID; |
226 | 226 | ||
227 | 227 | ||
228 | part.Shape.Textures = new LLObject.TextureEntry(asset.FullID); | 228 | part.Shape.Textures = new LLObject.TextureEntry(asset.FullID); |
229 | part.ScheduleFullUpdate(); | 229 | part.ScheduleFullUpdate(); |
230 | } | 230 | } |
231 | 231 | ||
232 | // TODO: unused | 232 | // TODO: unused |
233 | // private byte[] BlendTextures(byte[] frontImage, byte[] backImage) | 233 | // private byte[] BlendTextures(byte[] frontImage, byte[] backImage) |
234 | // { | 234 | // { |
235 | // return BlendTextures(frontImage, backImage, false, 0); | 235 | // return BlendTextures(frontImage, backImage, false, 0); |
236 | // } | 236 | // } |
237 | 237 | ||
238 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) | 238 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) |
239 | { | 239 | { |
240 | Bitmap image1 = new Bitmap(OpenJPEG.DecodeToImage(frontImage)); | 240 | Bitmap image1 = new Bitmap(OpenJPEG.DecodeToImage(frontImage)); |
241 | Bitmap image2 = new Bitmap(OpenJPEG.DecodeToImage(backImage)); | 241 | Bitmap image2 = new Bitmap(OpenJPEG.DecodeToImage(backImage)); |
242 | if (setNewAlpha) | 242 | if (setNewAlpha) |
243 | { | 243 | { |
244 | SetAlpha(ref image1, newAlpha); | 244 | SetAlpha(ref image1, newAlpha); |
245 | } | 245 | } |
246 | Bitmap joint = MergeBitMaps(image1, image2); | 246 | Bitmap joint = MergeBitMaps(image1, image2); |
247 | 247 | ||
248 | return OpenJPEG.EncodeFromImage(joint, true); | 248 | return OpenJPEG.EncodeFromImage(joint, true); |
249 | } | 249 | } |
250 | 250 | ||
251 | public Bitmap MergeBitMaps(Bitmap front, Bitmap back) | 251 | public Bitmap MergeBitMaps(Bitmap front, Bitmap back) |
252 | { | 252 | { |
253 | Bitmap joint; | 253 | Bitmap joint; |
254 | Graphics jG; | 254 | Graphics jG; |
255 | 255 | ||
256 | joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb); | 256 | joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb); |
257 | jG = Graphics.FromImage(joint); | 257 | jG = Graphics.FromImage(joint); |
258 | 258 | ||
259 | jG.DrawImage(back, 0, 0, back.Width, back.Height); | 259 | jG.DrawImage(back, 0, 0, back.Width, back.Height); |
260 | jG.DrawImage(front, 0, 0, back.Width, back.Height); | 260 | jG.DrawImage(front, 0, 0, back.Width, back.Height); |
261 | 261 | ||
262 | return joint; | 262 | return joint; |
263 | } | 263 | } |
264 | 264 | ||
265 | private void SetAlpha(ref Bitmap b, byte alpha) | 265 | private void SetAlpha(ref Bitmap b, byte alpha) |
266 | { | 266 | { |
267 | for (int w = 0; w < b.Width; w++) | 267 | for (int w = 0; w < b.Width; w++) |
268 | { | 268 | { |
269 | for (int h = 0; h < b.Height; h++) | 269 | for (int h = 0; h < b.Height; h++) |
270 | { | 270 | { |
271 | b.SetPixel(w, h, Color.FromArgb(alpha, b.GetPixel(w, h))); | 271 | b.SetPixel(w, h, Color.FromArgb(alpha, b.GetPixel(w, h))); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } \ No newline at end of file |