Jump to content

Arbruteblade

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Arbruteblade

  1. I got it working, it overall taught me more about codelab's limitations, but I got it working by basing it slightly more on the template (CurrentPixel = src[x,y]), figuring out which variables should be global, etc. I also managed to improve the algorithm while editing, and I also had to handle, "What if it goes out of the array?" #region UICode int Amount1 = 0; // [0,1530] Offset #endregion byte nextred = 255; byte nextgreen = 0; byte nextblue = 0; int width = 0; int number = 0; int changecheck; bool done; bool done2; ColorBgra[] GradientStore = new ColorBgra[1530]; void progress() { if (nextred == 255 && done == false) { if (nextblue == 0 && nextgreen < 255) { nextgreen++; done = true; } if (nextblue > 0) { nextblue--; done = true; } } if (nextgreen == 255 && done == false) { if (nextred == 0 && nextblue < 255) nextblue++; if (nextred > 0) nextred--; } if (nextblue == 255 && done == false) { if (nextgreen == 0 && nextred < 255) { nextred++; done = true; } if (nextgreen > 0) { nextgreen--; done = true; } } done = false; } void Render(Surface dst, Surface src, Rectangle rect) { int offset = Amount1; if (offset != changecheck || done2 == false) { changecheck = Amount1; while (offset > 0) { progress(); offset--; } while (number < 1530) { GradientStore[number].R = nextred; GradientStore[number].G = nextgreen; GradientStore[number].B = nextblue; progress(); number++; } done2 = true; } number = 0; nextred = 255; nextgreen = 0; nextblue = 0; int position; ColorBgra CurrentPixel; int x = rect.Left; int y; while (x < rect.Right) { y = rect.Top; position = x; if (position >= 1529) position = position - 1529; while (y < rect.Bottom) { CurrentPixel = src[x,y]; CurrentPixel.R = GradientStore[position].R; CurrentPixel.G = GradientStore[position].G; CurrentPixel.B = GradientStore[position].B; dst[x,y] = CurrentPixel; y++; } x++; }
  2. I already have the gradient working, my problem is that it only writes to the top line of the picture and makes the rest black.
  3. My method creates about 1530 colors, using Hsv only creates 360 colors.
  4. I'm trying to make a plugin which makes a rainbow gradient going from left to right, the top line works well, but everything else becomes black, what do I do, or what am I missing about codelab or about Paint.NET? Will I have to make the rest of the plugin in a c# writing program? The version of paint.NET is 3.5.2. Here's the code. #region UICode int Amount1 = 0; // [0,5430] Offset #endregion byte nextred = 255; byte nextgreen = 0; byte nextblue = 0; int width = 0; int number = 0; void progress() { if (nextred == 255) { if (nextblue == 0 && nextgreen < 255) nextgreen++; if (nextblue > 0) nextblue--; } if (nextgreen == 255) { if (nextred == 0 && nextblue < 255) nextblue++; if (nextred > 0) nextred--; } if (nextblue == 255) { if (nextgreen == 0 && nextred < 255) nextred--; if (nextgreen > 0) nextgreen--; } } void Render(Surface dst, Surface src, Rectangle rect) { int offset = Amount1; ColorBgra[] GradientStore = new ColorBgra[5430]; while (offset > 0) { progress(); offset--; } while (number < 5430) { GradientStore[number].R = nextred; GradientStore[number].G = nextgreen; GradientStore[number].B = nextblue; progress(); number++; } ColorBgra CurrentPixel; int x = rect.Left; int y; while (x < rect.Right) { y = rect.Top; while (y < rect.Bottom) { CurrentPixel = GradientStore[x]; CurrentPixel.A = src[x,y].A; dst[x,y] = CurrentPixel; y++; } x++; } } Also, am I in the right forum, any mods please move this if it isn't in the right forum.
  5. One I made in a few minutes using mainly green and blue and being lazier with the circles, using a different plugin for the gradient, and other stuff like that. I also made this one, it took me longer, and is my new desktop background, I chose not to put in any dots... Hidden Content: The effect that can be made with this technique looks really good, well done.
  6. While I wait for a reply, I want to say, I love this plugin, I can finally do basic algorithms without pixel-by-pixel edits, keep up the good work
  7. Thanks for the quick reply, too bad. Anyways, that leads to Sarkut's question. I figure that is more likely, but...it all depends on how the program's clipboard is built (because codelab uses an include code for part of the code).
  8. I'm sorry if this question has already been answered, but, Can you read RGBA values on other layers? How?
  9. Hi, I'm a total n00b and I'm having trouble getting a code to work right. Where do I go to ask someone what to do if I'm having trouble with a codelab code? Also, is there a library of different functions in codelab? Edit: nvm, most of the functions are in the source code.
×
×
  • Create New...