Commit ebd4d61e authored by Maurits Rijk's avatar Maurits Rijk
Browse files

HIGified, GPL license added isome plug-ins, minor code clean-up.

parent 227053c5
2004-05-09 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/aa.c
* plug-ins/common/apply_lens.c
* plug-ins/common/autocrop.c
* plug-ins/common/autostretch_hsv.c: HIGified, GPL license added in
some plug-ins, minor code clean-up.
2004-05-08 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/spread.c: HIGified, simplified and fixes #141733
......
......@@ -8,12 +8,27 @@
* Tim Newsome <nuisance@cmu.edu>
*/
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <aalib.h>
#include <gtk/gtk.h>
......@@ -324,10 +339,6 @@ gimp2aa (gint32 drawable_ID,
aa_scrwidth (context), aa_scrheight (context));
}
/*
* User Interface dialog thingie.
*/
static gint
type_dialog (gint selected)
{
......@@ -348,8 +359,8 @@ type_dialog (gint selected)
NULL);
/* file save type */
frame = gtk_frame_new (_("Data Formatting"));
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
frame = gimp_frame_new (_("Data Formatting"));
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->vbox), frame, TRUE, TRUE, 0);
toggle_vbox = gtk_vbox_new (FALSE, 2);
......@@ -393,10 +404,6 @@ type_dialog (gint selected)
return selected_type;
}
/*
* Callbacks for the dialog.
*/
static void
type_dialog_toggle_update (GtkWidget *widget,
gpointer data)
......
......@@ -23,13 +23,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Version 0.1:
*
* First release. No known serious bugs, and basically does what you want.
* All fancy features postponed until the next release, though. :)
*
*/
/*
TO DO:
- antialiasing
......@@ -47,9 +40,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
......@@ -211,26 +201,24 @@ find_projected_pos (gfloat a2,
gfloat *projx,
gfloat *projy)
{
gfloat n[3];
gfloat z;
gfloat nxangle, nyangle, theta1, theta2;
gfloat ri1 = 1.0;
gfloat ri2 = lvals.refraction;
n[0] = x;
n[1] = y;
n[2] = sqrt ((1 - x * x / a2 - y * y / b2) * c2);
z = sqrt ((1 - x * x / a2 - y * y / b2) * c2);
nxangle = acos (n[0] / sqrt(n[0] * n[0] + n[2] * n[2]));
nxangle = acos (x / sqrt(x * x + z * z));
theta1 = G_PI / 2 - nxangle;
theta2 = asin (sin (theta1) * ri1 / ri2);
theta2 = G_PI / 2 - nxangle - theta2;
*projx = x - tan (theta2) * n[2];
*projx = x - tan (theta2) * z;
nyangle = acos (n[1]/sqrt (n[1] * n[1] + n[2] * n[2]));
nyangle = acos (y / sqrt (y * y + z * z));
theta1 = G_PI / 2 - nyangle;
theta2 = asin (sin (theta1) * ri1 / ri2);
theta2 = G_PI / 2 - nyangle - theta2;
*projy = y - tan (theta2) * n[2];
*projy = y - tan (theta2) * z;
}
static void
......@@ -350,7 +338,7 @@ drawlens (GimpDrawable *drawable)
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
gimp_drawable_update (drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
}
static gint
......@@ -359,9 +347,7 @@ lens_dialog (GimpDrawable *drawable)
GtkWidget *dlg;
GtkWidget *label;
GtkWidget *toggle;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *sep;
GtkWidget *hbox;
GtkWidget *spinbutton;
GtkObject *adj;
......@@ -378,14 +364,9 @@ lens_dialog (GimpDrawable *drawable)
NULL);
frame = gtk_frame_new (_("Parameter Settings"));
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
toggle = gtk_radio_button_new_with_mnemonic_from_widget
......@@ -425,10 +406,6 @@ lens_dialog (GimpDrawable *drawable)
&lvals.set_transparent);
}
sep = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 2);
gtk_widget_show (sep);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
......
/*
* Autocrop plug-in version 1.00
* by Tim Newsome <drz@froody.bloke.com>
* thanks to quartic for finding a nasty bug for me
*/
/* 1999/04/09 -- Sven Neumann <sven@gimp.org>
* Fixed bad crash that occured when running on an entirely blank image.
* Cleaned up the code a bit, while I was at it.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <libgimp/gimp.h>
......@@ -29,9 +38,9 @@ static void run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals);
static gint colors_equal (guchar *col1,
guchar *col2,
gint bytes);
static gboolean colors_equal (const guchar *col1,
const guchar *col2,
gint bytes);
static gint guess_bgcolor (GimpPixelRgn *pr,
gint width,
gint height,
......@@ -312,26 +321,26 @@ guess_bgcolor (GimpPixelRgn *pr,
}
}
static gint
colors_equal (guchar *col1,
guchar *col2,
gint bytes)
static gboolean
colors_equal (const guchar *col1,
const guchar *col2,
gint bytes)
{
gint equal = 1;
gboolean equal = TRUE;
gint b;
if ((bytes == 2 || bytes == 4) && /* HACK! */
col1[bytes-1] == 0 &&
col2[bytes-1] == 0)
{
return 1; /* handle zero alpha */
return TRUE; /* handle zero alpha */
}
for (b = 0; b < bytes; b++)
{
if (col1[b] != col2[b])
{
equal = 0;
equal = FALSE;
break;
}
}
......
......@@ -5,7 +5,6 @@
* Copyright (C) 1996 Federico Mena Quintero
*
* You can contact me at scott@poverty.bloomington.in.us
* You can contact the original The Gimp authors at gimp@xcf.berkeley.edu
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -22,18 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* This simple plug-in does an automatic contrast stretch. For each
channel in the image, it finds the minimum and maximum values... it
uses those values to stretch the individual histograms to the full
contrast range. For some images it may do just what you want; for
others it may be total crap :) This version operates in HSV space
and preserves hue, unlike the original Contrast Autostretch. */
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <libgimp/gimp.h>
#include "libgimp/stdplugins-intl.h"
......@@ -190,18 +179,18 @@ autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
}
static void
indexed_autostretch_hsv (gint32 image_ID) /* a.d.m. */
indexed_autostretch_hsv (gint32 image_ID)
{
guchar *cmap;
AutostretchData data = {0.0, 1.0, 0.0, 1.0};
gint ncols,i;
gint ncols, i;
cmap = gimp_image_get_cmap (image_ID, &ncols);
if (cmap==NULL)
if (!cmap)
{
fprintf(stderr, "autostretch_hsv: cmap was NULL! Quitting...\n");
gimp_quit();
g_message (_("autostretch_hsv: cmap was NULL! Quitting...\n"));
gimp_quit ();
}
for (i = 0; i < ncols; i++)
......
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