-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsxize.cpp
More file actions
98 lines (77 loc) · 2.49 KB
/
Copy pathmsxize.cpp
File metadata and controls
98 lines (77 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
The Gimp plug-in for msx-ize pictures.
(c) Weber Estevan Roder Kai, 2019
Built up from the zx-ize plug-in by Juan-Antonio Fernández-Madrigal
(http://jafma.net/software/zxscreen/)
(c) Juan-Antonio Fernández-Madrigal, 2011
"jafmag" (remove quotes) at gmail.
Built up from the example blur plug-in by David Neary
(http://developer.gimp.org/writing-a-plug-in/1/index.html)
Built up from the C++ ColorSpace Library by Berendea Nicolae
(https://github.com/berendeanicolae/ColorSpace)
To install the plug-in in the ~/.gimp-2.x/plug-ins , close The Gimp and write in console:
CC=g++ LIBS="-lm" CFLAGS="-std=c++11 -O3 -omsxize" gimptool-2.0 --install "ColorSpace.cpp Comparison.cpp Conversion.cpp objgimp.cpp objmsx.cpp msxize.cpp"
If there is any package missing (typically libgimp-dev), you will be warned at that call.
*/
#include "msxize.h"
/* --------------------- GIMP CODE ------------------------ */
static void query(void);
static void run(const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals);
GimpPlugInInfo PLUG_IN_INFO={
NULL,
NULL,
query,
run
};
MAIN()
static void query(void) {
static GimpParamDef args[]={
{GIMP_PDB_INT32, (char*) "run-mode", (char*) "Run mode"},
{GIMP_PDB_IMAGE, (char*) "image", (char*) "Input image"},
{GIMP_PDB_DRAWABLE, (char*) "drawable", (char*) "Input drawable"}
};
gimp_install_procedure(
"plug-in-msxize",
"MSXize",
"Converts the image to the MSX appearance",
"Weber Estevan Roder Kai",
"Copyright Weber Estevan Roder Kai",
"2019",
"_MSXize",
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS(args),
0,
args,
NULL
);
gimp_plugin_menu_register(
"plug-in-msxize",
"<Image>/Filters/MSXize"
);
}
static void run(const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) {
static GimpParam values[1];
GimpRunMode run_mode;
GimpDrawable *drawable;
/* Getting run_mode */
run_mode=(GimpRunMode) param[0].data.d_int32;
/* Get the specified drawable */
drawable=gimp_drawable_get(param[2].data.d_drawable);
/* Set status text */
gimp_progress_init("MSXize...");
/* Do the work */
MSXConvert msxconvert;
ObjGimp objGimp;
objGimp.Convert(drawable, msxconvert);
/* Unset status text */
gimp_progress_end();
/* Setting mandatory output values */
*nreturn_vals=1;
*return_vals=values;
values[0].type=GIMP_PDB_STATUS;
values[0].data.d_status=GIMP_PDB_SUCCESS;
/* Dump the result back */
gimp_displays_flush();
gimp_drawable_detach(drawable);
}