Jump to content

BoltBait

Administrator
  • Posts

    15,651
  • Joined

  • Last visited

  • Days Won

    390

Everything posted by BoltBait

  1. For me, it was, "WTF, Rick broke the alpha only gradient... back to *my* gradient plugin. "
  2. OK, *NOW* I understand. I can live with that. I'll just have to retrain my brain.
  3. Hmmm... So, you don't look at the alpha of the selected colors. That's ok, I guess. But, if they're set funny, it doesn't work? Bah!
  4. Steps to reproduce: 1) Open Paint.NET 2) Create a new layer and select it. 3) Fill that layer with a color (black) 4) In the color window, set your secondary color alpha to 0 5) Draw a gradient with alpha only selected. Notice that the entire layer goes transparent.
  5. Oh! Well, just use the Clone/Stamp tool. If you need help on that (which you probably will) read the help file. The Clone/Stamp tool is the frikin bomb! 8)
  6. Try this: http://paintdotnet.12.forumer.com/viewtopic.php?t=1577
  7. That's a good idea. When I'm done with the one's I'm working on, I'll look at them.
  8. OK, that was easy... void Render(Surface dst, Surface src, Rectangle rect) { int depth = 100; // maximum distance of the reflection int MaxAlpha = 128; // darkest reflection (255-0, default 128) int ignore = 0; // bottom pixels of object to ignore PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; for(int y = rect.Top; y { for (int x = rect.Left; x { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; // Get the current pixel if (CurrentPixel.A == 0) // is it transparent? { int y1=0; int yd=0; for (y1=y; y1 > 0; y1--) { if ((y1 != selection.Top) && (src[x,y1].A == 0)) { yd++; } else { break; } } if (y1+1-yd-ignore >= 0) { CurrentPixel=src[x,y1+1-yd-ignore]; if (CurrentPixel.A > 0) if (yd { // fade the reflection out CurrentPixel.A = (byte)((MaxAlpha/depth)*(depth-yd)*CurrentPixel.A/255); } else { CurrentPixel.A = 0; // totally faded at this point } } } dst[x,y] = CurrentPixel; } } } } DON'T USE THIS AS THERE IS A BUG IN IT. USE THE ONE IN MY ORIGINAL POST. Well, I'm done playing with this. OK, screenshots have been updated (not on this thread though, sorry). Go here for the whole story: http://boltbait.googlepages.com/reflections Enjoy. 8)
  9. Yeah, thanks. I hadn't even thought about that. I only spent about 1/2 hour on this so I knew it would have problems. Yeah, that's what Rick said. Hey! I told you it was rough. Just looking at it, I see there is another bug in there too: if ((y1 == rect.Top) || (src[x,y1].A == 0)) should be: if ((y1 != selection.Top) && (src[x,y1].A == 0)) I keep forgetting to use selection instead of rect. And then, of course, I need to add the following at the top of the function: Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); That will cause the reflection to start at the top of the selection if the selection does not have any non-transparent pixels in it. This eliminates the need to draw a line under text and other odd shapes that I said before. That was my original intent, but I couldn't figure out why it wasn't working. OK, so here's the updated code. The effect is starting to look pretty good... void Render(Surface dst, Surface src, Rectangle rect) { int depth = 100; // maximum distance of the reflection int MaxAlpha = 128; // darkest reflection (255-0, default 128) PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; for(int y = rect.Top; y { for (int x = rect.Left; x { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; // Get the current pixel if (CurrentPixel.A == 0) // is it transparent? { int y1=0; int yd=0; for (y1=y; y1 > 0; y1--) { if ((y1 != selection.Top) && (src[x,y1].A == 0)) { yd++; } else { break; } } if (y1+1-yd >= 0) { CurrentPixel=src[x,y1+1-yd]; // look in the mirror if (CurrentPixel.A > 0) if (yd { // fade the reflection out CurrentPixel.A = (byte)((MaxAlpha/depth)*(depth-yd)*CurrentPixel.A/255); } else { // totally faded at this point CurrentPixel.A = 0; } } } dst[x,y] = CurrentPixel; } } } } DO NOT USE THIS SCRIPT, IT HAS BEEN UPDATED BELOW. Well, I think one thing left to do is to be able to specify an amount of pixels to ignore before starting the reflection. I'll add that capability on Monday. Then I'll ask Illnab1024 to put a UI on it--that is, if you all think its worth it. Let me know.
  10. Compiled DLL (Thanks to MadJik): <!-- m -->http://jcljay.free.fr/pdn/ReflectionFlat.zip<!-- m --> I need to make some graphics with reflections similar to the following: What a pain! Well, really only the one on the right turned out to be a pain. Anyway, I tinkered around in code lab and wrote the following codelab script: (This is the updated script) void Render(Surface dst, Surface src, Rectangle rect) { int depth = 100; // maximum distance of the reflection int MaxAlpha = 128; // darkest reflection (255-0, default 128) int ignore = 0; // bottom pixels of object to ignore PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra CurrentPixel; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; // Get the current pixel if (CurrentPixel.A == 0) // is it transparent? { int y1=0; int yd=0; for (y1=y; y1 > 0; y1--) { if ((y1 != selection.Top) && (src[x,y1].A == 0)) { yd++; } else { break; } } if (y1+1-yd-ignore >= 0) { CurrentPixel=src[x,y1+1-yd-ignore]; if (CurrentPixel.A > 0) if (yd<depth) { // fade the reflection out CurrentPixel.A = (byte)(((double)MaxAlpha/depth)*(depth-yd)*CurrentPixel.A/255); } else { CurrentPixel.A = 0; // totally faded at this point } } } dst[x,y] = CurrentPixel; } } } } Instructions for use: 1) Create a new layer that is totally transparent. 2) On that layer, place the object that you want to make a reflection for. 3) Select the area where you want the reflection to show. 4) Run the codelab script: Sometimes you will want to ignore the bottom of the object like in this example: 5) Notice how the bottom of the yellow box is showing in the reflection. Just increase the Ignore value to get rid of that. Here it is shown with an Ignore value of 3: You'll need to tinker with the depth and MaxAlpha variables to get something workable. Thanks, MadJik for putting a UI on this one!
  11. Ah, yes. Well, the paint bucket tool uses the Tolerance slider. Look around for that and change it to something less than 100%.
  12. OK, I found a bug in this filter. It wasn't properly blurring the bottom and right edge pixel of your selection if your selection was not covering the entire layer. So, if you have not downloaded the DLL since I posted this message, please do so--it has been corrected.
  13. I have a couple of issues with the zoom drop-down list. 1) When the image is smaller then the screen and you select "Window" it will not zoom in further than 100%. I expect the image to zoom in close enough to fill the screen. 2) When you select "Window" it should select the actual zoom percentage instead of the word "Window". Thanks, BoltBait
  14. Have you tried right-clicking on the line nubs? It turns the line into a bezier curve. You can get much smoother and more natural curves that way.
  15. can u use the search function of the forums?
  16. Rick, the problem with this is that most of the pixels that are being blurred are completely transparent. But, I'll look again at this for the non-transparent pixels. I'm using the results of the Gaussian blur to slightly expand the size of the new object, not make it smaller. I played around with making the new object smaller (by only making the edges more transparent) and the results were not looking as good--remember my goal, combining natural objects with a natural background. Kaiser Yoshi, you are correct. This effect will not work for EVERY image you can come up with. However, for combining natural images, I think you will find it very useful. EDIT: OK, Rick, I did a test by keeping the RGB values of non-transparent pixels and I couldn't see the difference until I zoomed way in (400%+). And, when I did zoom in and could start to perceive a difference, it didn't look as natural as the regular blur. So, meh. I'm leaving it. Oh, I'm sure you could come up with a pattern that would show a major difference, but like I said, when used to combine one natural picture with another I think the effect is pretty good.
  17. But, if you think about it, that's EXACTLY what its doing. If you Gaussian blur a pixel that is sitting next to a totally transparent pixel, it becomes slightly transparent. Then, if you blur that transparent pixel, it takes on some of the color of the previous pixel and becomes slightly less transparent. Isn't that exactly what you describe? Anyway, I did some experimenting with it and figured out that the blur that I was applying was too small. I had hard set the Gaussian Blur to a radius of 1. I have changed it to 2, recompiled the DLL and re-posted. Except for the smallest of pictures, it is a big improvement.
  18. Well, I played around with this using both large and small images. Gaussian Blur (1) is a little too small, but Gaussian Blur (2) is just about right. Going beyond 2, even on really large images, didn't really make that much of a positive difference--remember, the whole point is to just soften the edges slightly. Anyway, I made a change to my code to use 2 instead of 1 and posted up the revised DLL.
  19. I don't think I'll post the source unless I have a UI put on it. Seriously, there is nothing to be learned from it. Oh, and be sure to read and respond to my edit above.
  20. Not with the DLL that I made. I don't think its possible to have a UI with Codelab. But, yes, if you had the source code, you could change it to Blur(2) for example. If you like, I could ask Illnab1024 to put a UI on it and make the blur radius adjustable for either 1 (default) or 2. I don't think going beyond 2 would be useful. What do you think?
  21. You missed the fact that it only blurs around the edges of an object. Yes, it does a Gaussian Blur (1) on the layer, BUT it only blurs pixels that are on the edges--that is, pixels that are next to a transparent pixel. And, it blurs transparent pixels. So, since it does not blur the entire image, you do not lose detail in your main objects, only the edges.
×
×
  • Create New...