-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to merge generated normals with existing normals, allowin…
…g for the original normal quality to be preserved, while also retaining the benefit of autogenerated normals.
- Loading branch information
Showing
17 changed files
with
855 additions
and
131 deletions.
There are no files selected for viewing
Binary file modified
BIN
+215 Bytes
(100%)
.vs/FFXIVLooseTextureCompiler/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
Oops, something went wrong.