/* GIMP Plugin Preview Widget
* Copyright (C) 1998-1999 Shawn T. Amundson
* Modifications (C) 1999-2003 Ernst Lippe
*
* Some of the checkerboard & image combination code is based of
* code Copyright 1997 (C) Federico Mena Quintero and is used
* here by permission.
*
* This library is free software; you can redistribute it and/or
* modify it 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.
*
* This library 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 library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Version $Id: gimppreview.c,v 1.2 2004/05/13 18:20:48 ernstl Exp $
*/
#ifndef lint
static char vcid[] = "$Id: gimppreview.c,v 1.2 2004/05/13 18:20:48 ernstl Exp $";
#endif /* lint */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include "gimppreview.h"
static void gimp_preview_init (GimpPreview * preview);
static void gimp_preview_class_init (GimpPreviewClass * klass);
static void gimp_preview_plus_callback (GtkWidget * widget, gpointer data);
static void gimp_preview_minus_callback (GtkWidget * widget, gpointer data);
static gint gimp_preview_event (GtkWidget * widget, GdkEvent * event,
gpointer data);
static void gimp_preview_recompute_sizes (GimpPreview * preview,
gdouble newscale);
static void gimp_preview_update_preview (GimpPreview * preview);
static void gimp_preview_image_set_size (GimpPreview * preview, gint width,
gint height);
static void gimp_preview_size_request (GtkWidget * widget,
GtkRequisition * requisition);
static void gimp_preview_size_allocate (GtkWidget * widget,
GtkAllocation * allocation);
static void gimp_preview_forall (GtkContainer * container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
gboolean gimp_preview_update_preview_idle_fun (gpointer data);
void gimp_preview_schedule_update (GimpPreview * preview);
void gimp_preview_realized_signal_handler(GtkWidget *widget, gpointer user_data);
#define PROGRESS_BAR_HEIGHT (10)
#define PREVIEW_SIZE (100)
enum
{
UPDATE_PREVIEW,
PREVIEW_CHANGED,
LAST_SIGNAL
};
#define PREVIEW_SCALE_DEFAULT 5
#define PREVIEW_SCALE_LAST 20
static const gdouble preview_scale[PREVIEW_SCALE_LAST + 1] = {
1 / 6.0, 1 / 5.0, 1 / 4.0,
1 / 3.0, 1 / 2.0, 1.00,
2.00, 3.00, 4.00,
5.00, 6.00, 7.00,
8.00, 9.00, 10.00,
11.00, 12.00, 13.00,
14.00, 15.00, 16.00
};
/* Constants for transparency checkerboard */
/* CHECK_SIZE must be power of 2 */
#define CHECK_SIZE (16)
#define CHECK_DARK ((guchar) (1.3 / 3.0 * 255))
#define CHECK_LIGHT ((guchar) (1.8 / 3.0 * 255))
static guint gimp_preview_signals[LAST_SIGNAL] = { 0 };
/*
* Apps which use a GimpPreview widget should not be accessing the private
* data!
*/
#define PREVIEW_DATA(preview) \
((GimpPreviewData*)(GIMP_PREVIEW (preview)->private_data))
typedef struct
{
gint scale_n;
GtkWidget *label;
GtkWidget *button_minus;
GtkWidget *button_plus;
GtkWidget *resize_box;
GtkWidget *event_box;
gboolean allow_scale;
gboolean in_drag; /* Is true while the preview is dragged */
gint drag_x; /* Mouse x-position when dragging started */
gint drag_y; /* Mouse y-position when dragging started */
gint orig_preview_x; /* Value of preview_x when dragging started */
gint orig_preview_y; /* Value of preview_y when dragging started */
gint current_event_id; /* Is incremented when preview must be redrawn */
gint last_processed_event_id; /* Most recent value of current_event_id for which a redraw was actually executed */
guchar *preview_buffer_na[2]; /* Buffers for storing one row for preview */
GtkWidget *image;
GtkWidget *progress_bar;
}
GimpPreviewData;
/* Convert coordinate in preview space to image coordinates */
#define p2i(preview_coordinate, scale) ((gint)((preview_coordinate) / (scale)))
gint
i2p (gint image_coordinate, gdouble scale)
/* Return maximum preview coordinate p such that
p2i(p, scale) <= image_coordinate < p2i(p + 1,scale) */
{
gint p = (gint) ((image_coordinate + 1) * scale) + 1;
g_assert (p2i (p, scale) > image_coordinate);
while (p2i (p, scale) > image_coordinate)
{
p--;
};
return (p);
}
GType
gimp_preview_get_type (void)
{
static GType preview_type = 0;
if (!preview_type)
{
GTypeInfo preview_info = {
sizeof (GimpPreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_preview_class_init,
(GClassFinalizeFunc) NULL,
(gconstpointer) NULL, /* class_data */
sizeof (GimpPreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_preview_init,
(GTypeValueTable *) NULL /* value_table */
};
preview_type =
g_type_register_static (GTK_TYPE_CONTAINER, "GimpPreview",
&preview_info, 0);
}
return preview_type;
}
/*
* Initialization, which is done when the preview widget is first created
* by GTK's internal mechanisms.
*/
static void
gimp_preview_class_init (GimpPreviewClass * klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
gimp_preview_signals[UPDATE_PREVIEW] =
g_signal_new ("update_preview",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, update_preview),
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
gimp_preview_signals[PREVIEW_CHANGED] =
g_signal_new ("preview_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, preview_changed),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
klass->update_preview = NULL;
klass->preview_changed = NULL;
widget_class->size_request = gimp_preview_size_request;
widget_class->size_allocate = gimp_preview_size_allocate;
container_class->forall = gimp_preview_forall;
}
void
gimp_preview_set_scale_amount(GimpPreview *preview, gdouble scale_amount)
{
/*
* If the caller wants to set the scale amount, let them do so.
* Note that we only choose a scaling that is close to what the user wants,
* but not more than that.
*/
gint j;
if (scale_amount != 0.0)
{
/* Initialize it to the lowest setting, just in case. */
PREVIEW_DATA (preview)->scale_n = 0;
preview->scale = preview_scale[PREVIEW_DATA (preview)->scale_n];
/*
* If the request is larger than our largest value, just use the largest
没有合适的资源?快使用搜索试试~ 我知道了~
refocus
共105个文件
c:42个
h:15个
entries:6个
需积分: 0 7 下载量 57 浏览量
2008-05-13
09:21:55
上传
评论
收藏 198KB RAR 举报
温馨提示
http://sourceforge.net/上找到的gimp的refocus 插件<br><br>Refocus is a plug-in for the Gimp (the GNU Image Manipulation Program). Frequently, when processing images, e.g. scanning photo's or slides, images become slightly blurred. The Refocus Gimp plug-in can be used to "refocus" such images.
资源推荐
资源详情
资源评论
收起资源包目录
refocus (105个子文件)
Makefile.am 6KB
Makefile.am 1KB
Makefile.am 935B
Makefile.am 499B
Makefile.am 476B
AUTHORS 371B
gimppreview.c 52KB
refocus.c 20KB
ilaenv.c 19KB
matrix.c 16KB
conv.c 14KB
dtrsm.c 11KB
dgemm.c 10KB
tilebuf.c 10KB
fmt.c 9KB
prevman.c 8KB
wrtfmt.c 8KB
err.c 6KB
dgetrf.c 6KB
open.c 6KB
wref.c 5KB
dgetrs.c 5KB
dger.c 4KB
dgetf2.c 4KB
dgesv.c 4KB
dlaswp.c 4KB
ieeeck.c 3KB
util.c 3KB
lsame.c 2KB
endfile.c 2KB
test-matrix.c 2KB
fwlapack.c 2KB
dswap.c 2KB
xerbla.c 2KB
dscal.c 1KB
close.c 1KB
idamax.c 1KB
wsfe.c 1KB
dummy-plugin.c 1KB
bdclosure.c 1KB
s_copy.c 1008B
util.c 969B
fmtlib.c 843B
s_stop.c 738B
s_cmp.c 699B
sig_die.c 679B
sfe.c 628B
abort_.c 247B
ChangeLog 132B
COPYING 18KB
Entries 2KB
Entries 1KB
Entries 547B
Entries 428B
Entries 164B
Entries 147B
clapack.h 242KB
gimppreview.h 5KB
f2c.h 5KB
blaswrap.h 4KB
prevman.h 3KB
matrix.h 3KB
tilebuf.h 3KB
fio.h 3KB
fmt.h 2KB
util.h 2KB
conv.h 1KB
bdclosure.h 1KB
fwlapack.h 1KB
refocus.h 1018B
fp.h 693B
webindex.html 4KB
configure.in 5KB
INSTALL 3KB
install-sh 6KB
missing 7KB
mkinstalldirs 768B
NEWS 104B
gui.png 50KB
wilber-refocussed.png 8KB
wilber-unsharp.png 5KB
.indent.pro 11B
README 749B
README 460B
README 153B
README 111B
Repository 20B
Repository 17B
Repository 13B
Repository 13B
Repository 13B
Repository 9B
Root 65B
Root 65B
Root 65B
Root 65B
Root 65B
Root 65B
refocus.types 139B
using-inc.xml 19KB
共 105 条
- 1
- 2
资源评论
wangyun183
- 粉丝: 4
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百五十四阶段 - 4.4.2.152全局变量的作用域-152 -2024.06.04
- 松哥解协议松哥解协议松哥解协议松哥解协议松哥解协议
- 618节日618节日618节日
- tensorflow-gpu-2.9.1-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp39-cp39-win-amd64.whl
- lcd daimalcd daima
- 电影领域-推荐算法-个性化内容-观影决策-电影推荐小程序.zip
- 电气控制PLC考试题库
- 如何使用MATLAB简介
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功