473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"reading" a pixel on the monitor screen

Hello,

I am pretty new to programming and would like someone to help me get
started on the program that I need to make.

I hope it is not hard to do, but what I would like is a simple app that
has a label which returns the color of a pixel that is in position x,y on
the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of
course variable.

if someone could post the code that i should put in my program i would be
very grateful

Jul 22 '05 #1
4 8176

"grogerteal" <gr**@hotmail.com> wrote in message
news:8c******************************@localhost.ta lkaboutprogramming.com...
Hello,

I am pretty new to programming and would like someone to help me get
started on the program that I need to make.

I hope it is not hard to do, but what I would like is a simple app that
has a label which returns the color of a pixel that is in position x,y on
the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of
course variable.

if someone could post the code that i should put in my program i would be
very grateful


C++ has no facilities for reading pixels. You have to use your operating
system or a third party library to do that. So you should ask this question
again on a group dedicated to your particular operating system. For instance
if you are programming using Windows you could ask on
news:comp.os.ms-windows.programmer.win32. This group's welcome message will
give you more idea about what we discuss on this group,
http://www.slack.net/~shiva/welcome.txt.

john
Jul 22 '05 #2
grogerteal posted:
Hello,

I am pretty new to programming and would like someone to help me get
started on the program that I need to make.

I hope it is not hard to do, but what I would like is a simple app that
has a label which returns the color of a pixel that is in position x,y on
the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of
course variable.

if someone could post the code that i should put in my program i would be
very grateful

For Windows...
go to msdn.microsoft.com and search for "GetPixel" and/or "GetPixelV".
-JKop
Jul 22 '05 #3
"JKop" <NU**@NULL.NULL> wrote in message
news:oO*******************@news.indigo.ie...
grogerteal posted:
Hello,

I am pretty new to programming and would like someone to help me get
started on the program that I need to make.

I hope it is not hard to do, but what I would like is a simple app that has a label which returns the color of a pixel that is in position x,y on the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of course variable.

if someone could post the code that i should put in my program i would be very grateful

For Windows...
go to msdn.microsoft.com and search for "GetPixel" and/or "GetPixelV".


That answer seems somewhat helpful to the poster. This behaviour is
off-topic in this newsgroup.

--
Mabden
Jul 22 '05 #4
grogerteal wrote:
Hello,

I am pretty new to programming and would like someone to help me get
started on the program that I need to make.

I hope it is not hard to do, but what I would like is a simple app that
has a label which returns the color of a pixel that is in position x,y on
the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of
course variable.

Here are some issues as to why the C++ language does not include
support for graphics.

1. Definition of a pixel.
Yes, we know that a pixel is a picture element. But that seems to
be the best we can do.
Is the pixel color, black/white or grayscale?
How is the pixel represented?
One bit?
8 bits?
24 bits?
How many bits per color?
What is the order of the color?
What is the color space? (RGB? CMYK? HSB?)
What is the physical size of the pixel?
Is the pixel round or rectangular?

2. A Screen is commonly a collection of rows of pixels.
Are the rows interlaced in memory or contiguous?
How many pixels in the row are visible?
How many pixels per unit distance? (dots per inch?)

3. Accessing the pixels.
Are the pixels memory mapped or device (I/O) mapped?
If memory mapped, are they in the user's memory space?
If device mapped, how are they accessed?
Does a One turn on the pixel or turn it off?
Does the pixel have other attributes, such as intensity?, Blinking?
Can one read a pixel or is it a Write-Only Memory?

All of the above issues are different on each platform, including
those platforms that don't have screens (such as a dishwasher,
and a vending machine). Some platforms even have screens that
use vectors instead of pixels.

This is why many of the people in this newsgroup direct
questions about graphics to the platform specific newsgroups.

Read the FAQs and welcome.txt below.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: Greg G | last post by:
http://risky-biz.com/new/risky.html I finally got DSL service recently, but I haven't forgotten the agony of waiting for the 64th image to load before I can see ANYTHING on a page. So I will...
5
by: Rolf Brauser | last post by:
Hi, I want to have a table with a border of 1px arround it but table="1" is more than a pixel because this 3d effect is attached. Values below are not accepted How can I get this border with...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
1
by: grogerteal | last post by:
Hello, I am pretty new to programming and would like someone to help me get started on the program that I need to make. I hope it is not hard to do, but what I would like is a simple app that has...
4
by: Scott Johnson | last post by:
Hi I am converting some code from C# to VB.NET and I have come across a command that I can't find the VB equivalent. The C# command is 'lock' and I think it is used to lock a data type from...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
1
by: programmingChick | last post by:
I have a program where I want to accept an operand (from a file) and apply that operand to some integers. How should I do that? Is the best way to convert it to its ascii character then figure out...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
4
by: Shelly | last post by:
I am coding a psudo-cron job into an application that I am writing. I don't have access to write a real cron job. Here is what I did: 1 - I downloaded pseudocron.php from its website...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.