Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by davidf

  1. Thanks, I didn't know about that -- the .zip file in the original post has been updated to version 1.2 now (this is the only change, so no need for English speakers to re-download). How do you learn about these kinds of things? The template code I was using didn't have this information. I'd love it if there was a "complete guide to writing PDN plugins" ...
  2. The positions are based on a square grid, so using uniform positions doesn't look very interesting -- just a screen full of squares ... You could try other types of grids (triangular, etc.) but the way I wrote the plugin depends on using a square grid, so it isn't simple to try that out.
  3. The levels are just proportional to the distance from each point. The main algorithm for "nearest neighbor" is: For each square in the grid (side length = "cell size" parameter), pick a random point (the cell centre). For each pixel (x, y), find the distance D to the nearest cell centre and divide by the cell size to give a value W; if W > 1, set W to 1. Linearly interpolate between the foreground and background colour using W: foreground * (1 - W) + background * W. The "intensity" parameter is also added to W (and the result is restricted to the range 0 to 1). I tried it out, and
  4. Great! Took me some time to work out where in the image you used it ...
  5. Effects > Render > Cell Texture Edit: Updated to version 1.2 (no code changes, just made sure it uses the internationalized Render menu instead of the string "Render"). Edit: Updated to version 1.1 (added "Combined" distance type and changed "Multiply" method to "Root sum of squares", which looks a bit nicer - also handled coloring better for this method. See left image in the second row below for an example). This plugin was inspired by the page: http://www.blackpawn...ar/default.html The algorithm can create quite a lot of different texture types: The parameters are: Foregr
  6. Aha, that fixes it. Thanks for that! (And thanks for the welcome :-) )
  7. Thanks so much for creating Code Lab -- it's a lot of fun to use. I came across something odd, though ... when I try "Save as DLL" for some code that uses RandomNumber, it fails with the following error message: "The name 'RandomNumber' does not exist in the current context (CS0103)" ... even though the code builds and runs just fine otherwise . Tiny example: void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; CurrentPixel.R = (b
  • Create New...