-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfile-rgb-565.c
98 lines (85 loc) · 2.5 KB
/
file-rgb-565.c
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
/* Copyright (C) 2011 Marcel Tunnissen
*
* This file implements a GIMP plugin for load raw images in a RGB 565 format
*
* License: GNU Public License version 2
*
* 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,
* check at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or write to the Free Software Foundation,
*/
#include <string.h>
#include <libgimp/gimp.h>
#include "file-raw-load.h"
static void query_565(void);
static void run_565(
const gchar* name,
gint nparams,
const GimpParam* param,
gint* nreturn_vals,
GimpParam** return_vals
);
GimpPlugInInfo PLUG_IN_INFO =
{
.init_proc = NULL,
.quit_proc = NULL,
.query_proc = query_565,
.run_proc = run_565
};
MAIN()
static GimpParamDef args[] =
{
{GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive"},
{GIMP_PDB_STRING, "filename", "The name of the file to load"},
{GIMP_PDB_STRING, "raw_filename", "The name of the file to load"},
};
static int nr_args = G_N_ELEMENTS(args);
static GimpParamDef results[] =
{
{GIMP_PDB_IMAGE, "image", "Loaded image" },
};
static int nr_results = G_N_ELEMENTS(results);
#define PLUGIN_VERSION "2011-03-24"
#define PLUGIN_NAME "raw_file_rgb565_load"
static struct raw_data Image_input_data = {
.size = {640, 480},
};
static void query_565(void)
{
gimp_install_procedure(
PLUGIN_NAME,
"raw file RGB-565 load",
"Load raw file in RGB 556 format",
"Marcel Tunnissen",
"Copyright Marcel Tunnissen",
PLUGIN_VERSION,
"<Load>/RGB565",
NULL,
GIMP_PLUGIN,
nr_args, nr_results, args, results
);
gimp_register_load_handler(PLUGIN_NAME, "RGB-565, 565", "");
}
static void run_565(
const gchar* name,
gint nparams,
const GimpParam* param,
gint* nreturn_vals,
GimpParam** return_vals
) {
if (strcmp(name, PLUGIN_NAME) == 0) {
run(name, nparams, param, nreturn_vals, return_vals, RGB_565,
&Image_input_data);
}
}