Thread: bitmap conversion from 16x16 to 32x32

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    3

    bitmap conversion from 16x16 to 32x32

    Hi

    Im trying bitmap conversion from 16x16 to 32x32.
    Can anybody tell me the logic or code to convert this..

    For ex-
    16x16 bitmap..

    ...X............
    ..X.............
    .X..............
    X...............
    ...............X
    ..............X.
    .............X..
    ............X...
    ...........X....
    ..........X.....
    .........X......
    ........X.......
    .......X........
    ......X.........
    .....X..........
    ....X...........

    32x32 bitmap

    ......XX........................
    .....XX.........................
    ....XX..........................
    ...XX...........................
    ..XX............................
    .XX.............................
    XX..............................
    X...............................
    ...............................X
    ..............................XX
    .............................XX.
    ............................XX..
    ...........................XX...
    ..........................XX....
    .........................XX.....
    ........................XX......
    .......................XX.......
    ......................XX........
    .....................XX.........
    ....................XX..........
    ...................XX...........
    ..................XX............
    .................XX.............
    ................XX..............
    ...............XX...............
    ..............XX................
    .............XX.................
    ............XX..................
    ...........XX...................
    ..........XX....................
    .........XX.....................
    ........XX......................


    Thanks & Regards,
    sharath

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That wouldn't be particularly trivial, because you need to figure out that you have stroke through your bitmap and then anti-alias it (that is, make it look like this:
    Code:
    ...XX......
    ..XX.......
    .XX........
    XX.........
    rather than:
    Code:
    ..XX.......
    ..XX.......
    XX.........
    XX..........
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    3
    Hi,

    thanks for the reply.
    I didn't got what you said actually!.
    Now i have all 16x16 bits in one array. Then how I can convert to 32x32...
    For ex-
    ..XX..XX..XX..XX
    .XX..XX..XX..XX.
    XX..XX..XX..XX..
    X..XX..XX..XX..X
    ..XX..XX..XX..XX
    .XX..XX..XX..XX.
    XX..XX..XX..XX..
    X..XX..XX..XX..X
    ..XX..XX..XX..XX
    .XX..XX..XX..XX.
    XX..XX..XX..XX..
    X..XX..XX..XX..X
    ..XX..XX..XX..XX
    .XX..XX..XX..XX.
    XX..XX..XX..XX..
    X..XX..XX..XX..X

    For 32x32 ... for the first row i can double each the bits like..
    ....XXXX....XXXX....XXXX....XXXX

    then next row i should do some thing like this..
    ...XXXX....XXXX....XXXX....XXXX.

    For the 3rd row I can double the bits 2nd row of 16x16.
    ..XXXX....XXXX....XXXX....XXXX..

    then for the next row should come some thing like this..
    .XXXX....XXXX....XXXX....XXXX...

    So, for getting odd rows of 32x32, i can double the each rows of 16x16. but how i can get the even rows... or how i can do anti-alias...!!

    Thanks & Regards,
    Sharath.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    3
    FYI,
    converted 32x32 for the above pattern.

    ....XXXX....XXXX....XXXX....XXXX
    ...XXXX....XXXX....XXXX....XXXX.
    ..XXXX....XXXX....XXXX....XXXX..
    .XXXX....XXXX....XXXX....XXXX...
    XXXX....XXXX....XXXX....XXXX....
    XXX....XXXX....XXXX....XXXX....X
    XX....XXXX....XXXX....XXXX....XX
    X....XXXX....XXXX....XXXX....XXX
    ....XXXX....XXXX....XXXX....XXXX
    ...XXXX....XXXX....XXXX....XXXX.
    ..XXXX....XXXX....XXXX....XXXX..
    .XXXX....XXXX....XXXX....XXXX...
    XXXX....XXXX....XXXX....XXXX....
    XXX....XXXX....XXXX....XXXX....X
    XX....XXXX....XXXX....XXXX....XX
    X....XXXX....XXXX....XXXX....XXX
    ....XXXX....XXXX....XXXX....XXXX
    ...XXXX....XXXX....XXXX....XXXX.
    ..XXXX....XXXX....XXXX....XXXX..
    .XXXX....XXXX....XXXX....XXXX...
    XXXX....XXXX....XXXX....XXXX....
    XXX....XXXX....XXXX....XXXX....X
    XX....XXXX....XXXX....XXXX....XX
    X....XXXX....XXXX....XXXX....XXX
    ....XXXX....XXXX....XXXX....XXXX
    ...XXXX....XXXX....XXXX....XXXX.
    ..XXXX....XXXX....XXXX....XXXX..
    .XXXX....XXXX....XXXX....XXXX...
    XXXX....XXXX....XXXX....XXXX....
    XXX....XXXX....XXXX....XXXX....X
    XX....XXXX....XXXX....XXXX....XX
    X....XXXX....XXXX....XXXX....XXX

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    print each char twice
    print each row twice

    Easy innit?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    http://en.wikipedia.org/wiki/Anti-aliasing
    http://www.vbforums.com/showthread.p...hreadid=285163

    I've never tried anti-aliasing myself, but one thought that came to mind was that you could fill a 32x32 array with the pixels that you know. Then you could fill in the rest by examining the pixels you know to decide whether the pixel should be filled or not.

    Note that you're probably not going to get a perfect conversion.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    It's not possible to get what you intend in all cases. The fact of the matter is that you only have a certain amount of information in the 16x16 image and you're asking for 4 times that amount of information in the final 32x32 image.

    I think what you want to do is to bilinear-filter it. This is the effect you see in modern 3D games when a textured surface is viewed up close (with no multi-texturing).
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Bitmap conversion
    By MadCow257 in forum C++ Programming
    Replies: 1
    Last Post: 09-16-2005, 10:45 PM
  4. Header File Question(s)
    By AQWst in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2004, 11:31 PM
  5. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM