comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Saving Color Tables
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Saving Color Tables [message #41044 is a reply to message #40863] Wed, 15 September 2004 13:57 Go to previous message
kklare is currently offline  kklare
Messages: 7
Registered: April 2004
Junior Member
In 1995 and 1996 I added a number of tables ~62. Some are stolen from
defunct Macintosh Spygrlass Transform (an uncredited rip off of public
domain NCSA Image), the NIH Image program with correction for 13
converted into 10 or vv, and the old MAC-OS colors. One is 10 cycles
of colors with different shading and is good for contours. The routine
to read these was last changed 2/2000 and given below and is not
checked to be current. Replace JINIT and EXTR_FILE_NAME by your own
path parser. BTW for true color, I did a 26 cycles of colors but have
never used it.

;+
;NAME: CT_READ
;PURPOSE: read Macintosh color tables for use in IDL
; reads 970 byte Spyglass/NIH Image
; and 2056 byte ResEdit resource saved using HexEdit
;CATEGORY: Colors
;CALL:
;INPUT:
; file name of file to read, default is a Pickfile
;OUTPUTS:
; R, G, B 256-byte lists of color components
;SIDE EFFECTS:
; opens file on unit 1
; overwrites current window
; changes color table
; may modify system colors
;HISTORY:
; KAK 960913 New
;-
PRO CT_READ, file, r, g, b

IF NOT KEYWORD_SET(path) THEN path = XPICKFILE(/READ, /MUST_EXIST)
IF NOT KEYWORD_SET(path) THEN RETURN
JINIT
file = EXTR_FILE_NAME(path)
PRINT, 'For color table name "'+file+'"'
ON_IOERROR, err
CLOSE, 1
OPENR, 1, path
stat = FSTAT(1)
CASE stat.size OF
970: BEGIN
x = BYTARR(202) & READU, 1, x
x = BYTARR(3,256) & READU, 1, x
ENDCASE
2056: BEGIN
x = BYTARR(8) & READU, 1, x
x = INTARR(4,256) & READU, 1, x
x = BYTE(ISHFT(x(1:3,*),-8))
ENDCASE
ELSE: BEGIN
MESSAGE, /INFO, 'Unknown file size '+STRTRIM(stat.size)
RETURN
ENDCASE
ENDCASE
CLOSE, 1
r = REFORM(x(0,*))
g = REFORM(x(1,*))
b = REFORM(x(2,*))
TVLCT, r, g, b
ERASE
PLOT, r, YRANGE=[0,255], TITLE=file & OPLOT, g & OPLOT, b
TV, BINDGEN(256)#REPLICATE(1b,20)
PRINT, ' 0:', r(0), g(0), b(0)
PRINT, '255:', r(255), g(255), b(255)
PRINT, 'Enter id (42-255) of local file=colors1.tlb'
PRINT, 'To cancel enter 0.'
PRINT, 'To assign a new number enter 255.'
id = 0B
READ, id
IF id LT 42B THEN PRINT, 'Cannot change standard colors'$
ELSE BEGIN
MODIFYCT, id, file, r, g, b, FILE='colors1.tbl'
PRINT, id, ' entry modified'
ENDELSE

RETURN
err:
HELP, /STR, stat
MESSAGE, /INFO, !err_string
CLOSE, 1
RETURN
END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Button Events question
Next Topic: least square error for a regression

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 14:52:19 PDT 2025

Total time taken to generate the page: 1.03845 seconds