OSDN Git Service

Updates for Snapshots branch, Transparency setting
authormelchior <melchior@users.osdn.me>
Wed, 3 Jun 2020 21:58:59 +0000 (17:58 -0400)
committermelchior <melchior@users.osdn.me>
Wed, 3 Jun 2020 21:58:59 +0000 (17:58 -0400)
Automap/Automap.csproj
Automap/Subsystems/Snapshot.cs

index e458cbe..159cbab 100644 (file)
@@ -97,6 +97,7 @@
     <Compile Include="Data\PersistedConfiguration.cs" />
     <Compile Include="Data\DisplayNameAttribute.cs" />
     <Compile Include="Subsystems\JsonGenerator.cs" />
+       <Compile Include="Subsystems\Snapshot.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="VS_libs\" />
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
   </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-               <Compile Include="Subsystems\Snapshot.cs" />
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />              
 </Project>
\ No newline at end of file
index 305e446..dd92f79 100644 (file)
@@ -6,6 +6,7 @@ using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
 using Hjg.Pngcs;
+using Hjg.Pngcs.Chunks;
 
 namespace Automap
 {
@@ -43,9 +44,27 @@ namespace Automap
 
                        ImageInfo info = new ImageInfo(Width * chunkSize, Height * chunkSize, 8, false);
                        PngWriter snapWriter = FileHelper.CreatePngWriter(path, info, true);
+                       PngMetadata meta = snapWriter.GetMetadata( );
+                       meta.SetTimeNow( );
+                       var transparencyChunk = meta.CreateTRNSChunk( );
+                       transparencyChunk.SetRGB(0, 0, 0);
+                       //meta.SetText("Center_X", coord.X.ToString("D"));
+                       //meta.SetText("Center_Y", coord.Y.ToString("D"));
+
+
+               
+                       /*
+                       Red:   2 bytes, range 0 .. (2^bitdepth)-1
+                       Green: 2 bytes, range 0 .. (2^bitdepth)-1
+                       Blue:  2 bytes, range 0 .. (2^bitdepth)-1
+                       */
+
+
                        snapWriter.CompLevel = 5;
                        snapWriter.CompressionStrategy = Hjg.Pngcs.Zlib.EDeflateCompressStrategy.Filtered;
 
+
+
                        var orderedList =
                                from ch in cols
                                group ch by ch.Location.Y into g