YUV ddraw zoom + scroll bar + left button zoom in on the MFC dialog box, right-click zoom out

Source: Internet
Author: User

Method:

The general method is the same as the RGB zoom. Note that when you click the left mouse button to zoom in on the ddraw YUV video, the height and width of the ddraw surface may change, in this way, we need to zoom in and out with the new ddraw surface in time. When YUV is scaled and displayed, two objects access the members (coordinates) of the same class due to data interaction between several classes) cannot obtain the coordinate value. This problem can be solved using the single-State design mode in the design mode or using getparent () to obtain the objects in the parent class dialog box.

The scaling formula is as follows:

Imgrect:

Based on the magnification and the position of the scroll bar, determine which part of the pixels of the original image are displayed on the screen.

Calculate the relationship;

Set the horizontal position of the scroll bar to Sx, and the vertical position to Sy;

The screen size is CX, Cy

The magnification is m_zoom;

At this time, the coordinates of the corresponding original pixels are:

Pixel size = I _width * I _height;

 

In this case, the local original size is (RGB scaling ):

Imgrect. Left = (I _width-cx/m_zoom) * SX/max_scrollvalue;

Imgrect. Top = (I _height-cy/m_zoom) * SY/max_scrollvalue;

Imgrect. width = Cx/m_zoom;

Imgrect. Height = cy/m_zoom;

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.