[f-spot/taglib-metadata: 19/29] Move stuff that's only used by Imaging to Imaging.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/taglib-metadata: 19/29] Move stuff that's only used by Imaging to Imaging.
- Date: Fri, 2 Jul 2010 09:47:01 +0000 (UTC)
commit 4243ad233e06e4191519d7ba953976457a29cae6
Author: Ruben Vermeersch <ruben savanne be>
Date: Sat Jun 26 20:44:03 2010 +0200
Move stuff that's only used by Imaging to Imaging.
src/{ => Imaging}/IOChannel.cs | 40 +++++++++++++++++-----------------
src/{ => Imaging}/InternalProcess.cs | 6 ++--
src/{ => Imaging}/PixelBuffer.cs | 32 +++++++++++++-------------
src/Makefile.am | 6 ++--
4 files changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/src/IOChannel.cs b/src/Imaging/IOChannel.cs
similarity index 95%
rename from src/IOChannel.cs
rename to src/Imaging/IOChannel.cs
index 860a56d..30498c3 100644
--- a/src/IOChannel.cs
+++ b/src/Imaging/IOChannel.cs
@@ -38,7 +38,7 @@ namespace FSpot {
public class DataReadEventArgs : EventArgs {
public bool Continue;
IOCondition condition;
-
+
public IOCondition Condition {
get { return condition; }
}
@@ -49,29 +49,29 @@ namespace FSpot {
Continue = true;
}
}
-
+
public class IOChannel : System.IO.Stream {
private HandleRef handle;
-
+
private delegate bool IOFunc (IntPtr source_channel, IOCondition cond, IntPtr data);
[DllImport("libglib-2.0-0.dll")]
static extern IOFlags g_io_channel_get_flags (HandleRef channel);
public override bool CanRead {
- get {
+ get {
IOFlags flags = g_io_channel_get_flags (handle);
- return (flags & IOFlags.Readable) == IOFlags.Readable;
+ return (flags & IOFlags.Readable) == IOFlags.Readable;
}
}
public override bool CanSeek {
get {
-#if NOTDONE
+#if NOTDONE
IOFlags flags = g_io_channel_get_flags (handle);
- return (flags & IOFlags.Seekable) == IOFlags.Seekable;
+ return (flags & IOFlags.Seekable) == IOFlags.Seekable;
#else
return false;
#endif
@@ -82,16 +82,16 @@ namespace FSpot {
get {
IOFlags flags = g_io_channel_get_flags (handle);
- return (flags & IOFlags.Writable) == IOFlags.Writable;
+ return (flags & IOFlags.Writable) == IOFlags.Writable;
}
}
public override long Length {
- get {
+ get {
throw new NotSupportedException ("IOChannel doesn't support seeking");
}
}
-
+
public override long Position {
get {
throw new NotSupportedException ("IOChannel doesn't support seeking");
@@ -126,7 +126,7 @@ namespace FSpot {
{
IOStatus status;
IntPtr error;
-
+
status = g_io_channel_flush (handle, out error);
if (status != IOStatus.Normal && status != IOStatus.Eof)
@@ -138,7 +138,7 @@ namespace FSpot {
[DllImport("libglib-2.0-0.dll")]
static extern unsafe IOStatus g_io_channel_write_chars (HandleRef channel, byte *data, int count, out int bytes_written, out IntPtr error);
-
+
public override void Write (byte [] buffer, int offset, int count)
{
IOStatus status = IOStatus.Again;
@@ -147,7 +147,7 @@ namespace FSpot {
if (buffer == null)
throw new ArgumentNullException ();
-
+
unsafe {
while (status == IOStatus.Again && count > 0) {
fixed (byte *data = &buffer [offset]) {
@@ -156,13 +156,13 @@ namespace FSpot {
if (error != IntPtr.Zero)
throw new GException (error);
-
+
offset += written;
count -= written;
}
}
}
-
+
[DllImport("libglib-2.0-0.dll")]
static unsafe extern IOStatus g_io_channel_read_chars (HandleRef channel, byte *data, int count, out int bytes_read, out IntPtr error);
@@ -194,7 +194,7 @@ namespace FSpot {
{
return g_io_add_watch (handle, condition, func, IntPtr.Zero);
}
-
+
// FIXME this should hold more than one source in a table
// but I am lazy
uint data_ready_source;
@@ -216,9 +216,9 @@ namespace FSpot {
private bool DataReadyHandler (IntPtr channel, IOCondition condition, IntPtr data)
{
DataReadEventArgs args = new DataReadEventArgs (condition);
- if (data_ready != null)
+ if (data_ready != null)
data_ready (this, args);
-
+
return args.Continue;
}
@@ -226,7 +226,7 @@ namespace FSpot {
{
throw new NotSupportedException ();
}
-
+
private enum SeekType {
Current,
Set,
@@ -253,7 +253,7 @@ namespace FSpot {
data_ready_source = 0;
g_io_channel_shutdown (handle, false, out error);
-
+
base.Close ();
if (error != IntPtr.Zero)
diff --git a/src/InternalProcess.cs b/src/Imaging/InternalProcess.cs
similarity index 98%
rename from src/InternalProcess.cs
rename to src/Imaging/InternalProcess.cs
index 7cb2d2f..e1154c7 100644
--- a/src/InternalProcess.cs
+++ b/src/Imaging/InternalProcess.cs
@@ -46,7 +46,7 @@ namespace FSpot {
IntPtr err,
//ref int stderr,
out IntPtr error);
-
+
public InternalProcess (string path, string [] args)
{
IntPtr error;
@@ -56,8 +56,8 @@ namespace FSpot {
Array.Copy (args, nargs, args.Length);
args = nargs;
}
-
- g_spawn_async_with_pipes (path, args, null, InternalProcessFlags.SearchPath,
+
+ g_spawn_async_with_pipes (path, args, null, InternalProcessFlags.SearchPath,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero,
ref stdin, ref stdout, IntPtr.Zero, out error);
diff --git a/src/PixelBuffer.cs b/src/Imaging/PixelBuffer.cs
similarity index 98%
rename from src/PixelBuffer.cs
rename to src/Imaging/PixelBuffer.cs
index 544aa94..c1b1d09 100644
--- a/src/PixelBuffer.cs
+++ b/src/Imaging/PixelBuffer.cs
@@ -28,11 +28,11 @@ namespace FSpot.Imaging {
width = pixbuf.Width;
height = pixbuf.Height;
this.nchannels = pixbuf.HasAlpha ? 4 : 3;
-
+
depth = PixelBufferDepth.UInt16;
data = new ushort [width * height * nchannels];
-
+
unsafe {
byte * src_pixels = (byte *) pixbuf.Pixels;
int src_stride = pixbuf.Rowstride;
@@ -53,10 +53,10 @@ namespace FSpot.Imaging {
public unsafe void Fill8 (int i, int j, byte * src_data, int offset, int count)
{
ushort * rowpix;
-
+
fixed (ushort * pixels = &data [0]) {
rowpix = pixels + i * rowstride + j;
-
+
for (int col = 0; col < count; col++) {
int val = src_data [col];
rowpix [col] = (ushort) (val << 8 & val);
@@ -80,9 +80,9 @@ namespace FSpot.Imaging {
else
Fill16Swap (i, j, src_data, offset, count);
}
-
+
public void Fill16 (int i, int j, byte [] src_data, int offset, int count)
- {
+ {
unsafe {
ushort * rowpix;
@@ -115,24 +115,24 @@ namespace FSpot.Imaging {
}
}
}
-
+
public override Gdk.Pixbuf ToPixbuf (Cms.Profile destination_profile)
{
#if true //USE_LCMS
profile = Cms.Profile.CreateStandardRgb ();
Cms.Profile [] list = new Cms.Profile [] { profile, destination_profile };
- Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8,
+ Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8,
width, height);
-
+
Cms.Transform t = new Cms.Transform (list,
Cms.Format.Rgb16,
PixbufUtils.PixbufCmsFormat (pixbuf),
Cms.Intent.Perceptual, 0x0);
-
+
unsafe {
fixed (ushort * srcpix = &data[0]) {
byte * destpix = (byte *) pixbuf.Pixels;
-
+
for (int row = 0; row < height; row++)
t.Apply ((IntPtr) (srcpix + row * rowstride),
(IntPtr) (destpix + row * pixbuf.Rowstride),
@@ -142,18 +142,18 @@ namespace FSpot.Imaging {
return pixbuf;
#else
- Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8,
+ Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8,
width, height);
unsafe {
fixed (ushort * src = &data[0]) {
ushort * srcpix = src;
byte * destpix = (byte *) pixbuf.Pixels;
-
+
for (int row = 0; row < height; row++) {
for (int col = 0; col < width * nchannels; col++)
destpix [col] = (byte) (srcpix [col] >> 8);
-
+
srcpix += rowstride;
destpix += pixbuf.Rowstride;
}
@@ -168,8 +168,8 @@ namespace FSpot.Imaging {
#if false
public class UInt8Buffer : PixelBuffer {
protected ushort [] data;
-
-
+
+
}
public class PixbufBuffer : PixelBuffer {
diff --git a/src/Makefile.am b/src/Makefile.am
index 665add9..7e84b6e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -81,19 +81,20 @@ SOURCES = \
Import/ImportSource.cs \
Import/FileImportSource.cs \
InfoOverlay.cs \
- InternalProcess.cs \
- IOChannel.cs \
ItemAction.cs \
Imaging/DCRawFile.cs \
Imaging/Bim.cs \
Imaging/Ciff.cs \
Imaging/Exif.cs \
Imaging/ImageFile.cs \
+ Imaging/InternalProcess.cs \
Imaging/IptcFile.cs \
+ Imaging/IOChannel.cs \
Imaging/JpegFile.cs \
Imaging/JpegUtils.cs \
Imaging/MrwFile.cs \
Imaging/OrderedWriter.cs \
+ Imaging/PixelBuffer.cs \
Imaging/PngFile.cs \
Imaging/PnmFile.cs \
Imaging/RafFile.cs \
@@ -121,7 +122,6 @@ SOURCES = \
PhotoView.cs \
PixbufUtils.cs \
PixbufCache.cs \
- PixelBuffer.cs \
Preferences.cs \
PrintOperation.cs \
ProgressItem.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]