rect

C++中调用WPF

心已入冬 提交于 2019-12-09 04:14:01
使用C++来开发WPF,主要是如何在MFC(Win32)的窗口中HostWPF的Page。下面我就做个详细的介绍。 1创建工程 创建工程, 由于MFC的Wizard会生成很多用不到的代码,所以我准备从一个空的工程开始创建一个MFC的工程。 1) 打开VS2008,菜单File->New->Projects…, 左面选择Visual C++->Win32,右面选择Win32 ConsoleApplication,给工程起个名字CTest_WPF, Ok进入下一步。 2) 工程基本配置,在Application Setting中选择Console Application和MFC。Finish进入下一步。 3) 修改工程,使工程变成MFC Windows程序。 Ø 删除CTest_WPF.cpp和CTest_WPF.h文件 Ø 添加CWinApp派生类Test_WPFApp, 在工程上点击鼠标右键,Add=>Class… 在弹出的对话框中,左边选择MFC,右面选择MFC Class,点击Add进入下一步 在弹出的对话框中输入类名: CTest_WPFApp, 基类选择CWinApp Ø 用同上的方法添加CWnd派生类,Class name为CTest_WPFMainWnd,Base class为CWnd。 Ø 修改工程属性。将属性中的System-

wpf中无边框窗体的问题

僤鯓⒐⒋嵵緔 提交于 2019-12-09 03:20:22
无边框窗体最大化显示超出屏幕外的解决方案 相关: https://stackoverflow.com/questions/12884987/wpf-borderless-window-on-maximize-exceeds-window-height-and-width?rq=1 Solved: 通过修改 ResizeMode = ResizeMode.NoResize 可以有效的解决该问题,但需要注意的是在其它窗口状态下ResizeMode需要恢复原先值。具体代码如下: private ResizeMode _preResizeMode; private void BtnMax_OnClick(object sender, RoutedEventArgs e) { _preResizeMode = this.ResizeMode; this.ResizeMode = ResizeMode.NoResize; this.WindowState = WindowState.Maximized; } private void BtnNormax_OnClick(object sender, RoutedEventArgs e) { this.ResizeMode = _preResizeMode; this.WindowState = WindowState.Normal; }

converting an image to a rect

旧时模样 提交于 2019-12-08 12:52:28
问题 this script spawns a alien that follows the player, i just want to know how to make the alien (nPc) and the player (mouse_c) a rect so i make the alien kill the player when the imagers overlap. any help would really help thanks import pygame, sys, random, time, math from pygame.locals import * pygame.init() bifl = 'screeing.jpg' milf = 'character.png' alien = 'alien_1.png' screen = pygame.display.set_mode((640, 480)) background = pygame.image.load(bifl).convert() mouse_c = pygame.image.load

How to keep a color in a fill() the same after mousePressed?

