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

Home » Public Forums » archive » Re: transparent colours for filling contours?
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: transparent colours for filling contours? [message #26225] Wed, 15 August 2001 06:03 Go to previous message
ngls is currently offline  ngls
Messages: 10
Registered: November 2000
Junior Member
I've done vaguely similar things trying to blend a solid-colour (bitmap)
image with a grey-scale image, such that the grey-scale would show through.

I did this by creating the two plots separately, taking (bitmap) images of
the plots, converting these plots to HSL colours (from RGB colours) and
then modifying the "L" (lightness) value of the colour image.

For instance, you could multiply the L values by 1.5 (say) to wash out the
colours (if need be) and then divide by the grey-scale image to darken the
colour image where the plot lines were drawn. If you had blacks or dark
colours in the colour image you might have to add a constant (0.25 say) to
the L values to wash out the colours, and then check for L>1.0

Of course, this only works with bitmap images of the plots and so restricts
print quality. No doubt you could do all this much more directly with
object graphics (no pun intended).

The code below might give you an idea of what I mean.

Good Luck.

Justin

PRO test_colour_merge
;Merges a black and white plot, with a colour image

DEVICE, DECOMPOSED=0

;Make some data to plot
z = SHIFT(DIST(50,50), 25, 25)
z = SIN(z*2*!PI/max(z))
x = FINDGEN(1000)*2*!PI/1000

LOADCT, 0 ;Load grey-scale colours
;The COLOR value determines how dark/light the plot lines appear
PLOT, x, SIN(x), BACKGROUND=255, COLOR=64
img_grey = TVRD()

;Now do the colour
LOADCT, 34 ;load rainbow colors
SHADE_SURF, z ;Could probably use IMAGE keyword
img_colour = TVRD(True=1) ;get the true-colour values

;Convert RGB colours to Hue, Lightness, Saturation
COLOR_CONVERT, img_colour[0,*,*], img_colour[1,*,*], $
img_colour[2,*,*], newH, newL, newS, /RGB_HLS


;newL = newL * 1.5 ;Wash colours by multiplication
newL = newL + 0.25 ;Wash out colours by addition

newL = newL * (img_grey/255.) ;Darken where the plot lines are
;newL = newL / (img_grey/255.) ;Lighten plot lines

;Check for L>1.0 in case of L addition
list = WHERE(newL GT 1.0, count)
if count GT 0 THEN newL[list]=1.0

;Convert back to RGB ready for display
COLOR_CONVERT, newH, newL, newS, R, G, B, /HLS_RGB

LOADCT,0 ;return to grey-scale ready for true-colour
DEVICE, DECOMPOSED=1
;Display the latest image
TV, [R,G,B], TRUE=1

END


ahw199@soton.ac.uk (Ann Webber) wrote in
<b73826cc.0108140426.18c18654@posting.google.com>:

> Hi,
> I am plotting contours over a map and I was wondering if there was a
> way of filling the contours so that I can still see the map
> underneath? i.e. I want to be able to see country boundaries
> underneath the filled contours. Is there a colour table that contains
> sone transparent colours? Or is this completely impossible to do?
> Regards
> Ann Webber
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Fortran + IDL
Next Topic: GET_SCREEN_SIZE in Windows

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

Current Time: Wed Oct 08 16:50:29 PDT 2025

Total time taken to generate the page: 0.00389 seconds