Thread: reading a bmp

  1. #1
    Registered User
    Join Date
    Jun 2004

    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


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    File formats
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

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