为什么暂时加载的图像不正确? [英] Why the image loaded in temporary is not correct?

查看:76
本文介绍了为什么暂时加载的图像不正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将图像加载到临时DC时。控制器上的像素[15,50]为绿色。但是在临时直流中,它是[15,80]。



好​​像我的图像已经去了在温度DC下来。

我现在不知道为什么?。

任何人都可以帮助我吗?

我的第一个控制,用这个:

When i load image into temporary DC. the pixel[15,50]is green on the control .But in the temporary dc, It is [15,80].

It as if my image is go down in temp DC.
I don't now why?.
Could anyone help me?
my first control, use this:

void myfunction(CPoint point,CDC *dc)
{      CDC dcMem;
	dcMem.CreateCompatibleDC(dc);
	dcMem.SelectObject(bmpCOM);
	HDC hdcMem=dcMem;
	COLORREF clr= GetPixel(hdcMem,point.x,point.y);
}



我的第二个控件,我用LBUTTONDOWN直接点击控件。


My Second control, i click directly onn control with LBUTTONDOWN.

void CDirectClickCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	HWND hWnd=this->GetSafeHwnd();
	COLORREF clr=GetPixel(::GetDC(hWnd),point.x,point.y);

	COleControl::OnLButtonDown(nFlags, point);
}

推荐答案

将图像加载到内存中时,常常垂直翻转图像。



使用SetMapMode和SetViewPort函数定义DC的像素坐标和大小。
It is common for images to be flipped vertically, when you load them into memory.

Use the SetMapMode and SetViewPort functions to define the pixel coordinates and sizes for your DCs.


这篇关于为什么暂时加载的图像不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