News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

GdipLoadImageFromFile example

Started by Vortex, February 19, 2021, 03:32:20 AM

Previous topic - Next topic

TouEnMasm


find a tga dumper who can be of great help (enum...)
Quote
TGA ---------------------------------------------- XING_T32.TGA --------------------------
ColorMap Type = 0
ImageType = 2   TGA_TRUECOLOR
ColorMap First = 0
ColorMap Length = 0
ColorMap Entry Size = 0
Origin 0, 0
Size: 240 by 164
Bits Per Pixel 32
Image descriptor 20
        TGA_FLAGS_INVERTY
Fa is a musical note to play with CL

TouEnMasm

reusing the dumpfile and the image given by LiaoMi (XING_T32.TGA) in C++.
Follow use of the Directx::ScratchImage class
Quote
int __cdecl wmain(int argc, wchar_t* argv[], wchar_t* envp[])
{
    const DirectX::Image* ImageStruct = 0 //  To show the content of Image struct

auto image = std::make_unique<ScratchImage>();
HRESULT hr = LoadFromTGAFile( L"XING_T32.TGA",nullptr, *image );
if ( FAILED(hr) )
    printf("LoadFromTGAFile failed");
else printf("LoadFromTGAFile REUSSITE \n");
//        size_t __cdecl GetPixelsSize() const { return m_size; }

ImageStruct = image->GetImages();
// image->m_image
printf("image width %d", ImageStruct->width );

Next step is to create a masm proto to call that.

Fa is a musical note to play with CL

Gunther

Yves,

thank you for your efforts.

Quote from: TouEnMasm on February 23, 2021, 03:23:41 AM
find a tga dumper who can be of great help (enum...)

The TGA header contains 18 bytes in which all information about the image and its display is stored. Reading these out and interpreting them correctly is really not witchcraft.
What MS has written in code for this simple task is very cumbersome. On the PowerBASIC page, you can find a TGA Viewer, written by me with PB 3.5 (DOS compiler).
The program can display True Color images and TGA images with DAC (256 colors) correctly. To be able to display large images, I used the XMS memory and worked with
VESA bank switching. The credits of the program still show my old mail address at CompuServe. So the program was written in the mid 90s.

Of course, my program has weaknesses. I am in the process of changing that. At that time VESA 2.0 was up to date and my program hard coded e.g. some VESA modes. 
The right thing to do, of course, is to get the list of available VESA modes and scan them etc.

Gunther   
You have to know the facts before you can distort them.

TouEnMasm


I have just a little problem with the upper function.
I can do manything to get informations and modify the file but ... I don't know how to view it ??
any idea ??
There is no DC given.
Fa is a musical note to play with CL

Gunther

Yves,

Quote from: TouEnMasm on February 25, 2021, 04:13:55 AM
I have just a little problem with the upper function.
I can do manything to get informations and modify the file but ... I don't know how to view it ??
any idea ??
There is no DC given.

not at the moment. Let me think about that.

Gunther
You have to know the facts before you can distort them.