- Timestamp:
- 08/17/12 12:18:32 (12 years ago)
- Location:
- trunk/SRC
- Files:
-
- 1 added
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/colorbar.pro
r400 r479 132 132 ; Check and define keywords. 133 133 134 IF N_ELEMENTS(ncolors) EQ 0 THEN BEGIN 135 136 ; Most display devices to not use the 256 colors available to 137 ; the PostScript device. This presents a problem when writing 138 ; general-purpose programs that can be output to the display or 139 ; to the PostScript device. This problem is especially bothersome 140 ; if you don't specify the number of colors you are using in the 141 ; program. One way to work around this problem is to make the 142 ; default number of colors the same for the display device and for 143 ; the PostScript device. Then, the colors you see in PostScript are 144 ; identical to the colors you see on your display. Here is one way to 145 ; do it. 146 147 IF postScriptDevice THEN BEGIN 148 oldDevice = !D.NAME 149 150 ; What kind of computer are we using? SET_PLOT to appropriate 151 ; display device. 152 153 thisOS = !VERSION.OS_FAMILY 154 thisOS = STRMID(thisOS, 0, 3) 155 thisOS = STRUPCASE(thisOS) 156 CASE thisOS of 157 'MAC': SET_PLOT, thisOS 158 'WIN': SET_PLOT, thisOS 159 ELSE: SET_PLOT, 'X' 160 ENDCASE 161 !p.BACKGROUND=(!d.n_colors-1) < 255 162 !p.color=0 163 if !d.n_colors gt 256 then !p.background='ffffff'x 164 165 ; Open a window (to make sure !D.N_COLORS is accurate). 166 167 WINDOW, /FREE, /PIXMAP, XSIZE=10, YSIZE=10 168 WDELETE, !D.WINDOW 169 170 ; Here is how many colors we should use. 171 172 ncolors = !D.N_COLORS 173 SET_PLOT, oldDevice 174 IF oldDevice EQ 'X' OR oldDevice EQ 'MAC' OR oldDevice EQ 'WIN' then BEGIN 175 !p.BACKGROUND=(!d.n_colors-1) < 255 176 !p.color=0 177 if !d.n_colors gt 256 then !p.background='ffffff'x 178 ENDIF 179 ENDIF ELSE ncolors = !D.N_COLORS 180 ENDIF 134 IF N_ELEMENTS(ncolors) EQ 0 THEN ncolors = !D.N_COLORS < 256 181 135 IF N_ELEMENTS(bottom) EQ 0 THEN bottom = 0B 182 136 IF N_ELEMENTS(cb_charsize) EQ 0 THEN cb_charsize = 1.0 -
trunk/SRC/Colors/getcolor.pro
r371 r479 250 250 251 251 IF Float(!Version.Release) GE 5.2 THEN BEGIN 252 IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ ' MAC') THEN BEGIN252 IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ 'Z') THEN BEGIN 253 253 Device, Get_Decomposed=decomposedState 254 254 ENDIF ELSE decomposedState = 0 … … 332 332 IF Float(!Version.Release) GE 5.2 THEN BEGIN 333 333 334 IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ ' MAC') THEN BEGIN334 IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ 'Z') THEN BEGIN 335 335 Device, Get_Decomposed=decomposedState 336 336 ENDIF ELSE decomposedState = 0 -
trunk/SRC/Colors/lct.pro
r478 r479 52 52 if n_elements(ex) NE 0 then $ 53 53 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl 54 ; if we are in POSTSCRIPT mode, we have to pass in X mode in order to change the color palette55 oldname = !d.name56 ;++if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN57 if !d.name EQ 'PS' then BEGIN58 thisOS = !VERSION.OS_FAMILY59 thisOS = STRMID(thisOS, 0, 3)60 thisOS = STRUPCASE(thisOS)61 CASE thisOS of62 'MAC': SET_PLOT, thisOS63 'WIN': SET_PLOT, thisOS64 ELSE: SET_PLOT, 'X'65 ENDCASE66 !p.BACKGROUND = (!d.n_colors-1) < 25567 !p.color = 068 if !d.n_colors gt 256 then !p.background = 'ffffff'x69 ENDIF70 54 ; 71 55 if arg_present(get_name) then begin … … 78 62 ENDELSE 79 63 ; 80 if oldname EQ 'PS' AND keyword_set(lightness) then palit, lightness64 if !d.name EQ 'PS' AND keyword_set(lightness) then palit, lightness 81 65 ; 82 set_plot, oldname83 IF oldname EQ 'X' OR oldname EQ 'MAC' OR oldname EQ 'WIN' then BEGIN84 !p.BACKGROUND = (!d.n_colors-1) < 25585 !p.color = 086 if !d.n_colors gt 256 then !p.background = 'ffffff'x87 ENDIF88 89 66 ENDIF ELSE ras = report('The file containing the color palettes doesn''t exist...') 90 67 -
trunk/SRC/Postscript/closeps.pro
r371 r479 89 89 last_part: 90 90 ; 91 thisOS = strupcase(strmid(!version.os_family, 0, 3))92 CASE thisOS of93 'MAC': SET_PLOT, thisOS94 'WIN': SET_PLOT, thisOS95 ELSE: SET_PLOT, 'X'96 ENDCASE97 91 def_myuniquetmpdir 98 92 colorfile = myuniquetmpdir + 'original_colors.dat' … … 104 98 ENDIF 105 99 !p.font = -1 106 ; force background color to the last color (white) 107 !p.BACKGROUND=(!d.n_colors-1) < 255 108 !p.color=0 109 if !d.n_colors gt 256 then !p.background='ffffff'x 100 set_default_device 110 101 ;------------------------------------------------------------ 111 102 if keyword_set(infowidget) then $ -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltv.pro
r378 r479 177 177 xsize = !p.position[2] - !p.position[0] 178 178 ysize = !p.position[3] - !p.position[1] 179 IF !d.name EQ 'X' THEN BEGIN179 IF !d.name EQ 'X' OR !d.name EQ 'Z' THEN BEGIN 180 180 xsize = ceil(xsize * !d.x_size) 181 181 ysize = ceil(ysize * !d.y_size) -
trunk/SRC/ToBeReviewed/PLOTS/DESSINE/tvplus.pro
r371 r479 203 203 window, window, xsize = nx+marginpix[0]+marginpix[1] $ 204 204 , ysize = ny+marginpix[2]+marginpix[3] 205 ; for 24 bits colors, make sure that the background color is the good one...206 if !d.n_colors gt 256 then BEGIN207 device, decomposed = 1208 !p.background = 'ffffff'x209 plot, [0], [0], xstyle = 5, ystyle = 5210 device, decomposed = 0211 endif212 205 tv, arr, marginpix[0], marginpix[2], _EXTRA = ex 213 206 ; … … 245 238 ; scrolling bar window case... 246 239 ;------------------------------------------------------------ 247 ; for 24 bits colors, make sure that the background color is the good one...248 if !d.n_colors gt 256 then begin249 window, /pixmap250 device, decomposed = 1251 !p.background = 'ffffff'x252 plot, [0], [0]253 device, decomposed = 0254 endif255 240 slide_image, arr $ ; We draw it in a window with a scrolling bar 256 241 , xsize = nx, ysize = ny $ -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/givewindowsize.pro
r325 r479 6 6 ; 7 7 ; @returns 8 ; 9 ; @keyword dpi {in}{optional}{type=scalar}{default=72} 10 ; used only in z buffer. specify the number of dots per inch. 11 ; used to define the size of the virtual window activated in the Z buffer. 12 ; 13 ; @keyword _EXTRA 14 ; Used to pass keywords 8 15 ; 9 16 ; @uses … … 20 27 ; @todo seb 21 28 ;- 22 FUNCTION givewindowsize 29 FUNCTION givewindowsize, dpi = dpi, _extra = ex 23 30 ; 24 31 compile_opt idl2, strictarrsubs … … 30 37 ;------------------------------------------------------------ 31 38 ; 32 dimensions = get_screen_size(RESOLUTION=resolution) 33 coef = floor(1./resolution[0]) 39 IF !d.name EQ 'Z' THEN BEGIN 40 IF NOT keyword_set(dpi) THEN dpi = 72 41 coef = dpi/2.54 ; 1 inch = 2.54 cm 42 ENDIF ELSE BEGIN 43 dimensions = get_screen_size(RESOLUTION = resolution) 44 coef = floor(1./resolution[0]) 45 ENDELSE 34 46 if NOT keyword_set(windowsize_scale) then BEGIN 35 47 windowsize_scale = 1. -
trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placedessin.pro
r378 r479 240 240 keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex 241 241 ; case of the first drawing on a screen 242 keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $ 243 AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN 244 if not keyword_set(window) then window = 0 242 keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 AND !d.name ne 'PS':BEGIN 245 243 ; For the using of \@ps,\@oups and \@vzoom 246 244 if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode?? … … 253 251 journal, listecommande ; We write it in the journal 254 252 ENDIF 255 windsize = givewindowsize() 256 window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex 257 ; When we used colors which are coded on 24bit, we can not stipulate the background color 258 ; of a window thanks to !p.background, so we have to to this: 259 ; if !d.n_colors gt 256 then begin 260 ; device, decomposed=1 261 ; !p.background='ffffff'x 262 ; plot,[0],[0], /nodata, xstyle = 4, ystyle = 4 263 ; device, decomposed=0 264 ; endif 253 windsize = givewindowsize(_extra = ex) 254 IF !d.name EQ 'Z' THEN BEGIN 255 device, set_resolution = windsize 256 erase 257 ENDIF ELSE BEGIN 258 if not keyword_set(window) then winnumb = 0 259 window, winnumb, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex 260 ENDELSE 265 261 END 266 262 ELSE: -
trunk/SRC/ToBeReviewed/PLOTS/LABEL/label.pro
r369 r479 51 51 ; 52 52 @common 53 if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN 54 old_dname = !d.name 55 thisOS = !VERSION.OS_FAMILY 56 thisOS = STRMID(thisOS, 0, 3) 57 thisOS = STRUPCASE(thisOS) 58 CASE thisOS of 59 'MAC': SET_PLOT, thisOS 60 'WIN': SET_PLOT, thisOS 61 ELSE: SET_PLOT, 'X' 62 ENDCASE 63 !p.BACKGROUND=(!d.n_colors-1) < 255 64 !p.color=0 65 if !d.n_colors gt 256 then !p.background='ffffff'x 66 ncoul = !D.n_Colors < 256 67 set_plot,old_dname 68 ENDIF ELSE ncoul = !D.n_Colors < 256 53 ; 54 ncoul = !D.n_Colors < 256 69 55 case cas of 70 56 0: begin -
trunk/SRC/ToBeReviewed/TRIANGULATION/dessinetri.pro
r370 r479 74 74 ; 75 75 IF keyword_set(changecolor) THEN BEGIN 76 oldname = !d.name 77 if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN 78 thisos = strupcase(strmid(!version.os_family, 0, 3)) 79 CASE thisOS of 80 'MAC': set_plot, thisOS 81 'WIN': set_plot, thisOS 82 ELSE: set_plot, 'X' 83 ENDCASE 84 ncolors=(!d.n_colors-1) < 255 85 set_plot, oldname 86 ENDIF ELSE ncolors=(!d.n_colors-1) < 255 87 color = 1+indgen(changecolor)*(ncolors/(changecolor-1)) 88 ENDIF ELSE color = 0 89 color = color#replicate(1, n_elements(tri)/3/n_elements(color)+1) 76 ncolors = (!d.n_colors-1) < 255 77 color = 1+indgen(changecolor)*(ncolors/(changecolor-1)) 78 ENDIF ELSE color = 0 79 color = color#replicate(1, n_elements(tri)/3/n_elements(color)+1) 90 80 ; 91 81 tempdeux = systime(1) ; For key_performance =2 -
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro
r370 r479 58 58 ; We select it (we will pass to it all commands concerning the window) 59 59 wset, win 60 ; erase, 255 ; we clean the window 61 ; We make sure that, if we work with a screen coding colors on 24 bits, the specified background color !p.background is the one applied. 62 ; if !d.n_colors gt 256 then begin 63 ; device, decomposed=1 64 ; !p.background='ffffff'x 65 ; plot,[0],[0] 66 ; device, decomposed=0 67 ; ENDIF 68 ; 60 69 61 smallout = long(extractatt(top_uvalue, 'smallout')) 70 62 numdessinout = smallout[2]-1 -
trunk/SRC/buildinit.pro
r327 r479 521 521 , '; colors ...' $ 522 522 , ';' $ 523 , 'device, decomposed = 0' $ 524 , 'device, retain = 2'] 523 , 'set_default_device'] 525 524 ; 526 525 ; default color tables
Note: See TracChangeset
for help on using the changeset viewer.