Results 1 to 9 of 9

Thread: [RESOLVED] Small Drawing Challenge

  1. #1

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Resolved [RESOLVED] Small Drawing Challenge

    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.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Small Drawing Challenge

    There appears to be identicons for .NET, which may be easier to convert to VB6 than identicons for PHP.

  3. #3

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Small Drawing Challenge

    Thanks. The links seem dead but I'm sure I can track it down.

    Has to be better than my first wacky attempt.
    Attached Files Attached Files

  4. #4
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Small Drawing Challenge

    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.
    Doctor Ed

  5. #5
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Small Drawing Challenge

    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).

  6. #6
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Small Drawing Challenge

    Quote Originally Posted by Merri View Post
    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?
    Doctor Ed

  7. #7

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Small Drawing Challenge

    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.

  8. #8

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Small Drawing Challenge

    Quote Originally Posted by Code Doc View Post
    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.

  9. #9

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Small Drawing Challenge

    With some tweaking I guess I can just get by with my Bloticons for now.
    Attached Images Attached Images  

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width