Commit d466f7d0 authored by Marc Lehmann's avatar Marc Lehmann
Browse files

see plug-ins/perl/Changes

parent dcf082b6
......@@ -5,6 +5,7 @@ Revision history for Gimp-Perl extension.
larger (& more correct) fonts.
- small api changes for 1.2.
- (some) changes for the gimp api renaming.
- added export capabilities to miff/avi.
1.14 Mon Oct 11 03:23:13 CEST 1999
- set the version of all modules explicitly (for the benefit of CPAN).
......
......@@ -59,6 +59,11 @@ my @_consts = (@_param,
'ADD_BLACK_MASK', 'ADD_WHITE_MASK', 'ADD_ALPHA_MASK',
'ORIENTATION_HORIZONTAL', 'ORIENTATION_VERTICAL', 'ORIENTATION_UNKNOWN',
'CAN_HANDLE_RGB', 'CAN_HANDLE_GRAY', 'CAN_HANDLE_INDEXED',
'CAN_HANDLE_ALPHA', 'CAN_HANDLE_LAYERS', 'CAN_HANDLE_LAYERS_AS_ANIMATION',
'NEEDS_ALPHA',
'EXPORT_CANCEL', 'EXPORT_IGNORE', 'EXPORT_EXPORT',
);
sub ADD_WHITE_MASK () { &WHITE_MASK }
......
......@@ -2,6 +2,9 @@
#include "perl-intl.h"
#include <libgimp/gimp.h>
#ifdef GIMP_HAVE_EXPORT
#include <libgimp/gimpexport.h>
#endif
#include <locale.h>
......@@ -148,6 +151,19 @@ BOOT:
#if HAVE_DIVIDE_MODE || IN_GIMP
/*newCONSTSUB(stash,"DIVIDE_MODE",newSViv(DIVIDE_MODE));*/
#endif
#ifdef GIMP_HAVE_EXPORT
newCONSTSUB(stash,"CAN_HANDLE_RGB", newSViv(CAN_HANDLE_RGB));
newCONSTSUB(stash,"CAN_HANDLE_GRAY", newSViv(CAN_HANDLE_GRAY));
newCONSTSUB(stash,"CAN_HANDLE_INDEXED", newSViv(CAN_HANDLE_INDEXED));
newCONSTSUB(stash,"CAN_HANDLE_ALPHA", newSViv(CAN_HANDLE_ALPHA));
newCONSTSUB(stash,"CAN_HANDLE_LAYERS", newSViv(CAN_HANDLE_LAYERS));
newCONSTSUB(stash,"CAN_HANDLE_LAYERS_AS_ANIMATION", newSViv(CAN_HANDLE_LAYERS_AS_ANIMATION));
newCONSTSUB(stash,"NEEDS_ALPHA", newSViv(NEEDS_ALPHA));
newCONSTSUB(stash,"EXPORT_CANCEL", newSViv(EXPORT_CANCEL));
newCONSTSUB(stash,"EXPORT_IGNORE", newSViv(EXPORT_CANCEL));
newCONSTSUB(stash,"EXPORT_EXPORT", newSViv(EXPORT_EXPORT));
#endif
}
MODULE = Gimp PACKAGE = Gimp::RAW
......
......@@ -24,7 +24,7 @@ sub TIEHASH {
}
sub FETCH {
my $data = eval { Gimp->find_parasite ($_[1])->data }
my $data = eval { Gimp->parasite_find ($_[1])->data }
|| ($@ ? Gimp->get_data ($_[1]) : ());
if ($data =~ /^\$VAR1 = \[/) {
thaw $data;
......@@ -38,7 +38,7 @@ sub STORE {
if (ref $data) {
$data = freeze $data or return;
}
eval { Gimp->attach_parasite ([$_[1], Gimp::PARASITE_PERSISTENT, $data]) };
eval { Gimp->parasite_attach ([$_[1], Gimp::PARASITE_PERSISTENT, $data]) };
Gimp->set_data ($_[1], $data) if $@;
}
......
......@@ -5,9 +5,6 @@
#include <stdio.h>
#include <libgimp/gimp.h>
#if UI
# include <libgimp/gimpui.h>
#endif
#if GIMP_MAJOR_VERSION>1 || (GIMP_MAJOR_VERSION==1 && GIMP_MINOR_VERSION>=1)
# define GIMP11 1
......@@ -1256,15 +1253,6 @@ static void pii_run(char *name, int nparams, GParam *param, int *xnreturn_vals,
GPlugInInfo PLUG_IN_INFO = { pii_init, pii_quit, pii_query, pii_run };
#if UI
static void gimp_pattern_select_widget_callback (gchar *name, gint width,
gint height, gint bpp, gchar *mask, gint closing, gpointer nameref)
{
SV *sv = (SV *)nameref;
sv_setpv (sv, name);
}
#endif#
MODULE = Gimp::Lib PACKAGE = Gimp::Lib
PROTOTYPES: ENABLE
......@@ -2304,31 +2292,3 @@ gimp_default_display()
#gimp_query_images(nimages)
# int * nimages
MODULE = Gimp::Lib PACKAGE = Gimp::UI
#if 0
#if UI
#if GIMP11
GtkWidget *
_new_pattern_select(dname, ipattern, nameref)
gchar * dname
gchar * ipattern
SV * nameref
CODE:
{
if (!SvROK (nameref))
croak (__("last argument to gimp_pattern_select_widget must be scalar ref"));
nameref = SvRV (nameref);
SvUPGRADE (nameref, SVt_PV);
RETVAL = gimp_pattern_select_widget (dname, ipattern,
gimp_pattern_select_widget_callback, (gpointer) nameref);
}
OUTPUT:
RETVAL
#endif
#endif
#endif
......@@ -3,8 +3,13 @@ package Gimp::UI;
use Gimp ('__');
use Gimp::Fu;
use Gtk;
use base 'DynaLoader';
$VERSION = 1.15;
BEGIN {
require DynaLoader;
$VERSION = 1.15;
bootstrap Gimp::UI $VERSION;
}
=head1 NAME
......
......@@ -36,12 +36,10 @@ Gimp/Makefile.PL
Gimp/Lib.xs
Gimp/Lib.pm
Gimp/OO.pod
Gimp/Net.pm
Gimp/Data.pm
Gimp/Fu.pm
Gimp/PDL.pm
Gimp/Pixel.pod
Gimp/UI.pm
Gimp/Util.pm
Gimp/Feature.pm
Gimp/Pod.pm
......@@ -54,6 +52,10 @@ Module/Makefile.PL
Module/Module.xs
Net/Makefile.PL
Net/Net.xs
Net/Net.pm
UI/Makefile.PL
UI/UI.pm
UI/UI.xs
examples/PDB
examples/alpha2color.pl
examples/tex-to-float
......
......@@ -229,7 +229,7 @@ setver:
}
$GIMP_INC_NOUI = "-I../../ $GIMP_INC_NOUI" if $IN_GIMP;
@DIRS= qw/Gimp Net/;
@DIRS= qw/Gimp Net UI/;
$build_module = $IN_GIMP || $ENV{GIMP_PERL_MODULE_INC};
# temporarily disabled because of politics
......@@ -285,8 +285,8 @@ WriteMakefile(
'Gimp/Data.pm' => '$(INST_LIBDIR)/Gimp/Data.pm',
'Gimp/Fu.pm' => '$(INST_LIBDIR)/Gimp/Fu.pm',
'Gimp/Lib.pm' => '$(INST_LIBDIR)/Gimp/Lib.pm',
'Gimp/UI.pm' => '$(INST_LIBDIR)/Gimp/UI.pm',
'Gimp/Net.pm' => '$(INST_LIBDIR)/Gimp/Net.pm',
'UI/UI.pm' => '$(INST_LIBDIR)/Gimp/UI.pm',
'Net/Net.pm' => '$(INST_LIBDIR)/Gimp/Net.pm',
'Gimp/PDL.pm' => '$(INST_LIBDIR)/Gimp/PDL.pm',
'Gimp/Util.pm' => '$(INST_LIBDIR)/Gimp/Util.pm',
'Gimp/Feature.pm' => '$(INST_LIBDIR)/Gimp/Feature.pm',
......
......@@ -30,6 +30,7 @@
static Core* PDL; /* Structure hold core C functions */
/* get pointer to PDL structure. */
#if 0
static void need_pdl (void)
{
SV *CoreSV;
......@@ -43,6 +44,7 @@ static void need_pdl (void)
PDL = (Core*) SvIV(CoreSV);
}
}
#endif
#endif
......
......@@ -4,6 +4,7 @@
use Gimp 1.14;
use Gimp::Fu;
use Gimp::UI;
use Fcntl;
# Gimp::set_trace(TRACE_ALL);
......@@ -28,7 +29,7 @@ register "file_avi_save",
"Saves images in the 24 bit uncompressed AVI format used by windows software",
"Marc Lehmann",
"Marc Lehmann <pcg\@goof.com>",
"1999-09-18",
"1999-10-26",
"<Save>/AVI",
"RGB",
[
......@@ -38,19 +39,23 @@ register "file_avi_save",
],
sub {
my($img,$drawable,$filename,$raw_filename,$depth,$compression,$index) = @_;
my($new_img,$new_drawable);
my $export = Gimp::UI::export_image($new_img=$img, $new_drawable=$drawable, "AVI",
CAN_HANDLE_RGB|CAN_HANDLE_LAYERS_AS_ANIMATION|CAN_HANDLE_ALPHA);
die "export failed" if $export == EXPORT_CANCEL;
sysopen FILE,$filename,O_CREAT|O_TRUNC|O_WRONLY or die "Unable to open '$filename' for writing: $!\n";
my $us_frame = eval { $img->find_parasite("gimp-interframe-delay")->data } || 100000;
my $us_frame = eval { $img->parasite_find("gimp-interframe-delay")->data } || 100000;
#Gimp->tile_cache_ntiles($img->width / Gimp->tile_width + 3); coredumps!
my ($width, $height) = ($img->width, $img->height);
my @layers = $img->get_layers;
my @layers = $new_img->get_layers;
for (@layers) {
die "all layers must have the same size as the image\n" if $width != $_->width or $height != $_->height;
}
$depth = 16 if $depth == 15;
$img->selection_all;
$new_img->selection_all;
my $framesize = ($width*$height*$depth) >> 3;
my $idx1;
......@@ -136,6 +141,7 @@ register "file_avi_save",
}
pop_hunk;
close FILE;
$new_img->delete if $export == EXPORT_EXPORT;
();
};
......@@ -230,9 +236,9 @@ register "file_avi_load",
$image = new Image($width,$height,RGB);
$image->undo_disable;
$image->set_filename($filename);
$image->attach_parasite(new Parasite "gimp-interframe-delay", PARASITE_PERSISTENT, $us_frame);
$image->attach_parasite(new Parasite "gimp-avi-depth", PARASITE_PERSISTENT, $depth == 16 ? 15 : $depth);
$image->attach_parasite(new Parasite "gimp-avi-compression", PARASITE_PERSISTENT, $compression);
$image->parasite_attach(new Parasite "gimp-interframe-delay", PARASITE_PERSISTENT, $us_frame);
$image->parasite_attach(new Parasite "gimp-avi-depth", PARASITE_PERSISTENT, $depth == 16 ? 15 : $depth);
$image->parasite_attach(new Parasite "gimp-avi-compression", PARASITE_PERSISTENT, $compression);
}
},
"00db" => sub {
......
......@@ -4,6 +4,7 @@
use Gimp;
use Gimp::Fu;
use Gimp::UI;
use Fcntl;
# Gimp::set_trace(TRACE_ALL);
......@@ -26,15 +27,20 @@ register "file_miff_save",
"Saves images in the miff (Magick Interchange File Format) format used by the ImageMagick package",
"Marc Lehmann",
"Marc Lehmann <pcg\@goof.com>",
"1999-07-29",
"1999-10-26",
"<Save>/MIFF",
"RGB, RGBA, GRAY", # weird, but no matte for !DirectColour
[],
sub {
my($img,$drawable,$filename) = @_;
my @layers = $img->get_layers;
my($new_img,$new_drawable);
my $export = Gimp::UI::export_image ($new_img=$img, $new_drawable=$drawable, "MIFF",
CAN_HANDLE_GRAY|CAN_HANDLE_RGB|CAN_HANDLE_ALPHA|CAN_HANDLE_LAYERS|CAN_HANDLE_LAYERS_AS_ANIMATION);
die "export failed" if $export == EXPORT_CANCEL;
my @layers = $new_img->get_layers;
sysopen FILE,$filename,O_CREAT|O_TRUNC|O_WRONLY or die "Unable to open '$filename' for writing: $!\n";
my $hdr = eval { $img->find_parasite("gimp-comment")->data };
my $hdr = eval { $img->parasite_find("gimp-comment")->data };
$hdr = " COMMENT: $hdr\n" if $hdr;
$hdr = <<EOF;
id=ImageMagick
......@@ -50,7 +56,7 @@ EOF
for (@layers) {
print FILE $hdr,
"scene=$scene\n",
"class=", $_->color ? "DirectClass" : "PseudoClass", "\n";
"class=", $_->is_rgb ? "DirectClass" : "PseudoClass", "\n";
#"gamma=", Gimp->gamma, "\n";
# resolution etc..
write_layer(*FILE,$_);
......@@ -58,6 +64,7 @@ EOF
update Progress $scene/@layers;
}
close FILE;
$new_img->delete if $export == EXPORT_EXPORT;
();
};
......@@ -155,7 +162,7 @@ register "file_miff_load",
if ($comment) {
$comment =~ s/^\s+//s;
$comment =~ s/\s+$//s;
$img->attach_parasite (new Parasite "gimp-comment", PARASITE_PERSISTENT, $comment);
$img->parasite_attach (new Parasite "gimp-comment", PARASITE_PERSISTENT, $comment);
}
# resolution etc..
......
......@@ -52,6 +52,7 @@ specify a translation id, can be one of (run scm2scm without arguments
to see the full list)
I<api1> api-mega-break-patch #1
I<api2> api-mega-rename-patch #1 (NYI)
I<1.1> 1.0 -> 1.1 (not fully implemented)
......@@ -101,6 +102,8 @@ sub plug_in_constant {
"gimp-selection-load|gimp-shear|gimp-threshold)\$",
\&drop_1st
]],
'api2' => [[
]],
'1.1' => ['nice','api1'],
'1.2' => ['nice','api1'],
'nice'=> [],#["^(plug-in-|file-|gimp-file-)", \&plug_in_constant]],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment