0 Members and 2 Guests are viewing this topic.
bool done = false;void Render(Surface dst, Surface src, Rectangle rect){ Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; string[,] binary1 = new string[8,8]; string[,] binary2 = new string[8,8]; int xx; int yy = 0; for (int y = selection.Top; y < selection.Bottom; y++) { xx=0; if (IsCancelRequested) return; for (int x = selection.Left; x < selection.Right;x++) { CurrentPixel = src[x,y]; int rgb = (CurrentPixel.R+CurrentPixel.G+CurrentPixel.B)/3; if(rgb >= 0 && rgb < 64) { binary1[xx,yy] = "1"; binary2[xx,yy] = "1"; } else if(rgb >= 64 && rgb < 128) { binary1[xx,yy] = "1"; binary2[xx,yy] = "0"; } else if(rgb >= 128 && rgb < 192) { binary1[xx,yy] = "0"; binary2[xx,yy] = "1"; } else if(rgb >= 192 && rgb < 256) { binary1[xx,yy] = "0"; binary2[xx,yy] = "0"; } dst[x,y] = CurrentPixel; xx++; } yy++; } if(done == false) { string line; string hex = "["; for(int y = 0; y < 8; y++) { line = ""; for(int x = 0; x < 8; x++) line += binary1[x,y]; hex += ConvertHex(line); } hex += "]["; for(int y = 0; y < 8; y++) { line = ""; for(int x = 0; x < 8; x++) line += binary2[x,y]; hex += ConvertHex(line); } hex += "]"; System.IO.File.WriteAllText(@"C:\Users\user\Desktop\Dota Duelz\hex.txt", hex); done = true; }}string ConvertHex(string strBinary){ string hex = Convert.ToInt32(strBinary,2).ToString("X"); if(hex.Length == 1) hex = "0" + hex; return hex;}
bool done = false;void Render(Surface dst, Surface src, Rectangle rect){ Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; int itr = 3; string hex1; string hex2; string hexi = "0123456789ABCDEF"; int tempInt1; int tempInt2; for (int y = selection.Top; y < selection.Bottom; y++) { if (IsCancelRequested) return; for (int x = selection.Left; x < selection.Right;x++) { CurrentPixel = src[x,y]; int rgb = 4-((CurrentPixel.R+CurrentPixel.G+CurrentPixel.B)/192); if(rgb>1){ tempInt1+= Math.pow(2,itr) } if(rgb==1||rgb==3){ tempInt2+= Math.pow(2,itr) } if(itr == 0){ irt = 3; hex1 += hexi[tempInt1]; hex2 += hexi[tempInt2]; temp1 = 0; temp2 = 0; } itr--; } } if(done == false) { System.IO.File.WriteAllText(@"C:\Users\user\Desktop\Dota Duelz\hex.txt", "["+hex1+" "+hex2+"]"); done = true; }}
bool done = false;void Render(Surface dst, Surface src, Rectangle rect){ Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; int itr = 3; string hex1; string hex2; string hexi = "FEDCBA9876543210"; byte temp1; byte temp2; for (int y = selection.Top; y < selection.Bottom; y++) { if (IsCancelRequested) return; for (int x = selection.Left; x < selection.Right;x++) { CurrentPixel = src[x,y]; byte rgb = (CurrentPixel.R+CurrentPixel.G+CurrentPixel.B)/192; temp1=((rgb >> 1) + temp1) *2; //might have to change to temp1=((rgb & 2 >> 1) + temp1) *2; temp2=((rgb & 1 )+ temp2) *2; if(itr == 0){ irt = 3; hex1 += hexi[temp1]; hex2 += hexi[temp2]; tempInt1 = 0; tempInt2 = 0; } itr--; } } if(done == false) { System.IO.File.WriteAllText(@"C:\Users\user\Desktop\Dota Duelz\hex.txt", "["+hex1+" "+hex2+"]"); done = true; }}