diff --git a/Aaru.CommonTypes.csproj b/Aaru.CommonTypes.csproj index c1b8fb0..59cfd35 100644 --- a/Aaru.CommonTypes.csproj +++ b/Aaru.CommonTypes.csproj @@ -70,6 +70,7 @@ + diff --git a/Interfaces/IMediaGraph.cs b/Interfaces/IMediaGraph.cs new file mode 100644 index 0000000..01c6ac5 --- /dev/null +++ b/Interfaces/IMediaGraph.cs @@ -0,0 +1,134 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : IFloppyImage.cs +// Author(s) : Natalia Portillo +// +// Component : Disc image plugins. +// +// --[ Description ] ---------------------------------------------------------- +// +// Defines the interface to be implemented by floppy image plugins. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2023 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using System.IO; + +namespace Aaru.CommonTypes.Interfaces; + +/// Defines the interface to draw the dump or verification status of a media in a picture. +public interface IMediaGraph +{ + /// Paints the specified sector in green + /// Sector + public void PaintSectorGood(ulong sector); + + /// Paints the specified sector in red + /// Sector + public void PaintSectorBad(ulong sector); + + /// Paints the specified sector in yellow + /// Sector + public void PaintSectorUnknown(ulong sector); + + /// Paints the specified sector in gray + /// Sector + public void PaintSectorUndumped(ulong sector); + + /// Paints a sector with the specified color + /// Sector + /// Red from 0 to 255 + /// Green from 0 to 255 + /// Blue from 0 to 255 + /// Opacity from 0 to 255 + public void PaintSector(ulong sector, byte red, byte green, byte blue, byte opacity = 0xFF); + + /// Paints sectors, staring at in gray + /// First sector to paint + /// How many sectors to paint + public void PaintSectorsUndumped(ulong startingSector, uint length); + + /// Paints sectors, staring at in green + /// First sector to paint + /// How many sectors to paint + public void PaintSectorsGood(ulong startingSector, uint length); + + /// Paints sectors, staring at in red + /// First sector to paint + /// How many sectors to paint + public void PaintSectorsBad(ulong startingSector, uint length); + + /// Paints sectors, staring at in yellow + /// First sector to paint + /// How many sectors to paint + public void PaintSectorsUnknown(ulong startingSector, uint length); + + /// Paints sectors, staring at in the specified color + /// First sector to paint + /// How many sectors to paint + /// Red from 0 to 255 + /// Green from 0 to 255 + /// Blue from 0 to 255 + /// Opacity from 0 to 255 + public void PaintSectors(ulong startingSector, uint length, byte red, byte green, byte blue, byte opacity = 0xFF); + + /// Paints the specified sectors in gray + /// List of sectors to paint + public void PaintSectorsUndumped(IEnumerable sectors); + + /// Paints the specified sectors in green + /// List of sectors to paint + public void PaintSectorsGood(IEnumerable sectors); + + /// Paints the specified sectors in red + /// List of sectors to paint + public void PaintSectorsBad(IEnumerable sectors); + + /// Paints the specified sectors in yellow + /// List of sectors to paint + public void PaintSectorsUnknown(IEnumerable sectors); + + /// Paints the specified sectors in the specified color + /// List of sectors to paint + /// Red from 0 to 255 + /// Green from 0 to 255 + /// Blue from 0 to 255 + /// Opacity from 0 to 255 + public void PaintSectorsUnknown(IEnumerable sectors, byte red, byte green, byte blue, byte opacity = 0xFF); + + /// Paints the information specific to recordable discs in green + public void PaintRecordableInformationGood(); + + /// Writes the graph bitmap as a PNG into the specified stream + /// Stream that will receive the spiral bitmap + public void WriteTo(Stream stream); + + /// Writes the graph bitmap as a PNG into the specified stream + /// Path to the file to save the PNG to + public void WriteTo(string path); +} \ No newline at end of file