二次信任 提交于 2019-12-08 05:48:45
问题 What would be the easiest and simplest way to keep the fill() the same after clicking (that's when it changes) and then unclicking, and leaving hover? In this project, I simply made a grid. When the mouse hovers over a specific rect (at x , y ) it changes color based on the state it is in. fill(50) is the default, fill(75) is when the mouse is hovering, and fill(100) is when the mouse clicks. But here when the mouse is unclicked it returns to hover fill until the mouse leaves the rectangle.

Why does pygame.draw.shape return a Rect?

喜你入骨 提交于 2019-12-08 04:07:33
问题 Although I understand that the purpose of the draw function is to draw to a certain surface, I don't understand why it doesn't simply return a pygame.Surface object that you can later blit to a surface whenever needed. So far this has been very inconvenient when I just want to create a surface and draw it to something else later. Is there any way that you can get similar functions to return a surface object, instead of going that extra step and drawing directly to another surface? 回答1: To

iOS UIImageView自适应图片大小

南笙酒味 提交于 2019-12-08 03:23:08
窗口大小获取: CGRect screenBounds = [ [UIScreenmainScreen]bounds];//返回的是带有状态栏的Rect CGRect rect = [ [UIScreenmainScreen]applicationFrame];//不包含状态栏的Rect UIImageView: 一 :圆角以及自适应图片大小 UIImage* image = [UIImage imageNamed:@"image.png"]; UIImageView* imageView = [[[UIImageView alloc] initWithImage:image] autorelease]; imageView.frame = CGRectMake(0, 0, 300, 200); imageView.layer.cornerRadius = 8; imageView.layer.masksToBounds = YES; //自适应图片宽高比例 imageView1.contentMode = UIViewContentModeScaleAspectFit; 二 图片自适应UIImageView (来源于:http://www.61ic.com/Mobile/iPhone/201103/29636.html) - (UIImage *

UIImageView自适应图片大小

杀马特。学长 韩版系。学妹 提交于 2019-12-08 03:22:10
转自:http://www.cnblogs.com/zhidao-chen/archive/2013/05/20/3088164.html 窗口大小获取: CGRect screenBounds = [ [ UIScreenmainScreen ] bounds ]; // 返回的是带有状态栏的 Rect CGRect rect = [ [UIScreenmainScreen]applicationFrame];//不包含状态栏的Rect UIImageView: 一 :圆角以及自适应图片大小 UIImage* image = [UIImage imageNamed:@"image.png"]; UIImageView* imageView = [[[UIImageView alloc] initWithImage:image] autorelease]; imageView .frame = CGRectMake(0, 0, 300, 200); imageView.layer.cornerRadius = 8; imageView.layer.masksToBounds = YES; //自适应图片宽高比例 imageView1.contentMode = UIViewContentModeScaleAspectFit; 二 图片自适应UIImageView (来源于:http

opencv在图片指定区域内填充矩形,并在图片中显示矩形的轮廓

孤人 提交于 2019-12-08 02:59:32
需求: 在图片中画出指定区域的轮廓 解决方法: 先在图片中填充一块矩形,然后画出矩形的轮廓在图片中显示 //画出指定区域的轮廓; #include "stdafx.h" #include <highgui.h> #include <cv.h> using namespace cv; int _tmain( int argc, _TCHAR* argv[]) { Mat img= imread( "图片.JPG" ); Mat mask = Mat::zeros(img.size(),CV_8UC1); Rect rect; rect.x = 100 ; rect.y = 100 ; rect.width = 100 ; rect.height = 100 ; mask(rect).setTo( 255 ); vector < vector <Point> > v; //存储轮廓 vector <Vec4i> hierarchy; findContours(mask,v,hierarchy,CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); drawContours(img,v, 0 ,CV_RGB( 255 , 0 , 0 ), 1 , 8 ); imshow( "img" ,img); waitKey(); return 0 ; } 来源: CSDN

opencv形状识别学习总结

时间秒杀一切 提交于 2019-12-08 02:51:54
OpenCV基元检测 Primitive Detection 目录 基元的概念 基元泛指图像中有特点的单元。常说的基元有:边缘、角点、斑点、直线段、圆、等 基元检测是图像分析的基础 边缘(Edge)检测 边缘是图像中像素灰度值发生剧烈变化而不连续的结果 边缘是赋予单个像素的一种性质,与图像函数在该像素的一个邻域内的梯度特性相关 边缘幅值:梯度的幅值 边缘方向:梯度方向旋转-90度 边缘检测既是常见基元检测的基础,也是基于边界的图像分割的第一步。 边缘检测算法 OpenCV边缘检测:Sobel、拉普拉斯算子 OpenCV边缘检测:坎尼算子算子 斑点(Blob)检测 斑点:与周围灰度有一定差别的区域 面部的雀斑 卫星照片中的一棵数 钢材X光照片中的杂质或气泡 医学图像中的细微肿块 斑点检测算法 OpenCV LoG算子:SIFT算法 OpenCV Blob特征检测算子 角点(Conner)检测 角点:物体的拐角、交叉点、 曲线上曲率最大的点等 角点的邻域是图像中信息比较丰富的区域 角点检测方法 基于边缘的方法:在小邻域内有两个不同的主边缘方向,实际图像中,孤立点、线段端点也会有类似特 性。缺点是:1)需要先提取边缘并编码,计算量大;2)局部变化对稳定性影响大。 基于灰度的方法:计算点的曲率和梯度,目前的主流 角点检测算法: OpenCV 角点检测:Harris算子 哈夫变换

Determine if a rect is visible inside window

徘徊边缘 提交于 2019-12-07 20:06:48
问题 I would like to determine if a rect inside a window is completly visible. I have found RectVisible, but that function determines if any part of the rect is visible, I want to know if the entire rect is visible. Is there any function for this? 回答1: First get the system clipping region (the visible region of a window) into a region by using GetRandomRgn. Read more about the 'system region' here. Then, offset that region since it is in screen coordinates (the article I linked has an example).