/[mldonkey]/mldonkey/src/gtk2/gui/guiArt.ml
ViewVC logotype

Diff of /mldonkey/src/gtk2/gui/guiArt.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by spiralvoice, Sat Nov 12 11:16:36 2005 UTC revision 1.7 by spiralvoice, Mon Nov 14 18:25:43 2005 UTC
# Line 358  let highlight range i = Line 358  let highlight range i =
358      else (range - (i * range / 2 / 16))      else (range - (i * range / 2 / 16))
359    
360  (* define the colors we will use to display the availability *)  (* define the colors we will use to display the availability *)
361  let color_red = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_red = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
362  let _ =  let _ =
363    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
364    for i = 0 to 15 do    for i = 0 to 15 do
365      let r = highlight 255 i in      let r = highlight 255 i in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
366      let s =  Printf.sprintf "0x%02X0000ff" r in      let s =  Printf.sprintf "0x%02X0000ff" r in
367      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
368      GdkPixbuf.copy_area ~dest:color_red ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_red ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
369    done    done
370    
371  let color_green = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_green = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
372  let _ =  let _ =
373    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
374    for i = 0 to 15 do    for i = 0 to 15 do
375      let r = highlight 255 i in      let r = highlight 255 i in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
376      let s =  Printf.sprintf "0x00%02X00ff" r in      let s =  Printf.sprintf "0x00%02X00ff" r in
377      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
378      GdkPixbuf.copy_area ~dest:color_green ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_green ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
379    done    done
380    
381  let color_black = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_black = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
382  let _ =  let _ =
383    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
384    for i = 0 to 15 do    for i = 0 to 15 do
385      let r = highlight 128 i in      let r = highlight 128 i in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
386      let s =  Printf.sprintf "0x%02X%02X%02Xff" r r r in      let s =  Printf.sprintf "0x%02X%02X%02Xff" r r r in
387      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
388      GdkPixbuf.copy_area ~dest:color_black ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_black ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
389    done    done
390    
391  let color_orange = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_orange = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
392  let _ =  let _ =
393    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
394    for i = 0 to 15 do    for i = 0 to 15 do
395      let r = highlight 255 i in      let r = highlight 255 i in
396      let g = 178 * r / 255 in      let g = 178 * r / 255 in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
397      let s =  Printf.sprintf "0x%02X%02X00ff" r g in      let s =  Printf.sprintf "0x%02X%02X00ff" r g in
398      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
399      GdkPixbuf.copy_area ~dest:color_orange ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_orange ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
400    done    done
401    
402  let color_yellow = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_yellow = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
403  let _ =  let _ =
404    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
405    for i = 0 to 15 do    for i = 0 to 15 do
406       let r = highlight 255 i in       let r = highlight 255 i in
407      let g = 255 * r / 255 in      let g = 255 * r / 255 in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
408      let s =  Printf.sprintf "0x%02X%02X00ff" r g in      let s =  Printf.sprintf "0x%02X%02X00ff" r g in
409      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
410      GdkPixbuf.copy_area ~dest:color_yellow ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_yellow ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
# Line 420  let color_blue_relative = ref [||] Line 415  let color_blue_relative = ref [||]
415  let create_color_blue_relative () =  let create_color_blue_relative () =
416    color_blue_relative := [||];    color_blue_relative := [||];
417    for i = 0 to (!!O.gtk_misc_availability_max - 1) do    for i = 0 to (!!O.gtk_misc_availability_max - 1) do
418      let pixbuf = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false () in      let pixbuf = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true () in
419      let col_step = i * 255 / (!!O.gtk_misc_availability_max - 1) in      let col_step = i * 255 / (!!O.gtk_misc_availability_max - 1) in
420      let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in      let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
421      for j = 0 to 15 do      for j = 0 to 15 do
422        let b = highlight 255 j in        let b = highlight 255 j in
423        let g = highlight col_step j in        let g = highlight col_step j in
# Line 435  let create_color_blue_relative () = Line 430  let create_color_blue_relative () =
430    
431  let _ = create_color_blue_relative ()  let _ = create_color_blue_relative ()
432    
433  let color_grey = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:false ()  let color_grey = GdkPixbuf.create ~width:1 ~height:16 ~has_alpha:true ()
434  let _ =  let _ =
435    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:false () in    let pixb = GdkPixbuf.create ~width:1 ~height:1 ~has_alpha:true () in
436    for i = 0 to 15 do    for i = 0 to 15 do
437      let r = highlight 255 i in      let r = highlight 255 i in
 (*  RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black) *)  
438      let s =  Printf.sprintf "0x%02X%02X%02Xff" r r r in      let s =  Printf.sprintf "0x%02X%02X%02Xff" r r r in
439      GdkPixbuf.fill pixb (Int32.of_string s);      GdkPixbuf.fill pixb (Int32.of_string s);
440      GdkPixbuf.copy_area ~dest:color_grey ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb      GdkPixbuf.copy_area ~dest:color_grey ~dest_x:0 ~dest_y:i ~width:1 ~height:1 ~src_x:0 ~src_y:0 pixb
# Line 475  let get_availability_of availability chu Line 469  let get_availability_of availability chu
469    with _ ->    with _ ->
470      begin      begin
471        (if !!verbose then lprintf' "Creating new availability bar\n");        (if !!verbose then lprintf' "Creating new availability bar\n");
472        let dest = GdkPixbuf.create ~width:nchunks ~height ~has_alpha:false () in        let dest = GdkPixbuf.create ~width:nchunks ~height ~has_alpha:true () in
473        (try        (try
474          for i = 0 to (nchunks - 1) do          for i = 0 to (nchunks - 1) do
475            if is_file            if is_file

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26