pkg://ikit-0.4-1.sparc.rpm:138064/
usr/
local/
lib/
ikit/ikit_png.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_png.tcl,v 1.3 1997/02/03 20:09:08 steve Exp $"
#
# $Log: ikit_png.tcl,v $
# Revision 1.3 1997/02/03 20:09:08 steve
# console message output interface.
#
# Revision 1.2 1997/01/31 23:32:06 steve
# More descriptive image labels.
#
# Revision 1.1 1997/01/31 18:31:12 steve
# PNG support.
#
#
# --
# 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 png_file_load ""
proc png_load {} {
global png_file_load
ik_get_values "{png_file_load {PNG file to load:} filename}"
set file "$png_file_load"
set label [ik_unique_image_name [file tail $png_file_load]]
image create ik_image $label -png $file
.body.console insert end "$label <-- PNG($file)\n"
.body.stack.list insert 0 $label
}
# --
# Save an image into a PNG file.
set png_file_save ""
proc png_save {} {
global png_file_save
set source [ik_stack_peek]
if {[llength $source] == 0} return
ik_get_values "{png_file_save {PNG file to save:} filename}"
set file "$png_file_save"
ik_store $source -png $file
ik_console "Store $source in PNG file $file\n"
}
ik_add_saver "PNG" png_save
ik_add_loader "PNG" png_load