Jump to content

aybe

Newbies
  • Posts

    8
  • Joined

  • Last visited

Everything posted by aybe

  1. Yes, I've actually coded the plugin and can successfully load any TIM file. However, I'm currently having conceptual issues that, unless I'm mistaken, won't be solvable through the actual PDN interface. This obviously makes sense as PDN is a general image editor and doesn't intend to support a very specific feature for a specific format. Not sure what to do next... I've uploaded my work in case someone has an idea, if that ever makes sense.😁 https://forums.getpaint.net/topic/119542-any-possibility-of-load-options-for-a-plugin/?do=findComment&comment=592590
  2. Haven't though about that actually, indeed a message box (or more) solves this problem more or less elegantly! For the second, I'm starting to realize the trouble I've put myself in. 😁 While loading a TIM file is straightforward, providing the full TIM user experience from PDN looks just impossible to me... The problem is that it's impossible to know and assign palettes from PDN, unless rewriting a full-blown software from within PDN, at the mercy that some thing might be not allowed by PDN at some point. The plugin that loads all TIM format is here https://github.com/aybe/pdnTimFile, but unless one finds a way to address these issues, it has become to a halt. Thanks mateπŸ˜€
  3. Here's a concrete example of the challenge, this is the same TIM file, it has two palettes, first is for the characters, second is for the GUI: The more I am thinking about it, the trickier it appears to be achievable from within a PDN plugin... generating 1 layer per palette wouldn't make much sense as there can be dozens and all of them but 1 would work for a sub-image in the surface. And then, loading is a thing but saving is another totally different thing, how could one specify what palette is for what region, etc. If that wasn't complex enough, TIM can hold 4-bit and 8-bit images simultaneously... this is because of limited VRAM in the PSX. Still, any ideas or suggestions are welcome! πŸ˜€
  4. In PropertyBasedFileType I've noticed the overload for save options, but there's nothing similar for load. Basically, like when you open a raw audio or image in other software, you can choose settings and pray they're correct.πŸ˜… In my case it isn't that extreme, it's just that the TIM format, while having transparency info, actually it isn't always desired. Long story short, TIM can be a texture atlas and most generally is, also with a different depth and palette for each image. πŸ˜† So ideally, if there's a way to show some GUI before image loading or some other approach that'd work it'd be amazing!
  5. Makes perfect sense, SharpShell is pretty easy to implement even though some may say it's very baaaaad to write managed shell extensionsπŸ˜….
  6. Just noticed that the plugin I quickly wrote to open TIM files does not show a thumbnail preview in Windows Explorer, in the following screenshot both PNG and TIM are associated to be opened by the software, PNG shows a preview thumbnail but TIM doesn't: Is there something I'm missing in order to get thumbnail previews in Explorer ? This is the current code: using System.IO; using System.Text; using PaintDotNet; using PaintDotNet.PropertySystem; namespace TimFileType; #pragma warning disable CA1416 // Validate platform compatibility public sealed class TimFileTypeFactory : IFileTypeFactory2 { public FileType[] GetFileTypeInstances(IFileTypeHost host) { return new FileType[] { new TimFileTypeClass(host.Services) }; } } [PluginSupportInfo(typeof(PluginSupportInfo))] public class TimFileTypeClass : PropertyBasedFileType { public TimFileTypeClass(IServiceProvider serviceProvider) : base("TIM: Screen Image Data", new FileTypeOptions { LoadExtensions = new[] { ".tim" } }) { ServiceProvider = serviceProvider; } private IServiceProvider ServiceProvider { get; } protected override unsafe Document OnLoad(Stream input) { using var reader = new BinaryReader(input, Encoding.Default, true); reader.ReadByte(); reader.ReadByte(); reader.ReadInt16(); var flags = reader.ReadInt32(); var format = flags & 0b111; var palette = (flags & 0b1000) != 0; if (palette) { var length = reader.ReadInt32(); reader.BaseStream.Position += length - 4; } // 24-bit only for now var pixelDataSize = reader.ReadInt32(); var frameBufferX = reader.ReadInt16(); var frameBufferY = reader.ReadInt16(); var pixelWidth = reader.ReadInt16(); var pixelHeight = reader.ReadInt16(); var pixelData = reader.ReadBytes(pixelDataSize - 12); pixelWidth = (short)(pixelWidth * 2 / 3); var layer = Layer.CreateBackgroundLayer(pixelWidth, pixelHeight); var pointer = layer.Surface.GetRowPointer(0); for (var i = 0; i < pixelWidth * pixelHeight; i ++) { pointer->R = pixelData[i*3 + 0]; pointer->G = pixelData[i*3 + 1]; pointer->B = pixelData[i*3 + 2]; pointer->A = byte.MaxValue; pointer++; } var document = new Document(pixelWidth, pixelHeight); document.Layers.Add(layer); return document; } protected override void OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) { throw new NotImplementedException(); } public override PropertyCollection OnCreateSavePropertyCollection() { throw new NotImplementedException(); } } Any suggestions are welcome! πŸ˜ƒ
  7. I've been playing with it for a couple of hours now and while the results are really great it's a little puzzling as on how it works internally. Here's an example : Original image Saturation set to 168 Now on Photoshop and a few others the result is not like that at all, (whether proofing is on or off) I'd say it's very faithful to the original colors, understand in that it doesn't change, in fact it's barely visible. But in fact the Paint.Net filter is quite great in its own as this is what I was looking for, more saturation So I've been playing with AForge.Net trying to find out a similar result, but it went like Photoshop ... Until I've started playing with YCbCr which brought the following result : That just makes the Paint.Net filter even more mysterious, the results are great but they are different. My questions are : Can you explain how does the saturation filter do produce such colors ? Does it play on an YCbCr color space ? Finally, is it linear or not ? Thank you, Best regards
×
×
  • Create New...