Thread: Plotting Pixels

  1. #1
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94

    Question Plotting Pixels

    Hello,

    I've written a math code that does some pretty things, and outputs its data in a text file. Id like to now write a visualizer. Thus, I would simply read through my file, and have an array, normalized to say 0-1023. Is there a way that I can take this 2D array, lets say 400 by 400 elements, and plot a 400 by 400 pixel window on the screen, with the values 0 being black and the highest being the brightest of some color?

    Ie, is there a library (or maybe something built in I don't know about) for plotting pixels on the screen and selecting their colors?

    I would really like this to run on both linux and windows if possible.

    Thanks a lot,

    -Jack Carrozzo
    http://www.crepinc.com/

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    STL, Allegro . . . and you can use int86() which only works on Windows/DOS.

  3. #3
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    For windows there is SetPixel (hdc, x, y, crColour);

    It's not too fast but is probably o.k. for your application.

  4. #4
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    Jez, I don't have to define a window or anything?

    -Jack Carrozzo
    http://www.crepinc.com/

  5. #5
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    Nevermind I found it, Thanks
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  6. #6
    Geek. Cobras2's Avatar
    Join Date
    Mar 2002
    Location
    near Westlock, and hour north of Edmonton, Alberta, Canada
    Posts
    113
    Quote Originally Posted by dwks
    STL, Allegro . . . and you can use int86() which only works on Windows/DOS.
    do you mean SDL ?
    http://www.libsdl.org/index.php
    James G. Flewelling
    Rgistered Linux User #327359
    Athabasca University Student (BSc. CIS)

    http://catb.org/~esr/faqs/smart-questions.html
    http://catb.org/jargon/

    http://www.ebb.org/ungeek
    ---GEEK CODE---
    Version: 3.12
    GCS/IT/M d- s+:++ a-->->>+>++>+++>? C++++>$ UL++>++++$ P++>++++ L++>++++$
    E W++ N o? K? w++(--)>--- O? M? V? PS--(---) PE Y+ PGP? t 5? !X R(*)>++
    tv-->! b++(+++)>++++ DI? D+++(---)>++++$ G e*>++$ h++>*$ r!>+++ y?
    ----/GEEK CODE----
    upd: 2005-02-11

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bitmap pixels???????????
    By SuperNewbie in forum Windows Programming
    Replies: 2
    Last Post: 03-23-2004, 01:53 AM
  2. creating image from pixels stored in file
    By Kristian25 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 02:08 PM
  3. Algo needed for 'Fit to page'
    By Unregged in forum Windows Programming
    Replies: 6
    Last Post: 10-03-2002, 07:09 AM
  4. Plotting pixels
    By bluehead in forum C++ Programming
    Replies: 1
    Last Post: 01-10-2002, 09:35 PM
  5. What Else can I do besides Plot Pixels?
    By Xterria in forum C++ Programming
    Replies: 13
    Last Post: 10-02-2001, 07:11 PM