|
-
September 19th, 2011, 02:49 PM
#1
[gdi+] DrawImage to specified size
I am trying to draw a bitmap on the screen 1" X 1.5" using this code:
Code:
status = GdipDrawImageRectRect(graphics, image, _
0, 0, 1, 1.5 , _
0, 0, 192, 288, _
UnitPixel)
The image draws correctly but draws to 1.3"X2"
What am I doing wrong?
-
September 19th, 2011, 02:52 PM
#2
Re: [gdi+] DrawImage to specified size
Maybe try specifying UnitInch instead of 'UnitPixel'?
Viggy
-
September 19th, 2011, 03:03 PM
#3
Re: [gdi+] DrawImage to specified size
Thanks for the suggestion.
I tried that; I get an error when GdipDrawImageRectRect executes
(and obviously nothing gets drawn).
-
September 19th, 2011, 03:36 PM
#4
Re: [gdi+] DrawImage to specified size
I'm not all that familiar with the GDI+ functions (anymore, it's been a while since I played around with them). Post the error, perhaps someone else can help.
Viggy
-
September 20th, 2011, 03:25 PM
#5
Re: [gdi+] DrawImage to specified size
If I set the last parameter of the GdipDrawImageRectRect function to UnitInch I get a Not Implemented error
If I do as below I get proper drawing except not to the specified dimension (want 1" X 1.5" get 1.3" X 2").
Code:
status = GdipSetPageUnit(graphics, UnitInch)
status = GdipDrawImageRectRect(graphics, image, _
0, 0 1, 1.5, _
0, 0, 192, 288, _
UnitPixel)
It is always out by a constant factor.
If I adjust to accomodate for this by multiplying by 72 / 96 as below it works properly.
Code:
status = GdipSetPageUnit(graphics, UnitInch)
status = GdipDrawImageRectRect(graphics, image, _
0, 0, 1 * 72 / 96, 1.5 * 72 / 96, _
0, 0, 192, 288, _
UnitPixel)
...but I don't understand the significance of * 72 / 96
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|