mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 11:11:35 +02:00
Add DevIL 1.7.8.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
#include <IL/IL.h>
|
||||
#include <IL/ILU.h>
|
||||
#include <IL/ILUT.h>
|
||||
#include <mathlink.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int retval;
|
||||
int image;
|
||||
|
||||
ilInit();
|
||||
iluInit();
|
||||
ilutInit();
|
||||
|
||||
ilGenImages(1, &image);
|
||||
ilBindImage(image);
|
||||
ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
|
||||
|
||||
retval = MLMain(argc, argv);
|
||||
|
||||
ilDeleteImages(1, &image);
|
||||
|
||||
ilShutDown(); // Only need to shut down DevIL, not ILU or ILUT
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*int f(int x, int y)
|
||||
{
|
||||
return x+y;
|
||||
}
|
||||
|
||||
|
||||
void bits(int i)
|
||||
{
|
||||
int a[32], k;
|
||||
for(k=0; k<32; k++) {
|
||||
a[k] = i%2;
|
||||
i >>= 1;
|
||||
if (i==0) break;
|
||||
}
|
||||
|
||||
if (k<32) k++;
|
||||
MLPutInteger32List(stdlink, a, k);
|
||||
return;
|
||||
}*/
|
||||
|
||||
int mlLoad(char *Filename)
|
||||
{
|
||||
int ret = ilLoadImage(Filename);
|
||||
if (ilGetInteger(IL_ORIGIN_MODE) != IL_ORIGIN_UPPER_LEFT)
|
||||
iluFlipImage();
|
||||
ilConvertImage(IL_RGBA, IL_DOUBLE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mlWidth(void)
|
||||
{
|
||||
return ilGetInteger(IL_IMAGE_WIDTH);
|
||||
}
|
||||
|
||||
int mlHeight(void)
|
||||
{
|
||||
return ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
}
|
||||
|
||||
void mlData(void)
|
||||
{
|
||||
/*int x, y, c;
|
||||
int *Data;
|
||||
ILubyte *OrigData = ilGetData();
|
||||
|
||||
Data = malloc(ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4 * sizeof(int));
|
||||
for (y = 0; y < ilGetInteger(IL_IMAGE_HEIGHT); y++) {
|
||||
for (x = 0; x < ilGetInteger(IL_IMAGE_WIDTH); x++) {
|
||||
for (c = 0; c < 4; c++) {
|
||||
Data[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c] = OrigData[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MLPutInteger32List(stdlink, Data, ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4);
|
||||
|
||||
free(Data);*/
|
||||
|
||||
MLPutReal64List(stdlink, (ILdouble*)ilGetData(), ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL Mathematica", "DevIL Mathematica.vcproj", "{A73E8E53-2A08-405E-B462-E1541FE3E00F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="DevIL Mathematica"
|
||||
ProjectGUID="{A73E8E53-2A08-405E-B462-E1541FE3E00F}"
|
||||
RootNamespace="DevILMathematica"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ml32i3m.lib devil.lib ilu.lib ilut.lib comdlg32.lib user32.lib advapi32.lib gdi32.lib shell32.lib"
|
||||
OutputFile="DevIL.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ml32i3m.lib devil.lib ilu.lib ilut.lib comdlg32.lib user32.lib advapi32.lib gdi32.lib shell32.lib"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DevIL Interface.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\test.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,142 @@
|
||||
(* Content-type: application/mathematica *)
|
||||
|
||||
(*** Wolfram Notebook File ***)
|
||||
(* http://www.wolfram.com/nb *)
|
||||
|
||||
(* CreatedBy='Mathematica 6.0' *)
|
||||
|
||||
(*CacheID: 234*)
|
||||
(* Internal cache information:
|
||||
NotebookFileLineBreakTest
|
||||
NotebookFileLineBreakTest
|
||||
NotebookDataPosition[ 145, 7]
|
||||
NotebookDataLength[ 4305, 133]
|
||||
NotebookOptionsPosition[ 3741, 109]
|
||||
NotebookOutlinePosition[ 4105, 125]
|
||||
CellTagsIndexPosition[ 4062, 122]
|
||||
WindowFrame->Normal
|
||||
ContainsDynamic->False*)
|
||||
|
||||
(* Beginning of Notebook Content *)
|
||||
Notebook[{
|
||||
Cell[BoxData[
|
||||
RowBox[{"link", " ", "=", " ",
|
||||
RowBox[{
|
||||
"Install", "[", "\"\<E:\\DevIL\\projects\\Mathematica\\devil.exe\>\"",
|
||||
"]"}]}]], "Input",
|
||||
CellChangeTimes->{{3.44382235517484*^9, 3.4438223572684565`*^9}}],
|
||||
|
||||
Cell[BoxData[
|
||||
RowBox[{
|
||||
RowBox[{
|
||||
"Imagename", " ", "=", " ",
|
||||
"\"\<E:\\DevIL\\projects\\Mathematica\\rgb32.tga\>\""}], ";"}]], "Input",
|
||||
CellChangeTimes->{{3.433336425992341*^9, 3.433336437270916*^9}, {
|
||||
3.433336500650648*^9, 3.4333365039531717`*^9}, {3.433336644044791*^9,
|
||||
3.433336644308446*^9}, {3.43333691883775*^9, 3.4333369191961255`*^9}, {
|
||||
3.4438223711542864`*^9, 3.4438223802972555`*^9}, {3.4438224311895065`*^9,
|
||||
3.443822433804573*^9}}],
|
||||
|
||||
Cell[CellGroupData[{
|
||||
|
||||
Cell[BoxData[
|
||||
RowBox[{
|
||||
RowBox[{"If", "[",
|
||||
RowBox[{
|
||||
RowBox[{
|
||||
RowBox[{"mlLoad", "[", "Imagename", "]"}], "\[Equal]", "1"}], ",",
|
||||
"\[IndentingNewLine]",
|
||||
RowBox[{"(",
|
||||
RowBox[{
|
||||
RowBox[{"width", " ", "=", " ",
|
||||
RowBox[{"mlWidth", "[", "1", "]"}]}], ";", "\[IndentingNewLine]",
|
||||
RowBox[{"height", "=",
|
||||
RowBox[{"mlHeight", "[", "1", "]"}]}], ";", "\[IndentingNewLine]",
|
||||
RowBox[{"data", " ", "=", " ",
|
||||
RowBox[{"mlData", "[", "1", "]"}]}], ";", "\[IndentingNewLine]",
|
||||
RowBox[{"r", " ", "=", " ",
|
||||
RowBox[{"Table", "[",
|
||||
RowBox[{
|
||||
RowBox[{"Table", "[",
|
||||
RowBox[{
|
||||
RowBox[{"Table", "[",
|
||||
RowBox[{
|
||||
RowBox[{"data", "[",
|
||||
RowBox[{"[",
|
||||
RowBox[{
|
||||
RowBox[{"y", " ", "*", " ", "width", " ", "*", " ", "4"}],
|
||||
" ", "+", " ",
|
||||
RowBox[{"x", "*", "4"}], " ", "+", " ", "c"}], "]"}], "]"}],
|
||||
",",
|
||||
RowBox[{"{",
|
||||
RowBox[{"c", ",", "4"}], "}"}]}], "]"}], ",",
|
||||
RowBox[{"{",
|
||||
RowBox[{"x", ",", "0", ",",
|
||||
RowBox[{"width", "-", "1"}]}], "}"}]}], "]"}], ",",
|
||||
RowBox[{"{",
|
||||
RowBox[{"y", ",", "0", ",",
|
||||
RowBox[{"height", "-", "1"}]}], "}"}]}], "]"}]}], ";",
|
||||
"\[IndentingNewLine]",
|
||||
RowBox[{"image", " ", "=",
|
||||
RowBox[{"Graphics", "[",
|
||||
RowBox[{"Raster", "[", "r", "]"}], "]"}]}]}], ")"}], ",",
|
||||
"\[IndentingNewLine]",
|
||||
RowBox[{"Print", "[", "\"\<Could not load image.\>\"", "]"}]}], "]"}],
|
||||
";"}]], "Input",
|
||||
CellChangeTimes->{{3.433336299124484*^9, 3.433336308652195*^9}, {
|
||||
3.433336340650147*^9, 3.4333364425606165`*^9}, {3.4333365088102827`*^9,
|
||||
3.4333365154026337`*^9}, {3.433336600067137*^9, 3.4333366264160366`*^9},
|
||||
3.4333370439234943`*^9}],
|
||||
|
||||
Cell[BoxData["\<\"Could not load image.\"\>"], "Print",
|
||||
CellChangeTimes->{3.4438224626357355`*^9, 3.443822636813064*^9}]
|
||||
}, Open ]],
|
||||
|
||||
Cell[BoxData[
|
||||
RowBox[{"Show", "[", "image", "]"}]], "Input",
|
||||
CellChangeTimes->{{3.4333366309743385`*^9, 3.4333366324136996`*^9}}],
|
||||
|
||||
Cell[CellGroupData[{
|
||||
|
||||
Cell[BoxData[
|
||||
RowBox[{"Uninstall", "[", "link", "]"}]], "Input"],
|
||||
|
||||
Cell[BoxData["\<\"\\\"E:\\\\DevIL\\\\projects\\\\Mathematica\\\\devil.exe\\\"\
|
||||
\"\>"], "Output",
|
||||
CellChangeTimes->{3.4438224816530733`*^9, 3.4438226422609577`*^9,
|
||||
3.4438227036476536`*^9}]
|
||||
}, Open ]]
|
||||
},
|
||||
WindowSize->{1161, 898},
|
||||
WindowMargins->{{54, Automatic}, {Automatic, -1}},
|
||||
ShowSelection->True,
|
||||
FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (April 28, 2007)",
|
||||
StyleDefinitions->"Default.nb"
|
||||
]
|
||||
(* End of Notebook Content *)
|
||||
|
||||
(* Internal cache information *)
|
||||
(*CellTagsOutline
|
||||
CellTagsIndex->{}
|
||||
*)
|
||||
(*CellTagsIndex
|
||||
CellTagsIndex->{}
|
||||
*)
|
||||
(*NotebookFileOutline
|
||||
Notebook[{
|
||||
Cell[568, 21, 220, 5, 31, "Input"],
|
||||
Cell[791, 28, 459, 9, 31, "Input"],
|
||||
Cell[CellGroupData[{
|
||||
Cell[1275, 41, 1896, 47, 152, "Input"],
|
||||
Cell[3174, 90, 121, 1, 23, "Print"]
|
||||
}, Open ]],
|
||||
Cell[3310, 94, 131, 2, 31, "Input"],
|
||||
Cell[CellGroupData[{
|
||||
Cell[3466, 100, 65, 1, 31, "Input"],
|
||||
Cell[3534, 103, 191, 3, 30, "Output"]
|
||||
}, Open ]]
|
||||
}
|
||||
]
|
||||
*)
|
||||
|
||||
(* End of internal cache information *)
|
||||
Reference in New Issue
Block a user