Paint.NET

Welcome to the Paint.NET forum!
It is currently Sun Nov 22, 2009 10:43 am

All times are UTC


Forum rules


Questions or problems with plugin installation? Click here.



Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 65 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: DDS File Support for Paint.NET now available
PostPosted: Sat Jul 08, 2006 4:32 pm 
Offline

Joined: Sat Jul 08, 2006 4:24 pm
Posts: 39
Location: Cambridge, England
NOTE: Version 1.11 of this plugin is built in to Paint.NET v3.10. So if you have that version of Paint.NET installed, you don't need to download this plugin, it's already there! --Rick

Hi,

This is a file type plugin I've written for Paint.NET. It allows for the loading & saving of a number of types of DDS file. It can read & write DXT1, DXT3, DXT5, A8R8G8B8, X8R8G8B8, A8B8G8R8, X8B8G8R8, A4R4G4B4, A1R5G5B5, R8G8B8 and R5G6B5 texture formats, and can generate mipmaps should you want them. The plugin supports Win32 and x64 systems, and utilises the Squish compression library written by a friend & colleague of mine, Simon Brown.

Options
When saving a DDS file, you can adjust options using the GUI.

Use the drop-down list to select the type of file you wish to output.

You can customise the compressor type and colour error metric to use when outputting DXT files. For compressor type you can choose from a slow (but high quality) iterative fit, a slightly faster non-iterative cluster fit, or a faster (but lower quality) range fit.The error metric setting allows you to tune the compression behaviour based on whether it's a texture that's going to be viewed normally (where the eyes colour perception properties are taken into consideration), or whether it's going to be used as input to some other function/process (where the actual numeric values are more important than how it looks).

When using the higher quality cluster fit (the default), an additional flag can be set that weights the colour of each pixel by its alpha value. For images rendered using alpha lending, this can significantly increase the perceived quality.

For all image formats, you can enable the generation of mipmaps. This creates all levels down to 1x1.

As this is now part of Paint.NET (from 3.10 onwards), there's no installation process. And if you need the source, simply grab a copy of the Paint.NET source code.

Cheers,
Dean

p.s. Reason for edit is to remove image links to my site, in preparation for a long-overdue site clean-up..


Last edited by Dean Ashton on Mon May 05, 2008 4:26 pm, edited 16 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 4:37 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
Cool! There've been several requests for this support ... I'm sure someone will find it useful :) I'll be sure to redirect anyone asking for this over here.

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 4:42 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
Moved to Plugins section

Does this work in 64-bit Windows? I'm guessing that it currently does not, as the Squish DLL is most likely compiled for 32-bits. It's very important that this work in 64-bit Windows (just like everything else Paint.NET-related).

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 4:58 pm 
Offline

Joined: Sat Jul 08, 2006 4:24 pm
Posts: 39
Location: Cambridge, England
Rick Brewster wrote:
Does this work in 64-bit Windows? I'm guessing that it currently does not, as the Squish DLL is most likely compiled for 32-bits. It's very important that this work in 64-bit Windows (just like everything else Paint.NET-related).


Unfortunately I don't actually have a machine with 64-bit windows on it, so I'm unsure as to the status of it. I can't see why SquishInterface.dll couldn't have a 64-bit version built for it .. but is there a way to automagically choose an import from either the 64 or 32-bit version of a DLL?

I'm afraid I don't have much experience in this area, but if you can offer some advice I'd be happy to make the necessary modifications to make it work in a 64-bit environment.

Cheers,
Dean


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 5:23 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
For a C++ project you should be able to add a 64-bit build target like so:

1. Right click on the project in the Solution Explorer, then click on Properties
2. Click on "Configuration Manager..." in the upper right. Right now you probably only have "Win32".
3. Under "Active Solution Platform", choose "New..."
4. Choose "x64" under "Type or select the new platform". Under "Copy settings from", make sure it says Win32, and make sure the checkbox for "Create new project platforms" is enabled.
5. Click all the OK buttons until you're back out of the dialog boxes.
6. Now in the toolbar you should be able to choose "Release" or "Debug", as well as "Win32" or "x64".

Once you compile the 64-bit DLL, rename it to something like SquishInterface_x64.dll. Then, in your C# code, you will want to structure your NativeMethods like so:

Code:
using System.Runtime.InteropServices;

internal sealed class NativeMethods
{
    private static bool is64bit;

    static NativeMethods()
    {
        is64bit = (Marshal.SizeOf(IntPtr) == 8);
    }

