Jump to content

Omar Chehab

Newbies
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

157 profile views

Omar Chehab's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. I was using write to file because I just wanted an output of some kind, I changed it to message box and that's what I am staying with. I don't want any parameters on my plugin dialog either. After lots of research I managed to finish up the plugin, it's for personal use so the conditional running isn't a problem. Thanks for your time! I fixed my issue by implementing my RENDER code to the ONSETRENDERINFO method
  2. Okay, I have looked into filetypes. They look pretty interesting, how ever I can't seem to implement what I have currenty which is a codelab render script onto the filetype script on visual studio 2010. I don't understand how filetypes work and i cant find a propper newbie tutorial that takes me through installation and setup as well. I really want to fix this issue, and what's bothering me is the fact that it is such a simple problem. It's taking me ages to solve, i keep running into brick walls. How can I force the render method in codelab to run once? I am aware that it will slow down the process, however my plugin deals with pixel art so it will always be fast Ive looked into OnSetRenderInfo, where is that used? Codelab or visual studio? How can I implement it into code lab with the parameters of the render function? Is it possible to access those parameters on it?
  3. Thank you for your reply, I was really confused by this. I will look into applying what you told me. On a sidenote, how can I transfer this code from the render method to the onsetrenderinfo method so it can run only once? I can't seem to figure it out since the parameters differ.
  4. Hello, I have recently needed a converter to hexadecimal from colored images. This plugin is used for sprite development on the ti-84 graphing calculator. I surfed the internet and couldn't find what I needed, so I decided to write a plugin on paint.net that will process my selection and display the output. Here's my progress, it currently is functional however it is conditional. It only properly works when my selection is 8x8, i am aware that i can put it in try and catch i will for sure implement that later, I want to focus on the things that matter now. 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; } Keep in mind this is the first plugin i write on paint.net, so it probably isn't the most efficient way to do this. Now my question is: what is a good way to display the output string "hex" to the user? I am currently writing to a file. Coming from java development I don't know the tools i can use to do these operations. I tried to display a message box but it seems to open it 8 times and that's why i tried implementing the Boolean done so i make sure it runs only once, but i am not sure why it didn't work. EDIT: Forgot to add a visual example of what it does: It starts with the first image, i have to manually select 8 x 8 pixels and run the program to generate these four pairs hexs [04050B3434742EEC][070E1A3B166E655B] [20F0782C0A1E3577][E0A090BC3E34771E] [5455D4F4CA5F7B00][F9FAF3CFFD6E6A00] [1B9B1B3733FBFE00][0E2FFF5B777B3200] and using this website, I am able to see the images visually http://clrhome.org/pix/
×
×
  • Create New...