[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mapping float values to colors.
From: |
Ken Cline |
Subject: |
Re: Mapping float values to colors. |
Date: |
Wed, 28 Jul 1999 09:48:02 -0400 (EDT) |
On Tue, 27 Jul 1999, Fabio Mascelloni wrote:
> The first problem is that only mappings from unsigned
> chars (Color typedef) to Red,Green,Blue values are
> permitted to build a Colormap, the second is that
> everytime a new matrix is added the mean values
> obviously change, so a new Colormap should be created to
> replace the old one , and assigned to the Raster.
I'm not sure what Marcus would say, but... have you
considered subclassing Colormap and adding a method like
`setMean:' which perhaps would take a 2D matrix as an
argument? The `setMean:' method would then be responsible
for looping thru the provided matrix and updating the
Colormap's `map'.
Colormap is easy to subclass but you should be aware that
the drawing functions (eg tkobjc/internal.m) use the `map'
array directly so it would not be enough to just override a
method like `pixelValue:'. I'd also suggest either
overriding `setColor:ToName:' so it doesn't check `colorIsSet:'
or adding a method like `getNameForRed:Green:Blue:' and use
that in conjunction with `tkobjc_setColor'. (The logic for
a `getNameForRed:Green:Blue:' method can be scooped right
out of `setColorToRed:Green:Blue:', btw.) Another
alternative that would allow you to reset color is to simply
override `colorIsSet' so it returns `NO'.
If you choose to subclass Colormap, you'll still need to
call Raster's `drawPointX:Y:Color:' and `drawSelf' elsewhere.
You don't gain alot by subclassing but it might make it
easier to debug. Just an idea.
Cheers.
Ken.
_________________________________________________________
Ken Cline address@hidden
SAIC VOICE (410) 571-0413
Annapolis, MD FAX (301) 261-8427
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Mapping float values to colors., Fabio Mascelloni, 1999/07/27
- Re: Mapping float values to colors., Fabio Mascelloni, 1999/07/27
- Re: Mapping float values to colors., Marcus G. Daniels, 1999/07/27
- *gdb* crashes when attempting to debug swarm app, Jason Alexander, 1999/07/27
- Re: *gdb* crashes when attempting to debug swarm app, Norberto Eiji Nawa, 1999/07/27
- Re: *gdb* crashes when attempting to debug swarm app, Marcus G. Daniels, 1999/07/27
- Re: *gdb* crashes when attempting to debug swarm app, Paul E. Johnson, 1999/07/28
- Re: Mapping float values to colors., Fabio Mascelloni, 1999/07/28
- Re: Mapping float values to colors., Marcus G. Daniels, 1999/07/28