Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration #2

Closed
vmv opened this issue Nov 28, 2016 · 3 comments
Closed

Integration #2

vmv opened this issue Nov 28, 2016 · 3 comments

Comments

@vmv
Copy link

vmv commented Nov 28, 2016

Hi,
I want to use your code in another application that has a very old dds reader and is not updated or working anymore...
The question is how do i use your app into this function, how to call it:

private void DDSFile(FileRecord selectedRecord)
{
    var buffer = selectedRecord.ReadData(path);
    ImageOutput.Visibility = Visibility.Visible;
    //var dds = new DDSImage(buffer);
    using (var ms = new MemoryStream())
    {
        //dds.ddsImage[0].Save(ms, ImageFormat.Png);
        var bmp = new BitmapImage();
        bmp.BeginInit();
        bmp.CacheOption = BitmapCacheOption.OnLoad;
        bmp.StreamSource = ms;
        bmp.EndInit();
        ImageOutput.Source = bmp;
    }
} 

Old calls are commented.
Thank you in advance for any small help.

@andburn
Copy link
Owner

andburn commented Nov 29, 2016

I think the following changes should work for you. I can't tell what type buffer is exactly, but I guess its a byte[] so should be fine.

using Imaging.DDSReader; // <--

private void DDSFile(FileRecord selectedRecord)
{
    var buffer = selectedRecord.ReadData(path);
    ImageOutput.Visibility = Visibility.Visible;
    var dds = DDS.LoadImage(buffer); // <--
    using (var ms = new MemoryStream())
    {
        dds.Save(ms, ImageFormat.Png); // <--
        var bmp = new BitmapImage();
        bmp.BeginInit();
        bmp.CacheOption = BitmapCacheOption.OnLoad;
        bmp.StreamSource = ms;
        bmp.EndInit();
        ImageOutput.Source = bmp;
    }
} 

@vmv
Copy link
Author

vmv commented Nov 29, 2016

I get this and other error no matter how i try:....Details: Object reference not set to an instance of an object.
The "buffer" is byte[] yes.

This is the program that i want to integrate it: https://github.com/vmv/VisualGGPK/tree/master/VisualGGPK

Thank you,..

@andburn
Copy link
Owner

andburn commented Nov 29, 2016

I'm not sure, it looks like it should work. I don't have PoE to test it out, sorry.

@vmv vmv closed this as completed Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants