Java Mailing List Archive

http://www.junlu.com/

Subjects
Home
mod jk2 https
Donation of JAXP 1 3 Sources to Apache
R annoyances
RE: Finding out when the aspnet admin worker process has recycled
Favorite Linux Distribution
eigenvalues of a circulant matrix
Apache Install
Reachin apache from outside
Ant should have an ext directory
Warning: Documentroot doesn 't exist
Can this be Done?
RE: Multilanguage Application
RE: Simple Question On setting up Sub Domain site
Lack of independence in anova()
How to close connection instead of sending 403?
winning the case for ANT
Re: adding php
New Ant GUI 'Ant 's Nest '
Narrowing Down A Strange Problem
Ant Task: sshexec
R Graph Gallery : categorization of the graphs
I 've been hacked, I need some help please
RE: Anyone working with DotNetNuke?
RE: Exception Handling Opinion
hex format
RE: IIS stopped working :(
<for > Build Failed:problem
RE: Separation of Objects from Logic
RE: Tracking pages with long request execution time
sending email to multiple destination
Web Site
ant UI
Easy cut & paste from Excel to R?
Win32 Apache Restart
Improving Tasks
HELP! PLEASE!
RE: Adding Controls to a Page
read table
RE: ASPNET account doesn 't exist!
Best way to uninstall Apache2 on red hat
from win to linux how to web page
XMLParseException changes and creation of XMLLocator2
Re Post: rewrite backslash to forward slash
Target or macrodef?
Page display problem XPSP2
Authentication problems
Dynamic Dictionary Data Type?
Newbie unable access my www from outside
off topic question: Latex and R in industries
Conflict between xtable and Hmisc when using Sweave?
Very old problem without any new solution
mod rewrite help
Basic Authentication question
RE: Code Security
calling ant from java program
prevent double signing
Re: Controlling Copy/Paste/Print
Using R to illustrate the Central Limit Theorem
web server slow too much slow
access to user directories
Links
Home
Official R Project Site
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
hex format

hex format

2005-04-07       - By David Forrest
Reply:     <<     11     12     13     14     15     16     17     18     19     20     >>  

On Thu, 7 Apr 2005, Earl F. Glynn wrote:

...
> picture, don't you "see" numbers?
>
> Maybe you don't see a number here, but I do. #ff0080 is interpreted in some
> (non-R) contexts as a single number.  In many contexts, including HTML,


> colors are represented as three bytes in hex with this notation and the "#"
> means "hexadecimal".  The RGB color componets can be discerned quite easily:
> hex FF is decimal 255 (red), hex 00 is decimal 0 (green), hex 80 is decimal
> 128 (blue).  Some programs, e.g., Dreamweaver, allow specification of colors
> in this hex 3-byte form directly.  The "16 million" colors you seen on a
> "true color" display are from the 256*256*256 (or in hex FF*FF*FF) possible
> RGB triples.
>
> > For example, R already provides both hsv() and rgb() to create colours
> > from vectors of three numbers, but the correspondence is different in each
> > case.
>
> Sorry if some consider this off topic:
> HSV as a color space is really only liked by computer scientists.  Image
> processing and color engineers rarely if ever use HSV.
>
> There are MANY other color spaces and computations possible (see "color
> spaces" or "color conversions" or other color topics on  this page
> http://www.efg2.com/Lab/Library/Color/Science.htm).  Most of these color
> manipulations in R are not easy because the very first step, converting
> colors, I mean numbers <g>, like #ff0080 to the red, green components is
> hindered because one must reinvent the wheel of hex-to-decimal conversion.

I think R has the hex to decimal OK, but might be lacking in the decimal
to hex case

zz<-function(x){
   x<-as.numeric(sub("#",'0x',x));
   c(x%/%256^2,
     x%/%256%%256,
     x%%256) }

> zz('#0f0e0d')
[1] 15 14 13
> zz('#ff0080')
[1] 255   0 128

If you already have the 3 byte triplet in read in as a binary, the same
integer arithmetic does the extraction.

> Perhaps R will someday introduce a "pixel" type that would encapsulate the
> three color components (for color images at least).  A matrix of pixels
> could easily be made into an image.  Some color computations such a Maxwell
> Triangle, or a CIE Chromaticity Chart (sorry the links are currently broken,
> but the image can be seen on this Chinese translation page)
> http://bluemoon.myrice.com/efg/color/chromaticity.htm in R is more difficult
> than it should be because of how R is designed now.  Many image processing
> statistical problems could be tackled directly in R if there were an easier
> way to manipulate pixels and images.
>
> But the hex manipulations I'm advocating could be used for variety of other
> purposes.  E.g, I must periodically deal with a binary data stream of flow
> cytometery data -- part ASCII, part binary.  Reading this stream directly
> from R would be nice and is almost doable.  Working with raw data and
> understanding  exactly what you've got would be facilitated by better
> conversion capabilities within R.

I'm still not sure what you mean by hex manipulations.

R has string manipulations, hex-to-number manipulations,
binary-file-to-number manipulations, mixed file to number manipulations,
and number to number manipulations.

What I think you are asking for is /displaying/ numbers.

Since R's sprintf() doesn't support the %x, (or %o, or %u) formats, I'm
not sure how to use R to translate the number 257 into #000101

zzinv<-function(x){????}
# such that:

> zzinv(257) #or zzinv(c(0,1,1))
"#000101"

Is zzinv() the operation you need?

Dave
--
Dr. David Forrest
drf@(protected)                                    (804)684-7900w
drf5n@(protected)                             (804)642-0662h
                                  http://maplepark.com/~drf5n/

______________________________________________
R-help@(protected) mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

©2008 junlu.com - Jax Systems, LLC, U.S.A.