473,396 Members | 2,009 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,396 software developers and data experts.

coloring a pixel


some one can give me a portable source codes that color a pixel?
(env *nix)

--
unknown
Nov 14 '05 #1
10 3076
"unknown" writes:
some one can give me a portable source codes that color a pixel?
(env *nix)


The consensus meaning of "portable" means the code should compile and run on
any platform that has a standards compliant C compiler. So your question is
faulty from the get go. Try posting your question to a germane newsgroup --
people here are very reluctant to answer off-topic questions.
Nov 14 '05 #2
osmium wrote:
"unknown" writes:
some one can give me a portable source codes that color a pixel?
(env *nix)


The consensus meaning of "portable" means the code should compile and run
on any platform that has a standards compliant C compiler. So your
question is
faulty from the get go. Try posting your question to a germane newsgroup
-- people here are very reluctant to answer off-topic questions.


sorry..

... ..

--
unknown
Nov 14 '05 #3
unknown wrote:
some one can give me a portable source codes that color a pixel?
(env *nix)


No such thing. It depends very much on your environment, even on *nix.
Using xlib? Using SVGALib? Using OpenGL?

Jon
----
Learn to program using Linux assembly language
http://www.cafeshops.com/bartlettpublish.8640017
Nov 14 '05 #4
Jonathan Bartlett wrote:
unknown wrote:
some one can give me a portable source codes that color a pixel?
(env *nix)

No such thing. It depends very much on your environment, even on *nix.
Using xlib? Using SVGALib? Using OpenGL?


using OpenGL how can i do it?
where i can found some docs about handling graphics under *nix platforms?

thanks for your support
Jon
----
Learn to program using Linux assembly language
http://www.cafeshops.com/bartlettpublish.8640017


--
unknown
Nov 14 '05 #5
unknown wrote:
some one can give me a portable source codes that color a pixel?
(env *nix)


Well, I haven't ranted on this topic in a while so
here goes:

There is no standard for a pixel, other than the vague
definition that it is a picture element. A pixel could
be a vertical line, a dot (circle) or a vector, perhaps
even something more complex. Thus, it is not portable
already.

Not all platforms have displays. Those platforms that
have displays, may not have pixels or have access to
those pixels. Thus pixels are not portable.

For Raster display systems, pixels are usually either
dots or vertical lines (check your monitor). Here
are some varying attributes for a pixel:
dimensions (width and height, maybe depth)
black & white vs. color
discreet values vs. blends
intensity
The fact is that there is no standard for the above
attributes. Some platforms may add more attributes
to a pixel, such as blinking. Thus more reasons why
pixels are not portable.

Let us assume that a pixel can be colored. Now the
questions are:
1. How many colors?
2. Standard colors, such as cobalt blue and purple?
How does one turn a pixel "olive green" on a Windows
platform and have it the same value on a Unix machine?

Finally, let us think about the issues about additive
colors versus subtractive colors. Colors on a CRT
{Cathode Ray Tube} may not be the same as on an ink
jet printer.

The best answer for how to do graphics is to consult
the documents for your platform.

--
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
http://www.sgi.com/tech/stl -- Standard Template Library

Nov 14 '05 #6
unknown wrote:
some one can give me a portable source codes that color a pixel?
(env *nix)


No, it's not possible to color pixels in portable code.

--
"We learned more from a three minute record, baby
than we ever learned in school"
- Bruce Springsteen
Nov 14 '05 #7
Thomas Matthews <Th*************************@sbcglobal.net> writes:
[...]
There is no standard for a pixel, other than the vague
definition that it is a picture element. A pixel could
be a vertical line, a dot (circle) or a vector, perhaps
even something more complex. Thus, it is not portable
already.


<OT>
I've never heard the term "pixel" used to refer to anything other than
a single dot on a display. FOLDOC defines it as "The smallest
resolvable rectangular area of an image, either on a screen or stored
in memory." (I suppose a vector-based display wouldn't have pixels as
such.)
</OT>

