Changeset 479 for trunk


Ignore:
Timestamp:
08/17/12 12:18:32 (12 years ago)
Author:
smasson
Message:

full integration of the batch mode with Z buffer

Location:
trunk/SRC
Files:
1 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Colors/colorbar.pro

    r400 r479  
    132132                                ; Check and define keywords. 
    133133 
    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 
    181135   IF N_ELEMENTS(bottom) EQ 0 THEN bottom = 0B 
    182136   IF N_ELEMENTS(cb_charsize) EQ 0 THEN cb_charsize = 1.0 
  • trunk/SRC/Colors/getcolor.pro

    r371 r479  
    250250 
    251251   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 BEGIN 
     252      IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ 'Z') THEN BEGIN 
    253253         Device, Get_Decomposed=decomposedState 
    254254      ENDIF ELSE decomposedState = 0 
     
    332332IF Float(!Version.Release) GE 5.2 THEN BEGIN 
    333333 
    334       IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ 'MAC') THEN BEGIN 
     334      IF (!D.Name EQ 'X' OR !D.Name EQ 'WIN' OR !D.Name EQ 'Z') THEN BEGIN 
    335335         Device, Get_Decomposed=decomposedState 
    336336      ENDIF ELSE decomposedState = 0 
  • trunk/SRC/Colors/lct.pro

    r478 r479  
    5252    if n_elements(ex) NE 0 then $ 
    5353       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 palette 
    55     oldname = !d.name 
    56     ;++if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN 
    57     if !d.name EQ 'PS' then BEGIN 
    58       thisOS = !VERSION.OS_FAMILY 
    59       thisOS = STRMID(thisOS, 0, 3) 
    60       thisOS = STRUPCASE(thisOS) 
    61       CASE thisOS of 
    62         'MAC': SET_PLOT, thisOS 
    63         'WIN': SET_PLOT, thisOS 
    64         ELSE: SET_PLOT, 'X' 
    65       ENDCASE 
    66       !p.BACKGROUND = (!d.n_colors-1) < 255 
    67       !p.color = 0 
    68       if !d.n_colors gt 256 then !p.background = 'ffffff'x 
    69     ENDIF 
    7054; 
    7155    if arg_present(get_name) then begin 
     
    7862    ENDELSE 
    7963; 
    80     if oldname EQ 'PS' AND keyword_set(lightness) then palit, lightness 
     64    if !d.name EQ 'PS' AND keyword_set(lightness) then palit, lightness 
    8165; 
    82     set_plot, oldname 
    83     IF oldname EQ 'X' OR oldname EQ 'MAC' OR oldname EQ 'WIN' then BEGIN 
    84       !p.BACKGROUND = (!d.n_colors-1) < 255 
    85       !p.color = 0 
    86       if !d.n_colors gt 256 then !p.background = 'ffffff'x 
    87     ENDIF 
    88  
    8966  ENDIF ELSE ras = report('The file containing the color palettes doesn''t exist...') 
    9067 
  • trunk/SRC/Postscript/closeps.pro

    r371 r479  
    8989last_part: 
    9090; 
    91    thisOS = strupcase(strmid(!version.os_family, 0, 3)) 
    92    CASE thisOS of 
    93      'MAC': SET_PLOT, thisOS 
    94      'WIN': SET_PLOT, thisOS 
    95      ELSE: SET_PLOT, 'X' 
    96    ENDCASE 
    9791   def_myuniquetmpdir 
    9892   colorfile = myuniquetmpdir + 'original_colors.dat' 
     
    10498   ENDIF 
    10599   !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 
    110101;------------------------------------------------------------ 
    111102   if keyword_set(infowidget) then $ 
  • trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltv.pro

    r378 r479  
    177177   xsize = !p.position[2] - !p.position[0] 
    178178   ysize = !p.position[3] - !p.position[1] 
    179    IF !d.name EQ 'X' THEN BEGIN 
     179   IF !d.name EQ 'X' OR !d.name EQ 'Z' THEN BEGIN 
    180180     xsize = ceil(xsize * !d.x_size) 
    181181     ysize = ceil(ysize * !d.y_size) 
  • trunk/SRC/ToBeReviewed/PLOTS/DESSINE/tvplus.pro

    r371 r479  
    203203    window, window, xsize = nx+marginpix[0]+marginpix[1] $ 
    204204            , 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 BEGIN 
    207       device, decomposed = 1 
    208       !p.background = 'ffffff'x 
    209       plot, [0], [0], xstyle = 5, ystyle = 5 
    210       device, decomposed = 0 
    211     endif 
    212205    tv, arr, marginpix[0], marginpix[2], _EXTRA = ex 
    213206; 
     
    245238; scrolling bar window case... 
    246239;------------------------------------------------------------ 
    247 ; for 24 bits colors, make sure that the background color is the good one... 
    248     if !d.n_colors gt 256 then begin 
    249       window, /pixmap 
    250       device, decomposed = 1 
    251       !p.background = 'ffffff'x 
    252       plot, [0], [0] 
    253       device, decomposed = 0 
    254     endif 
    255240    slide_image, arr $          ; We draw it in a window with a scrolling bar 
    256241                 , xsize = nx, ysize = ny $ 
  • trunk/SRC/ToBeReviewed/PLOTS/DIVERS/givewindowsize.pro

    r325 r479  
    66; 
    77; @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 
    815; 
    916; @uses 
     
    2027; @todo seb 
    2128;- 
    22 FUNCTION givewindowsize 
     29FUNCTION givewindowsize, dpi = dpi, _extra = ex 
    2330; 
    2431  compile_opt idl2, strictarrsubs 
     
    3037;------------------------------------------------------------ 
    3138; 
    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 
    3446   if NOT keyword_set(windowsize_scale) then BEGIN 
    3547     windowsize_scale = 1. 
  • trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placedessin.pro

    r378 r479  
    240240    keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex 
    241241; 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 
    245243; For the using of \@ps,\@oups and \@vzoom 
    246244      if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode?? 
     
    253251        journal, listecommande ; We write it in the journal 
    254252      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 
    265261    END 
    266262    ELSE: 
  • trunk/SRC/ToBeReviewed/PLOTS/LABEL/label.pro

    r369 r479  
    5151; 
    5252@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 
    6955   case cas of 
    7056      0: begin 
  • trunk/SRC/ToBeReviewed/TRIANGULATION/dessinetri.pro

    r370 r479  
    7474; 
    7575   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) 
    9080; 
    9181   tempdeux = systime(1)         ; For key_performance =2 
  • trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro

    r370 r479  
    5858; We select it (we will pass to it all commands concerning the window) 
    5959   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 
    6961   smallout = long(extractatt(top_uvalue, 'smallout')) 
    7062   numdessinout = smallout[2]-1 
  • trunk/SRC/buildinit.pro

    r327 r479  
    521521          , '; colors ...' $ 
    522522          , ';' $ 
    523           , 'device, decomposed = 0' $ 
    524           , 'device, retain = 2'] 
     523          , 'set_default_device'] 
    525524; 
    526525; default color tables 
Note: See TracChangeset for help on using the changeset viewer.