Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: .:] Druid [:. on February 04, 2007

Title: Help Wanted: What is the color of the pixel?
Post by: .:] Druid [:. on February 04, 2007
Hello,

I'm wondering if there is any way (i'm sure..) to know what's the color of the pixel i'm about to write on....
to make it clear, i'm willing to print on screen only if the background is rgb(0,0,0) as an exemple?

Any idea is welcome :)

Thanks in advance!
Title: Re: Help Wanted: What is the color of the pixel?
Post by: zawran on February 04, 2007
You might want to tell which method of rendering to the screen you are using as methods of getting the RGB of a pixel might very depending on the render surface. Depending on what library you are taking advantage of there might be a command like readpixel or getRGB, or there might not be any commands and you will have to write something up yourself, like when using an arraybuffer or a piece of memory to store the screen in.
Title: Re: Help Wanted: What is the color of the pixel?
Post by: Shockwave on February 04, 2007
Druid is using tinyptc in most of his stuff Zawran.

If you want to make sure that the pixel is black then you could just say;

if buffer ( location ) = &H000000 then buffer ( location ) = new colour

where location = (XPOS +(YPOS * XRES))
Title: Re: Help Wanted: What is the color of the pixel?
Post by: .:] Druid [:. on February 04, 2007
wow, thanks for your fast replies :) 

Yes, indeed as said, i use tinyptc (are there other method? :))..and your'e right shock, I remember reading this!  Thanks guys :)
Title: Re: Help Wanted: What is the color of the pixel?
Post by: Clyde on February 05, 2007
There are many other methods dude, to name two there's GFX Lib and you can also use SDL. In the example folder of FreeBASIC there's source on showing what FB can do and how to use various libraries and dll's.

You will also have to download the main .dlls and put them into your system or system32 folder for them to run properlly. Here's a link to see what you can do and use: List Of External Libraries (http://www.freebasic.net/index.php/viewall?page=link&category=lib)
Title: Re: Help Wanted: What is the color of the pixel?
Post by: Shockwave on February 05, 2007
Stick with PTC though mate. Rbraz and Jim made such a good job on the new one :)
Title: Re: Help Wanted: What is the color of the pixel?
Post by: .:] Druid [:. on February 05, 2007
it works like a charm!  thanks to all of you :)
Title: Re: Help Wanted: What is the color of the pixel?
Post by: Shockwave on February 05, 2007
Cool :) Thanks for checking back.
Title: Re: Help Wanted: What is the color of the pixel?
Post by: Jim on February 05, 2007
Quote
put them into your system or system32 folder
That's not the best place to put them.  Put the DLLs in the same folder as your exe.  If there are then two dlls with different incompatible versions or two dlls with the same name from different places, they won't conflict with each other.  Takes up a bit more space with multiple copies, but really, the Windows folder is for Windows files.  In fact, unless you switch to Administrator, Vista won't let you copy files in there anyway. :D

Jim