reading a bmp

This is a discussion on reading a bmp within the C Programming forums, part of the General Programming Boards category; Hi all, I want to do the following - any help would be appreciated. I've got a 8*8 grid with ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    1

    reading a bmp

    Hi all,

    I want to do the following - any help would be appreciated.

    I've got a 8*8 grid with different coloured tokens 8 possible (it's a game) now given the current state of the game i want to be able to solve it with the least moves possible - this part i've done...

    however i want to be able to take a screenshot of the game in progress and save the gameboard as a bmp file.

    Now here's where i need help - using c - i need to read the file and convert the 240*240 pixel game board to an 8*8 array so the rest of my program can do its work.

    -1st read the bmp - no idea whats involved,
    -2nd read the color info at 64 distinct and evenly space co-ordinates both horizontally/vertically
    (sure i could do this if i knew how to read the bmp)
    -3rd compare the value to an array of preset color values in order to assign a name to the piece at each location of the 8*8 array
    (again pretty sure i could manage this)

    Any help or references to code/tutorials would be great

    Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    File formats
    http://www.wotsit.org/
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 06:27 AM
  2. Replies: 2
    Last Post: 01-28-2008, 02:07 AM
  3. Problem reading BMP
    By Mortissus in forum C Programming
    Replies: 4
    Last Post: 02-02-2006, 05:32 AM
  4. reading BMP files and pixels' colours
    By Xavier in forum C++ Programming
    Replies: 3
    Last Post: 12-16-2005, 04:19 AM
  5. adding encryption to bmp
    By GiraffeMan in forum C Programming
    Replies: 10
    Last Post: 04-16-2002, 01:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21