Re: Problem with Bitmap loading

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Davide (davide_pas_at_yahoo.it)
Date: 11/22/04


Date: Mon, 22 Nov 2004 19:34:27 +0100


Hallo Peter
I have already used the BitmapEx of opencf but... I have the same problem :-(
I also go into the source code..

public BitmapEx(string filename)
                {
                        if (File.Exists(filename))
                        {
                                hBitmap = GDIPlus.SHLoadImageFile(filename);<--------------------
                                //hBitmap = GDIPlus.LoadImageDec(filename);
                                
                                if (hBitmap == IntPtr.Zero)
                                        throw new FileNotFoundException("Invalid image file.");

                                GDIPlus.BITMAP bm = new GDIPlus.BITMAP();

                                GDIPlus.GetObject(hBitmap, Marshal.SizeOf(bm), ref bm);
                                width = bm.bmWidth; // Get width of bitmap
                                height = bm.bmHeight; // Get height of bitmap
                                widthBytes = bm.bmWidthBytes;
                                bitsPixel = bm.bmBitsPixel;

                        }
                        else
                                throw new FileNotFoundException("Image file doesn't exist.");
                }
this is the opencf source code library, and i think that SHLLoadImageFile (taken directly from
gdi I saw) has the same problem...
The max bitmap loaded is 2560x2560 and when I try to load a 3072x3072 image it goes to outofmemory
"Invalid image file" exception (and I assure you that the files is correct...):-(
I'm thinking to use the standart CreateDIBSection and fill all the structure manually using the well
know libtiff,jpeglib (compiled from vce if i can compile it) and using the standard libray functions
for bmp files.
If you have another suggest please,send me.

Bye,

Davide

> Alex Yakhnin's BitmapEx class in the Smart Device Framework
> (www.opennetcf.org/sdf/) may contain all the functionality you need, you can
> create a BitmapEx from a filename and then use GraphicsEx to draw this - its
> all done using native GDI P/Invokes, so could probably save you some time -
> I assume this will respect the bit-depth of the source image, but admit I
> haven't tested the theory.
>
> Peter
>



Relevant Pages

  • Re: __VA_ARGS__ and the DDK compiler
    ... filename, I am using the #line directive to ... some kind of hidden source code line which is inserted by the build tools ... Laurents C. R. Meyer ... > Laurents C. R. Meyer wrote: ...
    (microsoft.public.development.device.drivers)
  • Re: Characters allowed in short filenames
    ... the source code of the CheckNameLegalDOS8Dot3 API is the documentation of what characters are allowed in short filenames. ... even attempt to discuss what is valid in any OEM code page in the short name stored on the device. ... fatgen103.doc seems to have a slightly below average proportion of bugs, but Windows doesn't completely agree with it. ... > page is 850 then we are halfway towards allowing a short filename> to ...
    (microsoft.public.development.device.drivers)
  • Re: Attachment problem
    ... Take at look at the source code for that message by pressing Ctrl-F3. ... Does it show the filename of the attachment? ... In the security tab I have cleared the "Do not allow attachments to be saved or opened..." ...
    (microsoft.public.windows.vista.mail)
  • Re: Cannot import a module from a variable
    ... for which I was very grateful. ... # Imports all the modules in the sub-directory "directory" ... for filename in uncompiled_files: ... # Add any pre-compiled modules without source code. ...
    (comp.lang.python)