Commit 9d492d61 authored by Théophile BORNON's avatar Théophile BORNON

Ajout headers

parent 3599e79e

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S04_Projet", "S04_Projet\S04_Projet.csproj", "{229D3602-654B-498B-9478-5CC3982C358C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{229D3602-654B-498B-9478-5CC3982C358C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{229D3602-654B-498B-9478-5CC3982C358C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E2DD5967-259E-420B-9384-9A01234CDCCD}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace S04_Projet
{
public class MyImage
{
private string type;
private int fileSize;
private int offset;
private int width;
private int height;
private Pixel[,] Pixel;
public MyImage(string path)
{
}
public void FromImageToFile(string path)
{
}
public static int EndianToInt(byte[] arr, int from, int to)
{
int somme = 0;
for (int i = from; i < to; i++) somme += (arr[i] << ((i-from) * 8));
return somme;
}
/*
public byte[] IntToEndian(int val)
{
}*/
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace S04_Projet
{
public class Pixel
{
int red;
int green;
int blue;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Diagnostics;
using System.IO;
namespace S04_Projet
{
class Program
{
static void Main(string[] args)
{
byte[] file = File.ReadAllBytes("img/lac_en_montagne.bmp");
#region Header
string format = (char)file[0] + "" + (char)file[1];
int endian = MyImage.EndianToInt(file, 2, 6);
int offset = MyImage.EndianToInt(file, 10, 14);
Console.WriteLine("Format : {0}\nTaille : {1} octets", format, endian);
Console.WriteLine("Offset : " + offset);
#endregion
#region File info
int fileInfoHeaderSize = MyImage.EndianToInt(file, 14, 18);
int width = MyImage.EndianToInt(file, 18, 22);
int height = MyImage.EndianToInt(file, 22, 26);
int colorPlanesNb = MyImage.EndianToInt(file, 26, 28);
int bitsPerPixel = MyImage.EndianToInt(file, 28, 30);
int compressionMethod = MyImage.EndianToInt(file, 30, 34);
int imgSize = MyImage.EndianToInt(file, 34, 38);
int horizontalRes = MyImage.EndianToInt(file, 38, 42);
int VerticalRes = MyImage.EndianToInt(file, 42, 46);
int nbColor = MyImage.EndianToInt(file, 46, 50);
int nbImportantColor = MyImage.EndianToInt(file, 50, 54);
Console.WriteLine("File info header size : {0} octets", fileInfoHeaderSize);
Console.WriteLine("Size : {0}x{1}px",width, height);
Console.WriteLine("Color planes number : " + colorPlanesNb);
Console.WriteLine("Bits per pixel : " + bitsPerPixel);
Console.WriteLine("Compression method : " + compressionMethod);
Console.WriteLine("Image size : {0} octets", imgSize);
Console.WriteLine("Horizontal res : {0}\nVertical res : {1}", horizontalRes, VerticalRes);
Console.WriteLine("Number of colors : " + nbColor);
Console.WriteLine("Number of important colors : " + nbImportantColor);
#endregion
/*for (int i = 54; i < file.Length; i++)
{
Console.Write(file[i] + "\t");
}*/
Console.Read();
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("S04_Projet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("S04_Projet")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("229d3602-654b-498b-9478-5cc3982c358c")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{229D3602-654B-498B-9478-5CC3982C358C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>S04_Projet</RootNamespace>
<AssemblyName>S04_Projet</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyImage.cs" />
<Compile Include="Pixel.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment