pkg://ikit-0.4-1.sparc.rpm:138064/
usr/
local/
lib/
ikit/ikit_pbm.tcl
info downloads
#
# Copyright (c) 1997 Picture Elements, Inc.
# Stephen Williams (steve@picturel.com)
#
# This source code is free software; you can redistribute it
# and/or modify it in source code form under the terms of the GNU
# Library General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version. In order to redistribute the software in
# binary form, you will need a Picture Elements Binary Software
# License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc.,
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
# You should also have recieved a copy of the Picture Elements
# Binary Software License offer along with the source. This offer
# allows you to obtain the right to redistribute the software in
# binary (compiled) form. If you have not received it, contact
# Picture Elements, Inc.,
# 777 Panoramic Way
# Berkeley, CA 94704.
#
#ident "$Id: ikit_pbm.tcl,v 1.2 1997/07/02 21:03:18 steve Exp $"
#
# $Log: ikit_pbm.tcl,v $
# Revision 1.2 1997/07/02 21:03:18 steve
# Spelling error.
#
# Revision 1.1 1997/06/04 08:30:43 steve
# Add support for pbm.
#
#
# --
# Set up the PNG stuff, including all the global functions
# needed. Install hooks into the GUI as needed.
#
# --
# Load a PNG file into an image, and push the result onto the top
# of the stack.
set pbm_file_load ""
proc pbm_load {} {
global pbm_file_load
ik_get_values "{pbm_file_load {PBM file to load:} filename}"
set file "$pbm_file_load"
set label [ik_unique_image_name [file tail $pbm_file_load]]
image create ik_image $label -pbm $file
.body.console insert end "$label <-- PBM($file)\n"
.body.stack.list insert 0 $label
}
# --
# Save an image into a PBM file.
set pbm_file_save ""
proc pbm_save {} {
global pbm_file_save
set source [ik_stack_peek]
if {[llength $source] == 0} return
ik_get_values "{pbm_file_save {PBM file to save:} filename}"
set file "$pbm_file_save"
ik_store $source -pbm $file
ik_console "Store $source in PBM file $file\n"
}
ik_add_saver "PBM" pbm_save
ik_add_loader "PBM" pbm_load