Sponsored Content
Top Forums Programming Xlib - Mapping Pixel Values to RGB Colors Post 302177636 by p50p100 on Friday 21st of March 2008 11:55:49 PM
Old 03-22-2008
Quote:
Originally Posted by thebin
Hi everyone...
I'm working with XLib and I want to find out the pixel value of a particular point on screen and then map it to RGB values. I used XGetImage and XGetPixel to get the pixel value, but how do I get the RGB values of the pixel?
I went through a few XLib manuals, there seems to be no way. Any solution?
I'm thinking of that,too.

I found XQueryColor function. below article is good!
Screen grab with X11

I succeed by XQueryColor.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lowdown on Pixel Script-PHP based

Hi ! Can someone give me the lowdown on the various pixel scripts that are out there...what's the best, what's the cheapest, which will work well on php/mysql systems, etc... I'm currently looking at GPix (http://www.tufat.com/millionpixelscript.php), and similar offerings from ... (0 Replies)
Discussion started by: tufat123
0 Replies

2. UNIX for Advanced & Expert Users

How to create & use a personal rgb.txt

Greetings -- I'm curious as to an effective way for a user (not root) to set-up a supplemental rgb.txt file for personal use on an X11 system. It's easy to set up the rgb.txt file (with only new colors) in my directory, but how can I use it in addition to the standard rgb.txt file. Thanks.... (0 Replies)
Discussion started by: slapshot_paulie
0 Replies

3. Shell Programming and Scripting

[BASH] mapping of values from file line into variables

Hello, I've been struggling with this for some time but can't find a way to do it and I haven't found any other similar thread. I'd like to get the 'fields' in a line from a file into variables in just one command. The file contains data with the next structure:... (4 Replies)
Discussion started by: semaler
4 Replies

4. Shell Programming and Scripting

mapping of values in shell scripting

sample content of file1: SSTY1 2145228348 652011011715140100000002419005432092074 008801726143662 VDZX01 MIO2 008801726143662 SSRTY 2145228349 ... (3 Replies)
Discussion started by: vsachan
3 Replies

5. Programming

Help with mapping two tables and filling the null values

Hi All , I have two tables. I will provide sample data in the tables below. table1: dept_id dept_name rep_id admin_lastname 10 dept of int.medicine Paul 10 dept of int.medicine Frank 20 dept of chemistry Young 20 dept of chemistry Bill 30 school of denistry kaufmann 40... (3 Replies)
Discussion started by: megha2525
3 Replies

6. Shell Programming and Scripting

Creating unique mapping from multiple mapping

Hello, I do not know if this is the right title to use. I have a large dictionary database which has the following structure: where a b c d e are in English and p q r s t are in a target language., the two separated by the delimiter =. What I am looking for is a perl script which will take... (5 Replies)
Discussion started by: gimley
5 Replies

7. Shell Programming and Scripting

awk (or) UNIX random RGB colors generator?

Dear UNIX Friends, I was wondering if there is a random RGB color generator or any function in any unix platforms. Please share your ideas. Thanks (2 Replies)
Discussion started by: jacobs.smith
2 Replies

8. Shell Programming and Scripting

Mapping the values of ids of two columns of file1 from file2

I have of two space separated files: ==> File1 <== PT|np_496075.1 st|K92748.1 st|K89648.1 PT|np_001300561.1 PT|np_497284.1 st|K90752.1 st|K90279.1 PT|np_740775.1 PT|np_497749.1 st|K90752.1 st|K92038.1 PT|np_490856.1 PT|np_497284.1 st|K90752.1 st|K88095.1 PT|np_494764.1 ==> File 2 <==... (2 Replies)
Discussion started by: sammy777888
2 Replies
XcmsStoreColor(3X11)													      XcmsStoreColor(3X11)

NAME
XcmsStoreColor, XcmsStoreColors - set colors SYNOPSIS
Status XcmsStoreColor(display, colormap, color) Display *display; Colormap colormap; XcmsColor *color; Status XcmsStoreColors(display, colormap, colors, ncolors, compression_flags_return) Display *display; Colormap colormap; XcmsColor colors[]; int ncolors; Bool compression_flags_return[]; ARGUMENTS
Specifies the connection to the X server. Specifies the color cell and the color to store. Values specified in this XcmsColor structure remain unchanged upon return. Specifies the color specification array of XcmsColor structures, each specifying a color cell and the color to store in that cell. Values specified in the array remain unchanged on return. Specifies the colormap. Returns an array of Boolean val- ues indicating compression status. If a non-NULL pointer is supplied, each element of the array is set to True if the corresponding color was compressed and False otherwise. Pass NULL if the compression status is not useful. Specifies the number of XcmsColor structures in the color-specification array. DESCRIPTION
The XcmsStoreColor function converts the color specified in the XcmsColor structure into RGB values. It then uses this RGB specification in an XColor structure, whose three flags (DoRed, DoGreen, and DoBlue) are set, in a call to XStoreColor to change the color cell specified by the pixel member of the XcmsColor structure. This pixel value must be a valid index for the specified colormap, and the color cell speci- fied by the pixel value must be a read/write cell. If the pixel value is not a valid index, a BadValue error results. If the color cell is unallocated or is allocated read-only, a BadAccess error results. If the colormap is an installed map for its screen, the changes are visi- ble immediately. Note that XStoreColor has no return value; therefore, an XcmsSuccess return value from this function indicates that the conversion to RGB succeeded and the call to XStoreColor was made. To obtain the actual color stored, use XcmsQueryColor. Because of the screen's hardware limitations or gamut compression, the color stored in the colormap may not be identical to the color specified. XcmsStoreColor can generate BadAccess, BadColor, and BadValue errors. The XcmsStoreColors function converts the colors specified in the array of XcmsColor structures into RGB values and then uses these RGB specifications in XColor structures, whose three flags (DoRed, DoGreen, and DoBlue) are set, in a call to XStoreColors to change the color cells specified by the pixel member of the corresponding XcmsColor structure. Each pixel value must be a valid index for the specified col- ormap, and the color cell specified by each pixel value must be a read/write cell. If a pixel value is not a valid index, a BadValue error results. If a color cell is unallocated or is allocated read-only, a BadAccess error results. If more than one pixel is in error, the one that gets reported is arbitrary. If the colormap is an installed map for its screen, the changes are visible immediately. Note that XStoreColors has no return value; therefore, an XcmsSuccess return value from this function indicates that conversions to RGB succeeded and the call to XStoreColors was made. To obtain the actual colors stored, use XcmsQueryColors.Because of the screen's hardware limitations or gamut compression, the colors stored in the colormap may not be identical to the colors specified. XcmsStoreColors can generate BadAccess, BadColor, and BadValue errors. DIAGNOSTICS
A client attempted to free a color map entry that it did not already allocate. A client attempted to store into a read-only color map entry. A value for a Colormap argument does not name a defined Colormap. Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error. SEE ALSO
XcmsAllocColor(3X11), XcmsQueryColor(3X11) Xlib -- C Language X Interface XcmsStoreColor(3X11)
All times are GMT -4. The time now is 04:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy