473,663 Members | 2,876 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

coloring a pixel


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

--
unknown
Nov 14 '05 #1
10 3098
"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.l earn.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************ *************@s bcglobal.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_Keit h) 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_POIN TS), 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.c om, 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

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

Similar topics

7
2851
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 them on my server (due to my restricted permissions - i can use only PHP and MySQL).
1
1360
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. You can assume xyz < > = and " always exist for each tag. What methods are usually employed?
0
1211
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 that code, which is coloring text. Thanks.
2
1578
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 tags and the like. Is there any (possibly free!) C-Sharp control (based onto the RTF control, I imagine) or code sample for building a such control, or should I create my own from scratch? Thanks guys!
5
2026
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
9057
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 450-1000 milliseconds I want speeds less than 10 milliseconds
7
2504
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 Python?
1
3239
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 circle that pixel 2 is his center, and I'm looking for a pixel that has different color that pixel 2)? (I'm trying to do a voronoi diagram maker, so I need to search for the nearest colored pixel in my bitmap for every pixel that is not colored...
3
2833
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 colored text in a pre behind the text area, so far so good. The code I use for coloring is the following one: function colorize(){ var inTag=false, inAttr=false; text=textarea.text();...
0
8436
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8634
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5657
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.