Re: GDI+ DrawImage stretches incorrectly
From: alejandro lapeyre (alejandrolapeyre_at_jotmail.com)
Date: 02/25/05
- Next message: Schlauberger: "RE: VB.Net Control Checkbox Association"
- Previous message: Carlos J. Quintero [.NET MVP]: "3 ?"
- In reply to: Martin Maercker: "GDI+ DrawImage stretches incorrectly"
- Next in thread: Martin Maercker: "Re: GDI+ DrawImage stretches incorrectly"
- Reply: Martin Maercker: "Re: GDI+ DrawImage stretches incorrectly"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Feb 2005 07:33:00 -0300
your image is 1 pixel wide
does the height remain constant?
if you are in hurry you may do the following:
stretch to 2 or 4 pixels more than needed then copy the appropiate rectangle
to the ouput bitmap.
regards,
Alejandro Lapeyre
"Martin Maercker" <martin@tripper-bullet.com> escribió en el mensaje
news:55a71e8f.0502250130.4f5662be@posting.google.com...
> Dear group,
>
> I posted this question before but still don't have a clue why
> DrawImage _occasionally_ drops pixels. I don't want to be pushy but
> am under increasing time pressure to find a solution. So I hope
> you'll pardon me for trying again under a catchier subject line.
>
> I need to stretch a semitransparent, originally 1 pixel wide image to
> a new width that is set at runtime.
>
> I use:
>
> pGraphics->SetInterpolationMode(InterpolationModeNearestNeighbor);
> pGraphics->SetPixelOffsetMode(PixelOffsetModeHalf);
>
> pGraphics->DrawImage(pBmap,
> Rect(x,y,
> dynamicWidth,height),
> 0,0,width,height,
> UnitPixel,0,0,0);
>
>
> "width" and "height" are the width and height of the image to be
> stretched.
> "dynamicWidth" is the width that the output image is supposed to wind up
> having.
>
> This works fine for most widths. For _some_ widths, however, the resulting
> stretched image is one or two pixels too small. An example of such a width
> is 480 pixels. Problem is, my application needs to be able to set
> the exact size of the stretched image for all widths.
>
> How can I make sure that DrawImage will produce an image of exactly the
> specified size for every specified size?
>
>
> Any help greatly appreciated,
>
> Martin Maercker
- Next message: Schlauberger: "RE: VB.Net Control Checkbox Association"
- Previous message: Carlos J. Quintero [.NET MVP]: "3 ?"
- In reply to: Martin Maercker: "GDI+ DrawImage stretches incorrectly"
- Next in thread: Martin Maercker: "Re: GDI+ DrawImage stretches incorrectly"
- Reply: Martin Maercker: "Re: GDI+ DrawImage stretches incorrectly"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|