Skip to content

Commit

Permalink
update project
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfram77 committed Sep 22, 2018
1 parent 87b2ae5 commit cdbe45a
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 75 deletions.
6 changes: 3 additions & 3 deletions src/App.config → App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
</configuration>
17 changes: 10 additions & 7 deletions src/src.csproj → App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
<ProjectGuid>{B74DCBE7-BA9A-4CC2-A684-A163F7A320CA}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>orez.ogamma</RootNamespace>
<AssemblyName>ogamma</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<RootNamespace>App</RootNamespace>
<AssemblyName>egamma</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -43,15 +44,17 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="math\oVector.cs" />
<Compile Include="oParams.cs" />
<Compile Include="math\EVector.cs" />
<Compile Include="EParams.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="win32\oGdi.cs" />
<Compile Include="win32\oUser.cs" />
<Compile Include="win32\EGdi.cs" />
<Compile Include="win32\EUser.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="LICENSE" />
<None Include="README.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
15 changes: 6 additions & 9 deletions cmd-gamma.sln → App.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "src", "src\src.csproj", "{B74DCBE7-BA9A-4CC2-A684-A163F7A320CA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0", "0", "{59A4DB8E-8981-48C5-9DBF-E87615DC4A87}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
EndProjectSection
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "App.csproj", "{B74DCBE7-BA9A-4CC2-A684-A163F7A320CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -25,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {37632251-C7C5-4C8C-B813-06AF9B6854FA}
EndGlobalSection
EndGlobal
6 changes: 3 additions & 3 deletions src/oParams.cs → EParams.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;

namespace orez.ogamma {
class oParams {
namespace App {
class EParams {

// data
/// <summary>
Expand All @@ -27,7 +27,7 @@ class oParams {
/// Get input parameters from input arguments.
/// </summary>
/// <param name="args">Input arguments.</param>
public oParams(string[] args) {
public EParams(string[] args) {
char s = '\0';
Red = new List<double>();
Green = new List<double>();
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 0rez
Copyright (c) 2016 Merferry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
52 changes: 26 additions & 26 deletions src/Program.cs → Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using orez.ogamma.win32;
using orez.ogamma.math;
using App.win32;
using App.math;

namespace orez.ogamma {
namespace App {
class Program {

// constant data
private const string APP = "ogamma";
private const string APP = "egamma";


// static method
Expand All @@ -18,21 +18,21 @@ class Program {
/// </summary>
/// <param name="args">Input arguments.</param>
static void Main(string[] args) {
oParams p = new oParams(args);
EParams p = new EParams(args);
if (args.Length == 0) { GetGdiRamp(); return; }
if (p.Red.Count == 0) { Console.Error.WriteLine("{0}: no red values.", APP); return; }
if (p.Green.Count == 0) { Console.Error.WriteLine("{0}: no green values.", APP); return; }
if (p.Blue.Count == 0) { Console.Error.WriteLine("{0}: no blue values.", APP); return; }
if (p.Ramp) {
RampMin2(p.Red, p.Green, p.Blue);
p.Red = oVector.GetLin(new double[oGdi.RAMP_SZ], p.Red);
p.Green = oVector.GetLin(new double[oGdi.RAMP_SZ], p.Green);
p.Blue = oVector.GetLin(new double[oGdi.RAMP_SZ], p.Blue);
p.Red = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Red);
p.Green = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Green);
p.Blue = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Blue);
}
else {
p.Red = GetRamp(p.Red[0], oGdi.RAMP_SZ);
p.Green = GetRamp(p.Green[0], oGdi.RAMP_SZ);
p.Blue = GetRamp(p.Blue[0], oGdi.RAMP_SZ);
p.Red = GetRamp(p.Red[0], EGdi.RAMP_SZ);
p.Green = GetRamp(p.Green[0], EGdi.RAMP_SZ);
p.Blue = GetRamp(p.Blue[0], EGdi.RAMP_SZ);
}
SetGdiRamp(p.Red, p.Green, p.Blue);
}
Expand All @@ -57,28 +57,28 @@ private static void RampMin2(IList<double> red, IList<double> green, IList<doubl
/// <param name="green">Green floating-point ramp.</param>
/// <param name="blue">Blue floating-point ramp.</param>
private static void SetGdiRamp(IList<double> red, IList<double> green, IList<double> blue) {
oGdi.RAMP r = new oGdi.RAMP(null);
oVector.Map(r.Red, UInt16.MinValue, UInt16.MaxValue, red, 0, 1);
oVector.Map(r.Green, UInt16.MinValue, UInt16.MaxValue, green, 0, 1);
oVector.Map(r.Blue, UInt16.MinValue, UInt16.MaxValue, blue, 0, 1);
oGdi.SetDeviceGammaRamp(oUser.GetDC(IntPtr.Zero), ref r);
EGdi.RAMP r = new EGdi.RAMP(null);
EVector.Map(r.Red, UInt16.MinValue, UInt16.MaxValue, red, 0, 1);
EVector.Map(r.Green, UInt16.MinValue, UInt16.MaxValue, green, 0, 1);
EVector.Map(r.Blue, UInt16.MinValue, UInt16.MaxValue, blue, 0, 1);
EGdi.SetDeviceGammaRamp(EUser.GetDC(IntPtr.Zero), ref r);
}

/// <summary>
/// Get the current gamma ramp.
/// </summary>
private static void GetGdiRamp() {
oGdi.RAMP r = new oGdi.RAMP(null);
oGdi.GetDeviceGammaRamp(oUser.GetDC(IntPtr.Zero), ref r);
IList<double> red = oVector.Map(null, 0, 1, r.Red, UInt16.MinValue, UInt16.MaxValue);
IList<double> green = oVector.Map(null, 0, 1, r.Green, UInt16.MinValue, UInt16.MaxValue);
IList<double> blue = oVector.Map(null, 0, 1, r.Blue, UInt16.MinValue, UInt16.MaxValue);
EGdi.RAMP r = new EGdi.RAMP(null);
EGdi.GetDeviceGammaRamp(EUser.GetDC(IntPtr.Zero), ref r);
IList<double> red = EVector.Map(null, 0, 1, r.Red, UInt16.MinValue, UInt16.MaxValue);
IList<double> green = EVector.Map(null, 0, 1, r.Green, UInt16.MinValue, UInt16.MaxValue);
IList<double> blue = EVector.Map(null, 0, 1, r.Blue, UInt16.MinValue, UInt16.MaxValue);
Console.WriteLine("Red");
oVector.Print(red);
EVector.Print(red);
Console.WriteLine("Green");
oVector.Print(green);
EVector.Print(green);
Console.WriteLine("Blue");
oVector.Print(blue);
EVector.Print(blue);
}

/// <summary>
Expand All @@ -88,8 +88,8 @@ private static void GetGdiRamp() {
/// <param name="len">Output ramp length.</param>
/// <returns>Ramp.</returns>
private static IList<double> GetRamp(double g, int sz) {
IList<double> d = oVector.LinSpace(null, 0, 1, sz);
return oVector.Pow(d, d, g);
IList<double> d = EVector.LinSpace(null, 0, 1, sz);
return EVector.Pow(d, d, g);
}
}
}
12 changes: 6 additions & 6 deletions src/Properties/AssemblyInfo.cs → Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ogamma")]
[assembly: AssemblyTitle("extragamma")]
[assembly: AssemblyDescription("Set Gamma ramp for Display Device from Windows Console")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("0rez")]
[assembly: AssemblyProduct("ogamma")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCompany("Merferry")]
[assembly: AssemblyProduct("extra-gamma")]
[assembly: AssemblyCopyright("Copyright (c) 2016 Merferry")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.2.0")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
# ogamma

Get or set Gamma ramp for Display Device from Windows Console.
> 1. Download [exe file](https://raw.githubusercontent.com/winp/extra-bel/master/ecd.cmd).
> 2. Copy to `C:\Program_Files\Scripts`.
> 3. Add `C:\Program_Files\Scripts` to `PATH` environment variable.

## usage

```batch
> ogamma [-r|--ramp] [-c|--color] [<values>]
> egamma [-r|--ramp] [-c|--color] [<values>]
:: [] -> optional argument
:: <> -> argument value
```

```batch
:: set gamma to 2
> ogamma 2
> egamma 2
:: set gamma to default
> ogamma 1
> egamma 1
:: set gamma for each color
> ogamma --color R 1.0 G 2.0 B 3.0
> egamma --color R 1.0 G 2.0 B 3.0
:: set gamma ramp (approx 2)
> ogamma --ramp 0.0 0.25 1.0
> egamma --ramp 0.0 0.25 1.0
:: set gamma ramp to default
> ogamma --ramp 0.0 0.5 1.0
> egamma --ramp 0.0 0.5 1.0
:: set gamma ramp to default
> ogamma --ramp 0.0 1.0
> egamma --ramp 0.0 1.0
:: set gamma ramp for each color
> ogamma -r -c R 0.0 1.0 G 0.0 0.25 1.0 B 0.0 0.125 1.0
> egamma -r -c R 0.0 1.0 G 0.0 0.25 1.0 B 0.0 0.125 1.0
:: set gamma ramp for each color to default
> ogamma -rc R 0.0 0.25 0.5 0.75 1.0 G 0.0 0.5 1.0 B 0.0 1.0
> egamma -rc R 0.0 0.25 0.5 0.75 1.0 G 0.0 0.5 1.0 B 0.0 1.0
:: get current gamma ramp
> ogamma
> egamma
```
4 changes: 2 additions & 2 deletions src/math/oVector.cs → math/EVector.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;

namespace orez.ogamma.math {
class oVector {
namespace App.math {
class EVector {

// static method
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/win32/oGdi.cs → win32/EGdi.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;

namespace orez.ogamma.win32 {
class oGdi {
namespace App.win32 {
class EGdi {

// types
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
Expand Down
4 changes: 2 additions & 2 deletions src/win32/oUser.cs → win32/EUser.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;

namespace orez.ogamma.win32 {
class oUser {
namespace App.win32 {
class EUser {

// extern methods
[DllImport("user32.dll")]
Expand Down

0 comments on commit cdbe45a

Please sign in to comment.