/usr/share/tcltk/bwidget1.9.7/bitmap.tcl is in bwidget 1.9.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | # ------------------------------------------------------------------------------
# bitmap.tcl
# This file is part of Unifix BWidget Toolkit
# $Id: bitmap.tcl,v 1.4 2003/10/20 21:23:52 damonc Exp $
# ------------------------------------------------------------------------------
# Index of commands:
# - Bitmap::get
# - Bitmap::_init
# ----------------------------------------------------------------------------
namespace eval Bitmap {
Widget::define Bitmap bitmap -classonly
variable path
variable _bmp
variable _types {
photo .gif
photo .ppm
bitmap .xbm
photo .xpm
}
proc use {} {}
}
# ----------------------------------------------------------------------------
# Command Bitmap::get
# ----------------------------------------------------------------------------
proc Bitmap::get { name } {
variable path
variable _bmp
variable _types
if {[info exists _bmp($name)]} {
return $_bmp($name)
}
# --- Nom de fichier avec extension ---------------------------------
set ext [file extension $name]
if { $ext != "" } {
if { ![info exists _bmp($ext)] } {
error "$ext not supported"
}
if { [file exists $name] } {
if {[string equal $ext ".xpm"]} {
set _bmp($name) [xpm-to-image $name]
return $_bmp($name)
}
if {![catch {set _bmp($name) [image create $_bmp($ext) -file $name]}]} {
return $_bmp($name)
}
}
}
foreach dir $path {
foreach {type ext} $_types {
if { [file exists [file join $dir $name$ext]] } {
if {[string equal $ext ".xpm"]} {
set _bmp($name) [xpm-to-image [file join $dir $name$ext]]
return $_bmp($name)
} else {
if {![catch {set _bmp($name) [image create $type -file [file join $dir $name$ext]]}]} {
return $_bmp($name)
}
}
}
}
}
return -code error "$name not found"
}
# ----------------------------------------------------------------------------
# Command Bitmap::_init
# ----------------------------------------------------------------------------
proc Bitmap::_init { } {
global env
variable path
variable _bmp
variable _types
set path [list "." [file join $::BWIDGET::LIBRARY images]]
set supp [image types]
foreach {type ext} $_types {
if { [lsearch $supp $type] != -1} {
set _bmp($ext) $type
}
}
}
Bitmap::_init
|