    /// trampoline function for SquishInterface[_x64].dll::SomeFunction
    internal static int SomeFunction(int param1, int param2)
    {
        if (is64bit)
        {
            return NativeMethods_64.SomeFunction(param1, param2);
        }
        else
        {
            return NativeMethods_32.SomeFunction(param1, param2);
        }
    }

    private sealed class NativeMethods_32
    {
        [DllImport("SquishInterface.dll")]
        public static extern int SomeFunction(int param1, int param2);
    }
   
    private sealed class NativeMethods_64
    {
        [DllImport("SquishInterface_x64.dll")]
        public static extern int SomeFunction(int param1, int param2);
    }
}


Essentially for each P/Invoke you have, you must import both the 32-bit and 64-bit version, and then have a trampoline that figures out which one to call. If you have a lot of methods that you're importing for P/Invoke then this can be a major hassle, but that should be easy to solve by writing a quick code generation program that does reflection on your existing NativeMethods class.

Let me know if you have any other questions.

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 5:34 pm 
Offline

Joined: Sat Jul 08, 2006 4:24 pm
Posts: 39
Location: Cambridge, England
That's just the information I needed.. thanks v.much Rick!

I'll make the changes now, and post up when a new build is available.

Cheers!
Dean


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 6:36 pm 
Offline

Joined: Sat Jul 08, 2006 4:24 pm
Posts: 39
Location: Cambridge, England
Ahoyhoy,

Ok, version 1.1 is up on my site, with untested support for x64 platforms. If someone with a 64-bit OS could give it a shot, and let me know whether it works, I'd be particularly grateful.

I'll look at any problems tomorrow.. but now, I need to go watch the World Cup 3rd place match.. :)

Cheerio,
Dean


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 6:37 pm 
Offline
User avatar

Joined: Fri May 12, 2006 6:49 pm
Posts: 1134
Location: Leiria, Portugal
I'll watch it too! GO PORTUGAL!!!!

VAMOS REBENTAR COM O ESTÃ

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:06 pm 
Offline

Joined: Wed Mar 08, 2006 3:58 am
Posts: 362
Does a Windows XP Professional SP2 with an Athlon 64 X2 count as an x64?

_________________
Image
I built my first computer at age 11!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:07 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
Born2killx wrote:
Does a Windows XP Professional SP2 with an Athlon 64 X2 count as an x64?

No. You must have a 64-bit version of Windows installed.

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:11 pm 
Offline
User avatar

Joined: Fri Jul 07, 2006 2:00 am
Posts: 45
This will be great for me as I do Microsoft Flightsim repaints and they are saved in the DXT3 format. It'll save me having to use a second bit of software as a go between.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:15 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
It appears to be working fine in 64-bit mode (I tested on my 2.4GHz Conroe), but I don't have any experience with DDS and as such am not exactly sure how to verify it other than that it did not crash or anything.

Anyway here's some general feedback:

* In your SaveConfigWidget, I recommend using the HeaderLabel control that is in PdnLib.dll instead of the GroupBox. We use this everywhere else in Paint.NET for aesthetic reasons. Using it should be quite easy. GroupBoxes are soooo 1990's ;)

* Make sure to set your ComboBox.DropDownStyle to DropDownStyle.DropDownList. Otherwise I can type arbitrary text in there, which doesn't make sense in this context.

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:16 pm 
Offline

Joined: Wed Mar 08, 2006 3:58 am
Posts: 362
http://img92.imageshack.us/img92/4176/0 ... 8313jn.png

There must be a bug or whatever, when i tried to save it as .dds, when it went to the save configuratin window, when it was computing the filesize and trying to show the preview, Paint.NET had to close.

_________________
Image
I built my first computer at age 11!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 08, 2006 11:17 pm 
Offline
Paint.NET Lead Developer
User avatar

Joined: Tue Jul 19, 2005 6:22 pm
Posts: 8878
Location: Kirkland, WA
Oh and:

* Edit your first post and include some screenshots :)

_________________
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html
Paint.NET Search Engine: http://searchpaint.net

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 09, 2006 12:25 am 
Offline
User avatar

Joined: Fri Sep 02, 2005 4:44 pm
Posts: 2835
Location: Lyon, France
Quote:
There must be a bug...

Same here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 65 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosted by Forumer & phpBB

Get your Forumer™ today!

Adding a forum to your website is a great way to get return visitors.

» Get your own Free Forum!

Terms of Use

Privacy Policy

Report Abuse

Copyright © 2003-2009 Forumer. All Rights Reserved. | Copyright © paint.NET