If you had a portable definition of some image format (say, TIFF
images), it would make sense to ask how, given that format, you can
set the color for a given pixel. But I don't think that's what the OP
was asking for -- and given the image format definition, it should be
obvious how to set a pixel.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #8
I can't say no to an aspiring graphics guy, even it's off topic.

Go to www.opengl.org and look up the opengl reference manual there (i.e.
the "red book"). Its free to download and gaze at and it should help you
get started.

You'll probably want to look at GLUT, which is a very simple way of
making a window (and a "context") that OpenGL can use.

As for the OpenGL things you'll want to examine, there are 3 ways I can
think of "drawing a pixel" in opengl off the top of my head. You can
write straight to the framebuffer with glWritePixels(), you can draw
points with glBegin(GL_POINTS), or you can write the pixels to a texture
and display that. I've done all of these things and for your purpose, I
would probably just use glWritePixels(). It can be a little tricky to
work out the format stuff, but it's the fastest and simplest thing to do
if you don't need to use other opengl features at the same time.

As for the portability, I know that OpenGL is available for windows,
linux, and OS X. GLUT is pretty ancient and poorly maintained, but it
still works and I've gotten it to run on Windows and Linux. Good luck.

Jason
Nov 14 '05 #9
Bertel Brander wrote:
unknown wrote:
some one can give me a portable source codes that color a pixel?
(env *nix)


No, it's not possible to color pixels in portable code.


Aren't pixels those little things with wings that hide under four
leafed clovers? They certainly aren't defined in the C standard.
I always thought they were green by definition. Maybe unknown
wants them to blush about his off-topic posting.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #10
using OpenGL how can i do it?
where i can found some docs about handling graphics under *nix platforms?


Assuming you have your OpenGL context set up, you can just do

glBegin(GL_POINTS);
glVertex2d(PointX,PointY);
glEnd();

This code is a good example of how to initialize an OpenGL Window:

http://www.cs.arizona.edu/classes/cs...ode/triangle.c

Be sure to compile with at least "-lGL -lGLU -lGLUT" (you may need
others, too).

You may have to install the GLUT libraries and development environments
as not all Linux distributions come with them, even if they come w/
OpenGL (GLUT makes dealing with the windowing environment consistent and
cross-platform, which you can also do w/ SDL if you wanted to).

Jon
----
Learn to program using Linux assembly language
http://www.cafeshops.com/bartlettpublish.8640017
Nov 14 '05 #11

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

Similar topics

7
by: Ruthless | last post by:
hello. I've got a simple question. I've searched on google for PHP scripts coloring syntax e.g. asm, c, c++, bash etc. I've only found some CGI, apps, modules for Apache - but i can't use...
1
by: Afanasiy | last post by:
What's the best method for coloring simple markup? <xyz att="val" att="val"> You can assume it is not HTML or XML or valid anything except markup which happens to look somewhat like them. ...
0
by: Markk | last post by:
Hi. I would like to ask If somebody don't have any small sample to coloring XML syntax, e.g. in RichTextBox. It can be in VB.NET or C#. I watched on SharpDevelop, but I could not understand...
2
by: Dan | last post by:
I'd like to show some XML text into an (editable) text box with some syntax coloring for tags, attributes etc. I don't need a full-blown commercial control, I'd just like to do some coloring on...
5
by: Wilfried Mestdagh | last post by:
Hello, I wants to set the background color of rows in a datagridView based on the value of a particular cell. Someone knows how to do this ? -- rgds, Wilfried http://www.mestdagh.biz
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
7
by: braver | last post by:
Greetings -- as a long time user of both Python and Ruby interpreters, I got used to the latter's syntax-coloring gem, wirble, which colorizes Ruby syntax on the fly. Is there anything similar for...
1
by: ofiras | last post by:
In bitmap, how can I find the nearest pixel (pixel 1) to a specific pixel (pixel 2) that has different color from pixel 2? Or how can I find a pixel in a specific distance from pixel 2 (like a...
3
by: sandromani | last post by:
Hi all, I am writing a webbased notepad and want to include syntax-coloring. The approach I have used is to set the font color and background color of the textarea to transparent, and place the...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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 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.