git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2926 92316355-f0b4-4df1-b90c-862c8a59935fremotes/tiles
@@ -0,0 +1,33 @@ | |||||
// | |||||
// The Pimp The Pathetic Image Manipulation Program | |||||
// Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org> | |||||
// All Rights Reserved | |||||
// | |||||
// $Id$ | |||||
// | |||||
// This library is free software. It comes without any warranty, to | |||||
// the extent permitted by applicable law. You can redistribute it | |||||
// and/or modify it under the terms of the Do What The Fuck You Want | |||||
// To Public License, Version 2, as published by Sam Hocevar. See | |||||
// http://sam.zoy.org/wtfpl/COPYING for more details. | |||||
// | |||||
using System; | |||||
namespace ThePimp | |||||
{ | |||||
public partial class ErrorWindow : Gtk.Dialog | |||||
{ | |||||
public ErrorWindow(string message) | |||||
{ | |||||
this.Build(); | |||||
this.message.Text = message; | |||||
this.Run(); | |||||
} | |||||
protected virtual void OnButtonOkClicked (object sender, System.EventArgs e) | |||||
{ | |||||
this.Destroy(); | |||||
} | |||||
} | |||||
} |
@@ -14,6 +14,7 @@ | |||||
using System; | using System; | ||||
using Gtk; | using Gtk; | ||||
using Pipi; | |||||
namespace ThePimp | namespace ThePimp | ||||
{ | { | ||||
@@ -21,6 +22,8 @@ namespace ThePimp | |||||
{ | { | ||||
public static void Main (string[] args) | public static void Main (string[] args) | ||||
{ | { | ||||
Libpipi.getVersion(); | |||||
Application.Init (); | Application.Init (); | ||||
MainWindow win = new MainWindow (); | MainWindow win = new MainWindow (); | ||||
win.Show (); | win.Show (); | ||||
@@ -24,7 +24,6 @@ namespace ThePimp | |||||
public MainWindow (): base (Gtk.WindowType.Toplevel) | public MainWindow (): base (Gtk.WindowType.Toplevel) | ||||
{ | { | ||||
Build (); | Build (); | ||||
Title += " v" + Libpipi.getVersion(); | |||||
vpaned1.Add1(new ToolBox()); | vpaned1.Add1(new ToolBox()); | ||||
} | } | ||||
@@ -36,32 +35,48 @@ namespace ThePimp | |||||
protected virtual void OnOpenActionActivated (object sender, System.EventArgs e) | protected virtual void OnOpenActionActivated (object sender, System.EventArgs e) | ||||
{ | { | ||||
OpenFile open = new OpenFile(); | |||||
Pipi.Picture p = open.Load(); | |||||
open.Destroy(); | |||||
if(p != null) | |||||
OpenFile dialog = new OpenFile(); | |||||
string s = dialog.GetChoice(); | |||||
dialog.Destroy(); | |||||
if(s == null) | |||||
return; | |||||
Pipi.Picture p = Pipi.Picture.Load(s); | |||||
if(p == null) | |||||
{ | { | ||||
while(notebook1.NPages > 0) | |||||
notebook1.RemovePage(0); | |||||
int n = notebook1.AppendPage(new PictureView(p), | |||||
new Label(p.FileName)); | |||||
notebook1.Page = n; | |||||
new ErrorWindow("Could not open \"" + s + "\". Check the file format."); | |||||
return; | |||||
} | } | ||||
while(notebook1.NPages > 0) | |||||
notebook1.RemovePage(0); | |||||
int n = notebook1.AppendPage(new PictureView(p), | |||||
new Label(p.FileName)); | |||||
notebook1.Page = n; | |||||
} | } | ||||
protected virtual void OnNewActionActivated (object sender, System.EventArgs e) | protected virtual void OnNewActionActivated (object sender, System.EventArgs e) | ||||
{ | { | ||||
NewFile dialog = new NewFile(); | NewFile dialog = new NewFile(); | ||||
Pipi.Picture p = dialog.New(); | |||||
string s = dialog.GetChoice(); | |||||
dialog.Destroy(); | dialog.Destroy(); | ||||
if(p != null) | |||||
if(s == null) | |||||
return; | |||||
Pipi.Picture p = Pipi.Picture.Load(s); | |||||
if(p == null) | |||||
{ | { | ||||
while(notebook1.NPages > 0) | |||||
notebook1.RemovePage(0); | |||||
int n = notebook1.AppendPage(new PictureView(p), | |||||
new Label(p.FileName)); | |||||
notebook1.Page = n; | |||||
new ErrorWindow("Could not create image."); | |||||
return; | |||||
} | } | ||||
while(notebook1.NPages > 0) | |||||
notebook1.RemovePage(0); | |||||
int n = notebook1.AppendPage(new PictureView(p), | |||||
new Label(p.FileName)); | |||||
notebook1.Page = n; | |||||
} | } | ||||
protected virtual void OnQuitActionActivated (object sender, System.EventArgs e) | protected virtual void OnQuitActionActivated (object sender, System.EventArgs e) | ||||
@@ -4,6 +4,7 @@ pimp_sources = \ | |||||
AssemblyInfo.cs \ | AssemblyInfo.cs \ | ||||
Main.cs \ | Main.cs \ | ||||
AboutWindow.cs \ | AboutWindow.cs \ | ||||
ErrorWindow.cs \ | |||||
MainWindow.cs \ | MainWindow.cs \ | ||||
OpenFile.cs \ | OpenFile.cs \ | ||||
NewFile.cs \ | NewFile.cs \ | ||||
@@ -12,6 +13,7 @@ pimp_sources = \ | |||||
ToolBox.cs \ | ToolBox.cs \ | ||||
gtk-gui/generated.cs \ | gtk-gui/generated.cs \ | ||||
gtk-gui/ThePimp.AboutWindow.cs \ | gtk-gui/ThePimp.AboutWindow.cs \ | ||||
gtk-gui/ThePimp.ErrorWindow.cs \ | |||||
gtk-gui/ThePimp.MainWindow.cs \ | gtk-gui/ThePimp.MainWindow.cs \ | ||||
gtk-gui/ThePimp.OpenFile.cs \ | gtk-gui/ThePimp.OpenFile.cs \ | ||||
gtk-gui/ThePimp.NewFile.cs \ | gtk-gui/ThePimp.NewFile.cs \ | ||||
@@ -24,7 +24,7 @@ namespace ThePimp | |||||
this.Build(); | this.Build(); | ||||
} | } | ||||
public Pipi.Picture New() | |||||
public string GetChoice() | |||||
{ | { | ||||
ResponseType rsp = (ResponseType)Run(); | ResponseType rsp = (ResponseType)Run(); | ||||
Hide(); | Hide(); | ||||
@@ -42,8 +42,7 @@ namespace ThePimp | |||||
break; | break; | ||||
} | } | ||||
Pipi.Picture p = new Pipi.Picture(type + ":" + entry1.Text + "x" + entry2.Text); | |||||
return p; | |||||
return type + ":" + entry1.Text + "x" + entry2.Text; | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -23,15 +23,15 @@ namespace ThePimp | |||||
{ | { | ||||
this.Build(); | this.Build(); | ||||
} | } | ||||
public Pipi.Picture Load() | |||||
public string GetChoice() | |||||
{ | { | ||||
ResponseType rsp = (ResponseType)Run(); | ResponseType rsp = (ResponseType)Run(); | ||||
Hide(); | Hide(); | ||||
if(rsp != ResponseType.Ok) | if(rsp != ResponseType.Ok) | ||||
return null; | return null; | ||||
Pipi.Picture p = new Pipi.Picture(filechooserwidget1.Filename); | |||||
return p; | |||||
return filechooserwidget1.Filename; | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -14,7 +14,7 @@ | |||||
<DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> | ||||
<DebugType>full</DebugType> | <DebugType>full</DebugType> | ||||
<Optimize>false</Optimize> | <Optimize>false</Optimize> | ||||
<OutputPath>.\bin</OutputPath> | |||||
<OutputPath>bin\</OutputPath> | |||||
<DefineConstants>DEBUG;TRACE</DefineConstants> | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||||
<ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
<WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
@@ -27,7 +27,7 @@ | |||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
<DebugType>pdbonly</DebugType> | <DebugType>pdbonly</DebugType> | ||||
<Optimize>true</Optimize> | <Optimize>true</Optimize> | ||||
<OutputPath>.\bin</OutputPath> | |||||
<OutputPath>bin\</OutputPath> | |||||
<DefineConstants>TRACE</DefineConstants> | <DefineConstants>TRACE</DefineConstants> | ||||
<ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
<WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
@@ -92,6 +92,8 @@ | |||||
<Compile Include="gtk-gui\ThePimp.PictureView.cs" /> | <Compile Include="gtk-gui\ThePimp.PictureView.cs" /> | ||||
<Compile Include="gtk-gui\ThePimp.SaveFile.cs" /> | <Compile Include="gtk-gui\ThePimp.SaveFile.cs" /> | ||||
<Compile Include="gtk-gui\ThePimp.ToolBox.cs" /> | <Compile Include="gtk-gui\ThePimp.ToolBox.cs" /> | ||||
<Compile Include="ErrorWindow.cs" /> | |||||
<Compile Include="gtk-gui\ThePimp.ErrorWindow.cs" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\pipi-sharp\pipi-sharp.csproj"> | <ProjectReference Include="..\pipi-sharp\pipi-sharp.csproj"> | ||||
@@ -100,9 +102,9 @@ | |||||
</ProjectReference> | </ProjectReference> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<EmbeddedResource Include="gtk-gui\gui.stetic" /> | |||||
<EmbeddedResource Include="images\about.png" /> | <EmbeddedResource Include="images\about.png" /> | ||||
<EmbeddedResource Include="gtk-gui\objects.xml" /> | <EmbeddedResource Include="gtk-gui\objects.xml" /> | ||||
<EmbeddedResource Include="gtk-gui\gui.stetic" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||||
@@ -116,4 +118,10 @@ | |||||
</Target> | </Target> | ||||
<Target Name="AfterBuild"> | <Target Name="AfterBuild"> | ||||
</Target> | </Target> | ||||
</Project> | |||||
<GtkDesignInfo gtkVersion="2.12.1"> | |||||
<ExportedWidgets> | |||||
<Widget>ThePimp.PictureView</Widget> | |||||
<Widget>ThePimp.ToolBox</Widget> | |||||
</ExportedWidgets> | |||||
</GtkDesignInfo> | |||||
</Project> |
@@ -43,6 +43,7 @@ | |||||
<File name="gtk-gui/ThePimp.AboutWindow.cs" subtype="Code" buildaction="Compile" /> | <File name="gtk-gui/ThePimp.AboutWindow.cs" subtype="Code" buildaction="Compile" /> | ||||
<File name="NewFile.cs" subtype="Code" buildaction="Compile" /> | <File name="NewFile.cs" subtype="Code" buildaction="Compile" /> | ||||
<File name="gtk-gui/ThePimp.NewFile.cs" subtype="Code" buildaction="Compile" /> | <File name="gtk-gui/ThePimp.NewFile.cs" subtype="Code" buildaction="Compile" /> | ||||
<File name="gtk-gui/ThePimp.ErrorWindow.cs" subtype="Code" buildaction="Compile" /> | |||||
</Contents> | </Contents> | ||||
<References> | <References> | ||||
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||||
@@ -61,4 +62,4 @@ | |||||
<Widget>ThePimp.ToolBox</Widget> | <Widget>ThePimp.ToolBox</Widget> | ||||
</ExportedWidgets> | </ExportedWidgets> | ||||
</GtkDesignInfo> | </GtkDesignInfo> | ||||
</Project> | |||||
</Project> |
@@ -0,0 +1,89 @@ | |||||
// ------------------------------------------------------------------------------ | |||||
// <autogenerated> | |||||
// This code was generated by a tool. | |||||
// Mono Runtime Version: 2.0.50727.42 | |||||
// | |||||
// Changes to this file may cause incorrect behavior and will be lost if | |||||
// the code is regenerated. | |||||
// </autogenerated> | |||||
// ------------------------------------------------------------------------------ | |||||
namespace ThePimp { | |||||
public partial class ErrorWindow { | |||||
private Gtk.HBox hbox1; | |||||
private Gtk.Image image1; | |||||
private Gtk.Label message; | |||||
private Gtk.Button buttonOk; | |||||
protected virtual void Build() { | |||||
Stetic.Gui.Initialize(this); | |||||
// Widget ThePimp.ErrorWindow | |||||
this.Name = "ThePimp.ErrorWindow"; | |||||
this.Title = Mono.Unix.Catalog.GetString("Error"); | |||||
this.Icon = Stetic.IconLoader.LoadIcon(this, "gtk-dialog-error", Gtk.IconSize.Menu, 16); | |||||
this.WindowPosition = ((Gtk.WindowPosition)(4)); | |||||
this.HasSeparator = false; | |||||
// Internal child ThePimp.ErrorWindow.VBox | |||||
Gtk.VBox w1 = this.VBox; | |||||
w1.Name = "dialog1_VBox"; | |||||
w1.BorderWidth = ((uint)(2)); | |||||
// Container child dialog1_VBox.Gtk.Box+BoxChild | |||||
this.hbox1 = new Gtk.HBox(); | |||||
this.hbox1.Name = "hbox1"; | |||||
this.hbox1.Spacing = 20; | |||||
this.hbox1.BorderWidth = ((uint)(10)); | |||||
// Container child hbox1.Gtk.Box+BoxChild | |||||
this.image1 = new Gtk.Image(); | |||||
this.image1.Name = "image1"; | |||||
this.image1.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-dialog-error", Gtk.IconSize.Dialog, 48); | |||||
this.hbox1.Add(this.image1); | |||||
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.image1])); | |||||
w2.Position = 0; | |||||
w2.Expand = false; | |||||
w2.Fill = false; | |||||
// Container child hbox1.Gtk.Box+BoxChild | |||||
this.message = new Gtk.Label(); | |||||
this.message.Name = "message"; | |||||
this.message.LabelProp = Mono.Unix.Catalog.GetString("Error!"); | |||||
this.message.Wrap = true; | |||||
this.hbox1.Add(this.message); | |||||
Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.message])); | |||||
w3.Position = 1; | |||||
w3.Expand = false; | |||||
w1.Add(this.hbox1); | |||||
Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(w1[this.hbox1])); | |||||
w4.Position = 0; | |||||
w4.Fill = false; | |||||
// Internal child ThePimp.ErrorWindow.ActionArea | |||||
Gtk.HButtonBox w5 = this.ActionArea; | |||||
w5.Name = "dialog1_ActionArea"; | |||||
w5.Spacing = 6; | |||||
w5.BorderWidth = ((uint)(5)); | |||||
w5.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); | |||||
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild | |||||
this.buttonOk = new Gtk.Button(); | |||||
this.buttonOk.CanDefault = true; | |||||
this.buttonOk.CanFocus = true; | |||||
this.buttonOk.Name = "buttonOk"; | |||||
this.buttonOk.UseStock = true; | |||||
this.buttonOk.UseUnderline = true; | |||||
this.buttonOk.Label = "gtk-ok"; | |||||
this.AddActionWidget(this.buttonOk, -5); | |||||
Gtk.ButtonBox.ButtonBoxChild w6 = ((Gtk.ButtonBox.ButtonBoxChild)(w5[this.buttonOk])); | |||||
w6.Expand = false; | |||||
w6.Fill = false; | |||||
if ((this.Child != null)) { | |||||
this.Child.ShowAll(); | |||||
} | |||||
this.DefaultWidth = 229; | |||||
this.DefaultHeight = 133; | |||||
this.Show(); | |||||
} | |||||
} | |||||
} |
@@ -797,6 +797,7 @@ Bayer Dithering Pattern</property> | |||||
<property name="Text" translatable="yes">1024</property> | <property name="Text" translatable="yes">1024</property> | ||||
<property name="IsEditable">True</property> | <property name="IsEditable">True</property> | ||||
<property name="WidthChars">6</property> | <property name="WidthChars">6</property> | ||||
<property name="InvisibleChar">●</property> | |||||
<property name="Xalign">1</property> | <property name="Xalign">1</property> | ||||
</widget> | </widget> | ||||
<packing> | <packing> | ||||
@@ -820,6 +821,7 @@ Bayer Dithering Pattern</property> | |||||
<property name="Text" translatable="yes">768</property> | <property name="Text" translatable="yes">768</property> | ||||
<property name="IsEditable">True</property> | <property name="IsEditable">True</property> | ||||
<property name="WidthChars">6</property> | <property name="WidthChars">6</property> | ||||
<property name="InvisibleChar">●</property> | |||||
<property name="Xalign">1</property> | <property name="Xalign">1</property> | ||||
</widget> | </widget> | ||||
<packing> | <packing> | ||||
@@ -977,4 +979,81 @@ Bayer Dithering Pattern</property> | |||||
</widget> | </widget> | ||||
</child> | </child> | ||||
</widget> | </widget> | ||||
<widget class="Gtk.Dialog" id="ThePimp.ErrorWindow" design-size="229 133"> | |||||
<property name="MemberName" /> | |||||
<property name="Title" translatable="yes">Error</property> | |||||
<property name="Icon">stock:gtk-dialog-error Menu</property> | |||||
<property name="WindowPosition">CenterOnParent</property> | |||||
<property name="Buttons">1</property> | |||||
<property name="HelpButton">False</property> | |||||
<property name="HasSeparator">False</property> | |||||
<child internal-child="VBox"> | |||||
<widget class="Gtk.VBox" id="dialog1_VBox"> | |||||
<property name="MemberName" /> | |||||
<property name="BorderWidth">2</property> | |||||
<child> | |||||
<widget class="Gtk.HBox" id="hbox1"> | |||||
<property name="MemberName" /> | |||||
<property name="Spacing">20</property> | |||||
<property name="BorderWidth">10</property> | |||||
<child> | |||||
<widget class="Gtk.Image" id="image1"> | |||||
<property name="MemberName" /> | |||||
<property name="Pixbuf">stock:gtk-dialog-error Dialog</property> | |||||
</widget> | |||||
<packing> | |||||
<property name="Position">0</property> | |||||
<property name="AutoSize">True</property> | |||||
<property name="Expand">False</property> | |||||
<property name="Fill">False</property> | |||||
</packing> | |||||
</child> | |||||
<child> | |||||
<widget class="Gtk.Label" id="message"> | |||||
<property name="MemberName" /> | |||||
<property name="LabelProp" translatable="yes">Error!</property> | |||||
<property name="Wrap">True</property> | |||||
</widget> | |||||
<packing> | |||||
<property name="Position">1</property> | |||||
<property name="AutoSize">False</property> | |||||
<property name="Expand">False</property> | |||||
</packing> | |||||
</child> | |||||
</widget> | |||||
<packing> | |||||
<property name="Position">0</property> | |||||
<property name="AutoSize">False</property> | |||||
<property name="Fill">False</property> | |||||
</packing> | |||||
</child> | |||||
</widget> | |||||
</child> | |||||
<child internal-child="ActionArea"> | |||||
<widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> | |||||
<property name="MemberName" /> | |||||
<property name="Spacing">6</property> | |||||
<property name="BorderWidth">5</property> | |||||
<property name="Size">1</property> | |||||
<property name="LayoutStyle">End</property> | |||||
<child> | |||||
<widget class="Gtk.Button" id="buttonOk"> | |||||
<property name="MemberName" /> | |||||
<property name="CanDefault">True</property> | |||||
<property name="CanFocus">True</property> | |||||
<property name="UseStock">True</property> | |||||
<property name="Type">StockItem</property> | |||||
<property name="StockId">gtk-ok</property> | |||||
<property name="ResponseId">-5</property> | |||||
<property name="label">gtk-ok</property> | |||||
<signal name="Clicked" handler="OnButtonCloseClicked" /> | |||||
</widget> | |||||
<packing> | |||||
<property name="Expand">False</property> | |||||
<property name="Fill">False</property> | |||||
</packing> | |||||
</child> | |||||
</widget> | |||||
</child> | |||||
</widget> | |||||
</stetic-interface> | </stetic-interface> |
@@ -13,14 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pipi-sharp", "pipi-sharp\pi | |||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThePimp", "ThePimp\ThePimp.csproj", "{D681A55E-B8E2-4741-87E6-49500109D6E0}" | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThePimp", "ThePimp\ThePimp.csproj", "{D681A55E-B8E2-4741-87E6-49500109D6E0}" | ||||
EndProject | EndProject | ||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpipi", "pipi\libpipi.vcproj", "{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}" | |||||
EndProject | |||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
Release|Any CPU = Release|Any CPU | |||||
Debug|Mixed Platforms = Debug|Mixed Platforms | Debug|Mixed Platforms = Debug|Mixed Platforms | ||||
Debug|Win32 = Debug|Win32 | Debug|Win32 = Debug|Win32 | ||||
Release|Any CPU = Release|Any CPU | |||||
Release|Mixed Platforms = Release|Mixed Platforms | Release|Mixed Platforms = Release|Mixed Platforms | ||||
Release|Win32 = Release|Win32 | Release|Win32 = Release|Win32 | ||||
EndGlobalSection | EndGlobalSection | ||||
@@ -35,16 +33,6 @@ Global | |||||
{2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | {2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | ||||
{2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Mixed Platforms.Build.0 = Release|Any CPU | {2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Mixed Platforms.Build.0 = Release|Any CPU | ||||
{2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Win32.ActiveCfg = Release|Any CPU | {2A062F77-ED16-4B74-B7B7-5ED93FAF300A}.Release|Win32.ActiveCfg = Release|Any CPU | ||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Win32.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Mixed Platforms.Build.0 = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Win32.ActiveCfg = Release|Any CPU | |||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Any CPU.Build.0 = Debug|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | ||||
@@ -55,6 +43,16 @@ Global | |||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | ||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Mixed Platforms.Build.0 = Release|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Mixed Platforms.Build.0 = Release|Any CPU | ||||
{D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Win32.ActiveCfg = Release|Any CPU | {D681A55E-B8E2-4741-87E6-49500109D6E0}.Release|Win32.ActiveCfg = Release|Any CPU | ||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Debug|Win32.ActiveCfg = Debug|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Mixed Platforms.Build.0 = Release|Any CPU | |||||
{FD11AF71-DCBE-4861-9DC6-EE4C6FD951C0}.Release|Win32.ActiveCfg = Release|Any CPU | |||||
{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Any CPU.ActiveCfg = Debug|Win32 | {48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Any CPU.ActiveCfg = Debug|Win32 | ||||
{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 | {48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 | ||||
{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 | {48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 | ||||
@@ -66,6 +64,8 @@ Global | |||||
{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Release|Win32.ActiveCfg = Release|Win32 | {48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Release|Win32.ActiveCfg = Release|Win32 | ||||
{48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Release|Win32.Build.0 = Release|Win32 | {48A34C3A-1E36-49B7-92C4-E982FDCB90C0}.Release|Win32.Build.0 = Release|Win32 | ||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(NestedProjects) = preSolution | |||||
EndGlobalSection | |||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
EndGlobalSection | EndGlobalSection | ||||
@@ -21,16 +21,16 @@ namespace Pipi | |||||
public class Picture | public class Picture | ||||
{ | { | ||||
private IntPtr _picture; | private IntPtr _picture; | ||||
private string _filename; | |||||
public readonly string FileName; | |||||
public string FileName | |||||
{ | |||||
get { return _filename; } | |||||
} | |||||
[DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | |||||
SuppressUnmanagedCodeSecurity] | |||||
private static extern IntPtr pipi_load(string s); | |||||
public Picture(string s) | |||||
private Picture(IntPtr p) | |||||
{ | { | ||||
_picture = pipi_load(s); | |||||
FileName = s; | |||||
_picture = p; | |||||
} | } | ||||
[DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | ||||
@@ -41,6 +41,20 @@ namespace Pipi | |||||
pipi_free(_picture); | pipi_free(_picture); | ||||
} | } | ||||
[DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | |||||
SuppressUnmanagedCodeSecurity] | |||||
private static extern IntPtr pipi_load(string s); | |||||
public static Picture Load(string s) | |||||
{ | |||||
IntPtr p = pipi_load(s); | |||||
if(p == IntPtr.Zero) | |||||
return null; | |||||
Picture ret = new Picture(p); | |||||
ret._filename = s; | |||||
return ret; | |||||
} | |||||
[DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | [DllImport("libpipi.dll", CallingConvention=CallingConvention.Cdecl), | ||||
SuppressUnmanagedCodeSecurity] | SuppressUnmanagedCodeSecurity] | ||||
private static extern int pipi_save(IntPtr p, string s); | private static extern int pipi_save(IntPtr p, string s); | ||||
@@ -55,4 +55,4 @@ | |||||
</Target> | </Target> | ||||
<Target Name="AfterBuild"> | <Target Name="AfterBuild"> | ||||
</Target> | </Target> | ||||
</Project> | |||||
</Project> |
@@ -24,7 +24,7 @@ class Test | |||||
Console.WriteLine("libpipi {0} .NET test", Libpipi.getVersion()); | Console.WriteLine("libpipi {0} .NET test", Libpipi.getVersion()); | ||||
Console.WriteLine("(c) 2008 Sam Hocevar <sam@zoy.org>"); | Console.WriteLine("(c) 2008 Sam Hocevar <sam@zoy.org>"); | ||||
Pipi.Picture p = new Pipi.Picture("random:640x480"); | |||||
Pipi.Picture p = Pipi.Picture.Load("random:640x480"); | |||||
Console.WriteLine("Test picture size: {0}x{1}", p.Width, p.Height); | Console.WriteLine("Test picture size: {0}x{1}", p.Width, p.Height); | ||||
} | } | ||||
} | } | ||||