Re: GDI+ DrawImage stretches incorrectly

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

From: alejandro lapeyre (alejandrolapeyre_at_jotmail.com)
Date: 02/25/05


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



Relevant Pages

  • Re: True widescreen perhaps not that true....
    ... However, with the camera in 16:9, the image is visibly compressed X-wise. ... image to the normal 576 pixels width. ... DV avi) and played it back using a number of players. ... WMP will automatically stretch the picture. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Pocket Internet Explorer & SWF display widt
    ... stretch). ... pixels), Pocket IE "stretchs to fit" the HTML content, so the SWF is not ... How to remove this stretching feature? ... The Flash Ant application (standalone Flash player) displays the same HTML ...
    (microsoft.public.pocketpc)
  • Re: How long till DVD is dead?
    ... > That's only true if you take those pixels and stretch them along a line. ... I guess you don't actually understand "resolution" and how it's a 2D thing, ... Prev by Date: ...
    (alt.video.dvd)
  • Increasing size of TBitmap
    ... I have a TBitmap on my form (both autosize and stretch are false). ... Its width and height are 100 pixels. ... I also use its canvas to draw ...
    (alt.comp.lang.borland-delphi)
  • Who fucks rather, when Ratana connects the rich lock between the supper?
    ... stretch. ... He had absolutely no clue as to what had happened to her. ... was no enquiry he could make. ... a band of sticking-plaster round her wrist. ...
    (sci.crypt)