Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 112575
Collapse All | Expand All

(-)Ciff.cs (-4 / +20 lines)
Lines 1-3 Link Here
1
using System;
2
using System.Runtime.InteropServices;
3
1
namespace FSpot {
4
namespace FSpot {
2
	public class BitConverter {
5
	public class BitConverter {
3
		public static uint Swap (uint val, bool little) 
6
		public static uint Swap (uint val, bool little) 
Lines 66-71 Link Here
66
			return Swap (val, little);
69
			return Swap (val, little);
67
		}
70
		}
68
71
72
		public static float ToSingle (byte [] data, int position, bool little)
73
		{
74
			float retval;
75
			unsafe {
76
				uint * ptr;
77
				ptr = (uint *)&retval;
78
				*ptr = ToUInt32 (data, position, little);
79
			}
80
			return retval;
81
		}
82
69
		public static int ToInt32 (byte [] data, int position, bool little)
83
		public static int ToInt32 (byte [] data, int position, bool little)
70
		{
84
		{
71
			return unchecked ((int) ToUInt32 (data, position, little));
85
			return unchecked ((int) ToUInt32 (data, position, little));
Lines 1-3 Link Here
1
using System;
2
1
namespace FSpot.Ciff {
3
namespace FSpot.Ciff {
2
	public enum Tag {
4
	public enum Tag {
3
		// Byte valuesad
5
		// Byte valuesad
Lines 83-88 Link Here
83
		ExifInformation = 0x300b
85
		ExifInformation = 0x300b
84
	}
86
	}
85
87
88
	
89
86
	public struct ImageSpec {
90
	public struct ImageSpec {
87
		public uint ImageWidth;  // Number of horizontal pixels
91
		public uint ImageWidth;  // Number of horizontal pixels
88
		public uint ImageHeight; // Number of vertical pixels
92
		public uint ImageHeight; // Number of vertical pixels
Lines 96-105 Link Here
96
		{
100
		{
97
			ImageWidth = BitConverter.ToUInt32 (data, 0, little);
101
			ImageWidth = BitConverter.ToUInt32 (data, 0, little);
98
			ImageHeight = BitConverter.ToUInt32 (data, 4, little);
102
			ImageHeight = BitConverter.ToUInt32 (data, 4, little);
99
			unsafe {
103
100
				float *p = &PixelAspectRatio;
104
			PixelAspectRatio = BitConverter.ToSingle (data, 8, little);
101
				*((uint *)p) = BitConverter.ToUInt32 (data, 8, little);
102
			}
103
			RotationAngle = BitConverter.ToInt32 (data, 12, little);
105
			RotationAngle = BitConverter.ToInt32 (data, 12, little);
104
			ComponentBitDepth = BitConverter.ToUInt32 (data, 16, little);
106
			ComponentBitDepth = BitConverter.ToUInt32 (data, 16, little);
105
			ColorBitDepth = BitConverter.ToUInt32 (data, 20, little);
107
			ColorBitDepth = BitConverter.ToUInt32 (data, 20, little);

Return to bug 112575