Bearsampp
2026.7.11
Toggle main menu visibility
Loading...
Searching...
No Matches
freeimage.inc.php
Go to the documentation of this file.
1
<?php
2
3
/*******************************************************************************
4
5
WINBINDER - The native Windows binding for PHP for PHP
6
7
Copyright Hypervisual - see LICENSE.TXT for details
8
Author: Rubem Pechansky (https://github.com/crispy-computing-machine/Winbinder)
9
10
Some functions to call the FreeImage library directly
11
12
*******************************************************************************/
13
14
/*
15
16
This software uses the FreeImage open source image library. See
17
http://freeimage.sourceforge.net for details. FreeImage is used under the
18
FIPL version 1.0.
19
20
Go to the FreeImage web site (http://freeimage.sourceforge.net) to download
21
the FreeImage DLL and documentation.
22
23
These functions were successfully tested with the following FreeImage versions:
24
25
2.3.1 (600 kB, 260 kB zipped)
26
2.5.4 (670 kB, 290 kB zipped)
27
3.4.0 (744 kB, 350 kB zipped)
28
3.5.3 (888 kB, 413 kB zipped)
29
30
*/
31
32
//-------------------------------------------------------------------- CONSTANTS
33
34
// These were taken from FreeImage.h (version 3.5.3)
35
36
define(
"FIF_UNKNOWN"
, -1);
37
define(
"FIF_BMP"
, 0);
38
define(
"FIF_ICO"
, 1);
39
define(
"FIF_JPEG"
, 2);
40
define(
"FIF_JNG"
, 3);
41
define(
"FIF_KOALA"
, 4);
42
define(
"FIF_LBM"
, 5);
43
define(
"FIF_IFF"
,
FIF_LBM
);
44
define(
"FIF_MNG"
, 6);
45
define(
"FIF_PBM"
, 7);
46
define(
"FIF_PBMRAW"
, 8);
47
define(
"FIF_PCD"
, 9);
48
define(
"FIF_PCX"
, 10);
49
define(
"FIF_PGM"
, 11);
50
define(
"FIF_PGMRAW"
, 12);
51
define(
"FIF_PNG"
, 13);
52
define(
"FIF_PPM"
, 14);
53
define(
"FIF_PPMRAW"
, 15);
54
define(
"FIF_RAS"
, 16);
55
define(
"FIF_TARGA"
, 17);
56
define(
"FIF_TIFF"
, 18);
57
define(
"FIF_WBMP"
, 19);
58
define(
"FIF_PSD"
, 20);
59
define(
"FIF_CUT"
, 21);
60
define(
"FIF_XBM"
, 22);
61
define(
"FIF_XPM"
, 23);
62
define(
"FIF_DDS"
, 24);
63
define(
"FIF_GIF"
, 25);
64
65
//------------------------------------------------------------- GLOBAL VARIABLES
66
67
if
(!isset($FI)) {
68
$FI = wb_load_library(
"ext\\freeimage"
);
69
if
(!$FI) {
70
wb_message_box(
null
,
"FreeImage extension could not be loaded."
,
"Error"
, WBC_STOP);
71
die();
72
}
73
}
74
//-------------------------------------------------------------------- FUNCTIONS
75
76
function
FreeImage_GetVersion
()
77
{
78
global $FI;
79
static
$pfn =
null
;
80
81
if
($pfn ===
null
)
82
$pfn = wb_get_function_address(
"FreeImage_GetVersion"
, $FI);
83
84
// Must use wb_peek because this function returns a string pointer
85
86
$version = wb_peek(wb_call_function($pfn));
87
return
$version;
88
}
89
90
function
FreeImage_GetInfoHeader
($dib)
91
{
92
global $FI;
93
static
$pfn =
null
;
94
95
if
($pfn ===
null
)
96
$pfn = wb_get_function_address(
"FreeImage_GetInfoHeader"
, $FI);
97
return
wb_call_function($pfn, array($dib));
98
}
99
100
function
FreeImage_GetBits
($dib)
101
{
102
global $FI;
103
static
$pfn =
null
;
104
105
if
($pfn ===
null
)
106
$pfn = wb_get_function_address(
"FreeImage_GetBits"
, $FI);
107
return
wb_call_function($pfn, array($dib));
108
}
109
110
function
FreeImage_Allocate
($width, $height, $bpp)
111
{
112
global $FI;
113
static
$pfn =
null
;
114
115
if
($pfn ===
null
)
116
$pfn = wb_get_function_address(
"FreeImage_Allocate@24"
, $FI);
117
return
wb_call_function($pfn, array($width, $height, $bpp, 0, 0, 0));
118
}
119
120
function
FreeImage_Unload
($bmp)
121
{
122
global $FI;
123
static
$pfn =
null
;
124
125
if
($pfn ===
null
)
126
$pfn = wb_get_function_address(
"FreeImage_Unload"
, $FI);
127
return
wb_call_function($pfn, array($bmp));
128
}
129
130
function
FreeImage_GetWidth
($bmp)
131
{
132
global $FI;
133
static
$pfn =
null
;
134
135
if
($pfn ===
null
)
136
$pfn = wb_get_function_address(
"FreeImage_GetWidth"
, $FI);
137
return
wb_call_function($pfn, array($bmp));
138
}
139
140
function
FreeImage_GetHeight
($bmp)
141
{
142
global $FI;
143
static
$pfn =
null
;
144
145
if
($pfn ===
null
)
146
$pfn = wb_get_function_address(
"FreeImage_GetHeight"
, $FI);
147
return
wb_call_function($pfn, array($bmp));
148
}
149
150
function
FreeImage_Load
($type, $filename, $flags=0)
151
{
152
global $FI;
153
static
$pfn =
null
;
154
155
if
($pfn ===
null
)
156
$pfn = wb_get_function_address(
"FreeImage_Load"
, $FI);
157
return
wb_call_function($pfn, array($type, $filename, $flags));
158
}
159
160
function
FreeImage_Save
($type, $dib, $filename, $flags=0)
161
{
162
global $FI;
163
static
$pfn =
null
;
164
165
if
($pfn ===
null
)
166
$pfn = wb_get_function_address(
"FreeImage_Save"
, $FI);
167
return
wb_call_function($pfn, array($type, $dib, $filename, $flags));
168
}
169
170
function
FreeImage_Rescale
($dib, $dst_width, $dst_height, $filter=0)
171
{
172
global $FI;
173
static
$pfn =
null
;
174
175
if
($pfn ===
null
)
176
$pfn = wb_get_function_address(
"FreeImage_Rescale"
, $FI);
177
return
wb_call_function($pfn, array($dib, $dst_width, $dst_height, $filter));
178
}
179
180
//-------------------------------------------------------------------------- END
181
182
?>
183
FreeImage_GetBits
FreeImage_GetBits($dib)
Definition
freeimage.inc.php:100
FIF_LBM
const FIF_LBM
Definition
freeimage.inc.php:42
FreeImage_GetHeight
FreeImage_GetHeight($bmp)
Definition
freeimage.inc.php:140
FreeImage_GetVersion
if(!isset( $FI)) FreeImage_GetVersion()
Definition
freeimage.inc.php:76
FreeImage_Rescale
FreeImage_Rescale($dib, $dst_width, $dst_height, $filter=0)
Definition
freeimage.inc.php:170
FreeImage_Unload
FreeImage_Unload($bmp)
Definition
freeimage.inc.php:120
FreeImage_Save
FreeImage_Save($type, $dib, $filename, $flags=0)
Definition
freeimage.inc.php:160
FreeImage_GetWidth
FreeImage_GetWidth($bmp)
Definition
freeimage.inc.php:130
FreeImage_Load
FreeImage_Load($type, $filename, $flags=0)
Definition
freeimage.inc.php:150
FreeImage_GetInfoHeader
FreeImage_GetInfoHeader($dib)
Definition
freeimage.inc.php:90
FreeImage_Allocate
FreeImage_Allocate($width, $height, $bpp)
Definition
freeimage.inc.php:110
sandbox
core
libs
winbinder
fi
freeimage.inc.php
Generated by
1.17.0