﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Релиб / Программирование / .NET / VB.NET  / По поводу перевода из C# в VB... / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Релиб</description><link>http://www.relib.com/forums/</link><webMaster>robot@relib.com</webMaster><lastBuildDate>Sun, 23 Nov 2008 03:17:18 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: По поводу перевода из C# в VB...</title><link>http://www.relib.com/forums/Topic893793-27-1.aspx</link><description>Меня конкретно интересует перевод вот этого куска:[code] unsafe                     {                            byte * pDest = (byte *)(void *)scan0;                            for (int y = 0; y &lt; watermark.Height; ++y)                            {                                   for (int x = 0; x &lt; watermark.Width; ++x)                                   {                                          // Get HLS of existing colour:                                          Color pixel = Color.FromArgb(pDest[2], pDest[1], pDest[0]);                                          float lumOffset = pixel.GetBrightness() / refLuminance;                                          // Apply the offset to the reference luminance:                                          float lumPixel = backColor.GetBrightness() * lumOffset;                                          // Calculate the new colour                                          HLSRGB newPixel = new HLSRGB(backHue, lumPixel, backSaturation);                                          // set the values:                                          pDest[0] = newPixel.Blue;                                          pDest[1] = newPixel.Green;                                          pDest[2] = newPixel.Red;                                          // leave alpha alone                                                                                           // Move to next BGRA                                          pDest += 4;                                   }                            }                     }                     [/code] та штука, что таится под ссылкой лажу полную показывает</description><pubDate>Tue, 28 Mar 2006 20:16:00 GMT</pubDate><dc:creator>Sickboy</dc:creator></item><item><title>RE: По поводу перевода из C# в VB...</title><link>http://www.relib.com/forums/Topic893793-27-1.aspx</link><description>Здесь (см. ссылку) вставь свой код выбери из какого куда переводить, нажми кнопку "GO", подожди чуток и будет тебе счастье :) http://www.carlosag.net/Tools/CodeTranslator/Default.aspx</description><pubDate>Tue, 28 Mar 2006 03:45:00 GMT</pubDate><dc:creator>neo-programer</dc:creator></item><item><title>По поводу перевода из C# в VB...</title><link>http://www.relib.com/forums/Topic893793-27-1.aspx</link><description>Подскажите, пожалуйста, реально ли переписать процедурину под VB.NET2005?[code]public static void ColouriseWatermark(			Bitmap watermark,			Color backColor			)		{			// Get the reference colour:			Color refColor = watermark.GetPixel(0, 0);			float refLuminance = refColor.GetBrightness();			float backHue = backColor.GetHue();			float backSaturation = backColor.GetSaturation();			// Loop through all the pixels, adjusting the hue, 			// saturation and luminance according to the desired 			// background colour:			// Lock the bitmap bits			BitmapData bmData = watermark.LockBits(				new Rectangle(0, 0, watermark.Width, watermark.Height),				ImageLockMode.ReadWrite,				PixelFormat.Format32bppArgb);			IntPtr scan0 = bmData.Scan0;			unsafe			{				byte * pDest = (byte *)(void *)scan0;				for (int y = 0; y &lt; watermark.Height; ++y)				{					for (int x = 0; x &lt; watermark.Width; ++x)					{						// Get HLS of existing colour:						Color pixel = Color.FromArgb(pDest[2], pDest[1], pDest[0]);						float lumOffset = pixel.GetBrightness() / refLuminance;						// Apply the offset to the reference luminance:						float lumPixel = backColor.GetBrightness() * lumOffset;						// Calculate the new colour						HLSRGB newPixel = new HLSRGB(backHue, lumPixel, backSaturation);						// set the values:						pDest[0] = newPixel.Blue;						pDest[1] = newPixel.Green;						pDest[2] = newPixel.Red;						// leave alpha alone													// Move to next BGRA						pDest += 4;					}				}			}			watermark.UnlockBits(bmData);		}[/code]Если нельзя напрямую, то может подскажет какой нибудь аналог этой процедуры? (без использования unsafe кода) </description><pubDate>Mon, 27 Mar 2006 23:05:00 GMT</pubDate><dc:creator>Sickboy</dc:creator></item></channel></rss>