Rainbow flower

Posted by Dan on Mar 20th, 2009
2009
Mar 20

RF500Sig

 

Lately I’ve been playing with Paint.Net, yet another paint program.  This one is free, but not open-source.  It allows people to write plug-ins in C#, my favorite language for image manipulation.  CodeLab is a plug-in that helps you write plug-ins.  CodeLab is free and open-source.

 

It’s hard to describe how enticing to a computer nerd the idea of “tools to build tools” is.  It’s Nerd Heaven!  The only thing better than tools to build tools would be tools to build tools to build tools.

 

But let’s put CodeLab to the test.  I want to shuffle the colors in an image.  I want to replace the reds with greens, the greens with blues and the blues with reds.  Here is the code inside CodeLab:

 

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CurrentPixel;
    ColorBgra NewPixel;
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CurrentPixel = src[x,y];
            NewPixel = CurrentPixel;
            NewPixel.R = CurrentPixel.G;
            NewPixel.G = CurrentPixel.B;
            NewPixel.B = CurrentPixel.R;
            NewPixel.A = CurrentPixel.A;
            dst[x,y] = NewPixel;
        }
    }
}

 

This was so easy that I wrote a few more plug-ins.  Here is how they look in the Paint.Net menu:

 

PaintNet

 

The rest is anticlimactic. I took a digital photo of a flower, reduced it to six different sizes, and used my new plug-ins to color-shift each size in a different way. I stacked the flowers and flattened the layers.

One Response

  1. TTB Says:

    Whoa, Dude! That is nerdacious! Like, Totally!

    I take it tho that despite this concentric Flower 1.0, you can do things like fan the images instead of centering them, add other images for collage e-Ffects, maybe make kaleidoscope images?

    Icons in the lower right: If there were a few more of them, the viewer might be induced to wonder whether they are a signature (as they appear to be now), a caption, or something else entirely. Especially if they were vertical instead of horizontal.

Leave a Comment




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.