Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Moire effect

Moire effect

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    Does anyone meet the sitation when a image with many horizontal lines, with low levels zoom (when image is fit to window), is seen with moire effect ? And the drawing is made in classic way:

    ...
    pDC->SetStretchBltMode(COLORONCOLOR);
    pDC->StretchBlt(xDst, yDst, nDstWidth, nDstHeight, pMemDC, xSrc, ySrc, nSrcWidth, nSrcHeight, SRCCOPY);
    ...

    I had tried with stretch mode HALFTONE, with the same results ... After all, I dind't know where the problem come ... (P.S. I draw with GDI).

    C J 2 Replies Last reply
    0
    • _ _Flaviu

      Does anyone meet the sitation when a image with many horizontal lines, with low levels zoom (when image is fit to window), is seen with moire effect ? And the drawing is made in classic way:

      ...
      pDC->SetStretchBltMode(COLORONCOLOR);
      pDC->StretchBlt(xDst, yDst, nDstWidth, nDstHeight, pMemDC, xSrc, ySrc, nSrcWidth, nSrcHeight, SRCCOPY);
      ...

      I had tried with stretch mode HALFTONE, with the same results ... After all, I dind't know where the problem come ... (P.S. I draw with GDI).

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      You might try my DLL[^].

      Veni, vidi, vici.

      _ 1 Reply Last reply
      0
      • C CPallini

        You might try my DLL[^].

        Veni, vidi, vici.

        _ Offline
        _ Offline
        _Flaviu
        wrote on last edited by
        #3

        Thank you, I doubt that you have an VC6 version of your project ... :) Do you ? And one thing, what is the source of the problem ? From where the problem came from ?

        C 1 Reply Last reply
        0
        • _ _Flaviu

          Thank you, I doubt that you have an VC6 version of your project ... :) Do you ? And one thing, what is the source of the problem ? From where the problem came from ?

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Nope. However, the DLL project contains just two important files, namely resample.c and resample.h. You may generate a DLL project skeleton via Visual Studio 6 Application Wizard and then add such files to it (probably you have to replace the generated header and source). It should be simple. You may even embed the resample.c and resample.h content directly into your project (that is without the need of loading the DLL).

          Veni, vidi, vici.

          1 Reply Last reply
          0
          • _ _Flaviu

            Does anyone meet the sitation when a image with many horizontal lines, with low levels zoom (when image is fit to window), is seen with moire effect ? And the drawing is made in classic way:

            ...
            pDC->SetStretchBltMode(COLORONCOLOR);
            pDC->StretchBlt(xDst, yDst, nDstWidth, nDstHeight, pMemDC, xSrc, ySrc, nSrcWidth, nSrcHeight, SRCCOPY);
            ...

            I had tried with stretch mode HALFTONE, with the same results ... After all, I dind't know where the problem come ... (P.S. I draw with GDI).

            J Offline
            J Offline
            JackDingler
            wrote on last edited by
            #5

            It looks like someone has given you a solution, so I'll explain a bit why this happens. The resizing of your image using GDI is a simple re-sampling algorithm. When you shrink it, pixels in a horizontal and vertical direction are removed, at a semi regular spacing, to make the image fit the new size. This has the effect of producing a horizontal and vertical waveform in your image. Your parallel lines in the image, also make up a wave pattern. When these two wave patterns interact, you get an interference pattern and see the Moire' effect. http://en.wikipedia.org/wiki/Moire_effect[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups