LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-27-2010, 09:47 AM   #1
ahc_fan
Member
 
Registered: Jan 2009
Location: Seattle, WA
Distribution: Slackware64 14.2
Posts: 259

Rep: Reputation: 11
Trying to understand how to use colors with Xlib


Hello! As the topic says, i'm trying to understand how to use colors in Xlib programming. What I think I understand so far is that modern displays use 24 or 32-bit TrueColor. And TrueColor uses three colormaps, one for each primary color, and a single pixel value is composed of three indices.

Now the part i'm confused about is how to get my programs to use a 32-bit TrueColor visual. I thought I could inheret the visual from the root window to get color but it seems no matter what pixel value I use it's either black or white.

I guess my question is, how can I setup my programs so that I can specify a pixel value that is a combination of RGB values to get the color I want?

I come from windows where I simply used RGB(r,g,b) macro to specify colors and never had to worry about depth and colormaps and visuals, so I'm a bit overwhelmed by all of these concepts. So if anyone can clear some of this up for me I would greatly appreciate it!!
 
Old 04-28-2010, 07:42 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Can you post a sample code showing how you are stuck to b&w ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified eyalkz Linux - Newbie 12 11-27-2018 01:30 PM
How to understand dstat number prefixes and colors? Dr. ROX Linux - Software 1 05-28-2009 08:01 PM
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified rajnivanza Linux - Software 1 03-13-2008 01:16 PM
Foolish Xlib colors and shell-launching Timer Programming 1 07-24-2004 03:43 PM
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified eyalkz Programming 1 03-02-2004 08:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration