Skip to content

Commit

Permalink
Add ability to merge generated normals with existing normals, allowin…
Browse files Browse the repository at this point in the history
…g for the original normal quality to be preserved, while also retaining the benefit of autogenerated normals.
  • Loading branch information
Sebane1 committed Jan 25, 2023
1 parent cb59a0e commit 4adba78
Show file tree
Hide file tree
Showing 17 changed files with 855 additions and 131 deletions.
Binary file modified .vs/FFXIVLooseTextureCompiler/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/FFXIVLooseTextureCompiler/v17/.suo
Binary file not shown.
4 changes: 2 additions & 2 deletions FFXIVLooseTextureCompiler/FFXIVLooseTextureCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>1.0.0.6</AssemblyVersion>
<FileVersion>1.0.0.6</FileVersion>
<AssemblyVersion>1.0.0.7</AssemblyVersion>
<FileVersion>1.0.0.7</FileVersion>
<Version>1.0.0.6</Version>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<Title>FFXIV Loose Texture Compiler</Title>
Expand Down
32 changes: 32 additions & 0 deletions FFXIVLooseTextureCompiler/ImageProcessing/Brightness.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FFXIVLooseTextureCompiler.ImageProcessing {
public class Brightness {
public static Bitmap BrightenImage(Bitmap originalImage, float brightness = 1.5f, float contrast = 1.0f, float gamma = 1.0f) {
Bitmap adjustedImage = new Bitmap(originalImage.Width, originalImage.Height);
float adjustedBrightness = brightness - 1.0f;
// create matrix that will brighten and contrast the image
float[][] ptsArray ={
new float[] {contrast, 0, 0, 0, 0}, // scale red
new float[] {0, contrast, 0, 0, 0}, // scale green
new float[] {0, 0, contrast, 0, 0}, // scale blue
new float[] {0, 0, 0, 1.0f, 0}, // don't scale alpha
new float[] {adjustedBrightness, adjustedBrightness, adjustedBrightness, 0, 1}};

ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.ClearColorMatrix();
imageAttributes.SetColorMatrix(new ColorMatrix(ptsArray), ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
imageAttributes.SetGamma(gamma, ColorAdjustType.Bitmap);
Graphics g = Graphics.FromImage(adjustedImage);
g.DrawImage(originalImage, new Rectangle(0, 0, adjustedImage.Width, adjustedImage.Height)
, 0, 0, originalImage.Width, originalImage.Height,
GraphicsUnit.Pixel, imageAttributes);
return adjustedImage;
}
}
}
Loading

0 comments on commit 4adba78

Please sign in to comment.