XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Creating an array from a bitmap

Last post 2/20/2008 9:23 PM by Shawn Hargreaves. 3 replies.
  • 2/20/2008 3:25 PM

    Creating an array from a bitmap

    Are there any examples of creating an array from a bit map that anyone has seen on the web?

    heres a rough example of whgat I want to do

    imagine I am creating spaceinvaders, I have a sheet of enemies 6 wide by 5 high. I create a 1bit bitmap 6X5 (of just black and white data)

    I then want to read those pixels in to my array so I can set my invaders to be either type 1 or type 2 enemies.

    I guess its some GetRow thing, but I cant actually work out how the hell that command actually works! I cant find an example anywhere :(

    Also while we are on the subject, Does the depth of my bitmap determine whether I get a bool, int, vector 2, 3 or 4 returned? or do I somehow specify what I am looking for. i.e I want an array of vector2's made up of the Red and Blue values of my bitmap....and what about CMYK ---- aaargh! its all too crazy!

    I really do try and figure these things out on my own, Honest!


  • 2/20/2008 5:12 PM In reply to

    Re: Creating an array from a bitmap

  • 2/20/2008 5:29 PM In reply to

    Re: Creating an array from a bitmap

    thanks shawn...I feel special having a superstar like you help me out! I had seen that, I just wasnt sure it helped me create the array....or do I create the array and then populate it with the data...see I know nothing!

    although very little can crush my good mood this evening!
  • 2/20/2008 9:23 PM In reply to

    Re: Creating an array from a bitmap

    You allocate the array yourself, then you call Texture.GetData to store the pixel values into it.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (4 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG