Chechu
April 18th, 2008, 01:33 PM
Hi, I have found a problem displaying some tiff images using gdiplus.dll functions. I obtain first the image´s size using methods GetHeight and GetWidth of Image class. I obtain too the heigth and width of screen using GetSystemMetrics function. With both I get the value for displaying the image in the middle of screen. This method works correctly for jpeg, bmp, gif formats and for some tiff format images. But in others tiff format images it seems the value os height and width of image is not according with screen coordinates (I checked that I need multiply by 1.3 aproximately for these coordinates fix).
For example:
// Screen dimensions
xScr = GetSystemMetrics(SM_CXSCREEN);
yScr = GetSystemMetrics(SM_CYSCREEN);
// Image dimensions
image = new Image(swzPath);
LengthImage=image->GetHeight();
WidthImage = image->GetWidth();
// Displaying
Graphics graphics(hdc);
iPosHor = (xScr-WidthImage)/2;
iPosVer = (yScr-LenghtImage)/2;
graphics.DrawImage(image, iPosHor, iPosVer);
with file pr2plus.tif works correctly, but with file imagen500.tif or imagen.tif you need multiply LengthImage and WidthImage for displaying image in the middle.
Is there another parameter that I must consider for displaying?
I attached cpp code, exe, and tif files for testing.
Thanks.
For example:
// Screen dimensions
xScr = GetSystemMetrics(SM_CXSCREEN);
yScr = GetSystemMetrics(SM_CYSCREEN);
// Image dimensions
image = new Image(swzPath);
LengthImage=image->GetHeight();
WidthImage = image->GetWidth();
// Displaying
Graphics graphics(hdc);
iPosHor = (xScr-WidthImage)/2;
iPosVer = (yScr-LenghtImage)/2;
graphics.DrawImage(image, iPosHor, iPosVer);
with file pr2plus.tif works correctly, but with file imagen500.tif or imagen.tif you need multiply LengthImage and WidthImage for displaying image in the middle.
Is there another parameter that I must consider for displaying?
I attached cpp code, exe, and tif files for testing.
Thanks.