Hi, I'd like to create a program that can do things on condition that certain point on the screen is of a certain color. Do you think it's possible? If so, what is the best way of doing it?
3 4559 JosAH 11,448
Recognized Expert MVP
Hi, I'd like to create a program that can do things on condition that certain point on the screen is of a certain color. Do you think it's possible? If so, what is the best way of doing it?
Read all about it in the Robot.getPixelColor() method Java docs.
kind regards,
Jos
robot.getPixelColor() seems OK to get RGB of just one pixel, but when I try to scan the whole screen it gets extremely slow. I know there is such thing as GetPixel(hdc, x, y) in C++ which is WAY faster than java's robot.getPixelColor().
I've tryed to capture the screen into buffered image and scan that with a faster method image.getRGB() But it's still way slower than I would expect and much slower than C++'s GetPixel(hdc, x, y). Is there a faster way of doing this in Java?
JosAH 11,448
Recognized Expert MVP
robot.getPixelColor() seems OK to get RGB of just one pixel, but when I try to scan the whole screen it gets extremely slow. I know there is such thing as GetPixel(hdc, x, y) in C++ which is WAY faster than java's robot.getPixelColor().
I've tryed to capture the screen into buffered image and scan that with a faster method image.getRGB() But it's still way slower than I would expect and much slower than C++'s GetPixel(hdc, x, y). Is there a faster way of doing this in Java?
Did you try to get the Raster using the BufferedImage.getData() method?
A Raster can give you a simple int array filled with pixel values.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Randy Webb |
last post by:
Running Apache2 and PHP 4.3.3 on Windows, is there any way that I can
have PHP read an image file and out put its color content?
Preferably, I would like for it to read a .bmp file and output a...
|
by: spleen |
last post by:
Hiya,
Im working on a project to read in a file (its a bitmap, but thats
irrelevant) and I want to read in all the data after an offset, ive
tried using -
fread(bitmap_buffer, offset, 1, fp);...
|
by: TomHL |
last post by:
hello,
- I have a Bitmap Object named: bmp1
- I already have the numerical values of:red,blue and green colors + I have
the X and Y cordinates.
How do I set the pixel value via safe code on...
|
by: Stacey |
last post by:
I've been trying for the last couple of days to read some pixel values
from a window of an independent application, but, even though I got
close, I just can't figure the last part out.
I am able...
|
by: Martijn Mulder |
last post by:
I try to define a line with the length of 1 unit (1 pixel) that is, in fact,
just a point on the screen. But when I draw it with a wide pen with the
appropriate StartCap and EndCap (Round), it will...
| |
by: Hooyoo |
last post by:
I want to get the color of the specified pixel in the screen.
Firstly I get the position of the cursor:
//Get the position of cursor.
Point position = Cursor.Position;
Next I want to get the...
|
by: =?Utf-8?B?S2Vsdmlu?= |
last post by:
Hi all,
I am writing an application to detect the dead pixel of LCD panel by using
visual C++ (MFC). My flow is follow:
1. Display a dialog with a start button. When the user press the start...
|
by: cjstuttle |
last post by:
Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about...
|
by: ofiras |
last post by:
Hi,
I made a "Paint" program, but I couldn't find a method to paint 1
pixel using graphic state ("Graphics g =
Graphics.FromHwnd(this.Handle);")
How can I paint 1 pixel?
I guess I can make a...
|
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,...
|
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...
| |
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |