This should probably go into Graphics but I thought I'd start here:
Small Drawing Challenge
I'm looking a for compact and fast-running way of creating something like an Identicon. What I had in mind was to "paint" such an image onto a 24x24 pixel PictureBox.
The image would have 9 cells, a center C, four corners K, and four faces F:
Code:
+---+---+---+
| K | F | K |
+---+---+---+
| F | C | F |
+---+---+---+
| K | F | K |
+---+---+---+
I'm happy to make it simple: pass in four parameters to the routine, each being an Integer in the range 0 to 7. I'll worry about hashing my actual input to create these four values, right now my problem is drawing the desired "snowflake."
The background color would be white.
The first parameter would select among 8 possible contrasting colors: constrasting well against white. The 8 colors should be fairly distinctive among each other, avoiding things line fine shades of yellow or cyan (i.e. not cyan and slightly lighter cyan). For example:
Black
Medium Blue
Teal
Medium Green
Yellow
Orange
Red
Medium Grey
The specific colors aren't important though, just distinct colors.
The second parameter would pick one of 8 "shapes" to draw in the center square.
The third parameter would pick one of another 8 shapes to draw mirrored in the corner squares.
The fourth parameter would pick one of another 8 shapes to draw rotated in the face squares.
The actual "shapes" could be defined as a sequence of Picture.Line and Picture.Circle relative drawing methods to create filled rectangles and/or circles. Something on that order would be preferable to blitting in predefined images, but that's just a thought too. Better idea? Show me!
If someone knows where I could find existing code to do this it'd be great too.
Hmmm... Are you sure you cannot do it with 9 labels or 9 text boxes? Color options are rather extensive with these controls. Just a thought in an effort to make things simple.
Code Doc: you can't, because you have to create images with some complex patterns (see the Wikipedia article to understand why Identicons are used instead of text).
Code Doc: you can't, because you have to create images with some complex patterns (see the Wikipedia article to understand why Identicons are used instead of text).
OK, now I see what you mean. I'm sure Dilettante already tried solving this using standard VB6 controls. Maybe he is trying to make this thing more complicated than it has to be. Tail wagging dog?
In my case I don't need an enormous number of unique patterns, just a decent number. So as I first suggested: 8 * 8 * 8 = 512 unique patterns used in 8 colors for 4096 unique "icons."
The reflective symmetry makes them a little more attractive and perhaps memorable than a random drawing.
In my case I want to use them as "visual tags" in a vertical list of ~ 300 items. Items that are related would have the same Identicon tag at the left, making it slightly easier to scroll down the list looking for the next "related item" in the list.
Sort of like scrolling through a thread here in the forum, looking for a matching avatar to find a specific person's next post by eye.
OK, now I see what you mean. I'm sure Dilettante already tried solving this using standard VB6 controls. Maybe he is trying to make this thing more complicated than it has to be. Tail wagging dog?
Well I was hoping this was a simple problem somebody had already solved, seeing as they are used so commonly today. I didn't want to invent anything if it already existed.
Think of it as a sort of "visual hash" created on the fly based on some input value.