Version 19 of bitmap

Updated 2007-11-22 12:48:46 by torsten

Documentation can be found at http://www.purl.org/tcl/home/man/tcl8.4/TkCmd/bitmap.htm .

A bitmap is monochromatic representation. Use photo when you want color images or icons (aka a pixmap).


"How to edit an executable's desktop icon"


Sometimes people want to know how to edit an X bitmap or to create a new one. See Paul Obermeier's http://www.posoft.de/ 's poBitmap, part of poSoft utilities for one tool.

KPV See Bitmap Editor for a simple tool to create and edit bitmaps.

Also http://www.sfu.ca/~gay/bme.zip


A variant Tk-pertinent sense of "bitmap" is as a permissible argument to specific canvas subcommands. A model of such uses is

    .canvas itemconfig rectangle -stipple $bitmap

While Tk offers many interesting bitmap capabilities, it can be difficult tracking down their documentation. A good starting point is the distribution man page for the library entry point Tk_GetBitmap [L1 ]. Along with much else, it provides a list--"error", "gray50", "question", and so on--of standard bitmaps built in to Tk. Apparently Tk provides no script-level introspection to access this list. To view these built-ins, therefore, it's necessary to perform something like the script below. Note, however, that the last 16 bitmaps (from document to caution) are only available on the Mac platform.

    set bitmap_list {error gray75 gray50 gray25 gray12 hourglass
        info questhead question warning document stationery edition
        application accessory folder pfolder trash floppy ramdisk
        cdrom preferences querydoc stop note caution}

    eval destroy [winfo children .]

    canvas .c -height 200 -width 200 -background linen
    listbox .l -height [llength $bitmap_list]

    foreach bitmap $bitmap_list {
        .l insert end $bitmap
    }
    pack .c .l -fill x


    bind .l <ButtonRelease-1> show_bitmap

    proc show_bitmap {} {
        set pattern [.l get [.l curselection]]
        .c delete bitmap
        .c create bitmap 100 100 -bitmap $pattern -tags bitmap
    }

Run this and you'll see such pictures as ...

http://tcl.typoscriptics.de/misc/bitmap.gif


See also: