rect

'System.Windows.Rect' does not contain a definition for 'Intersects' for C#

送分小仙女□ 提交于 2019-12-11 08:54:43
问题 I am doing a collision on Windows Phone App for Windows Phone 8 using Microsoft Visual Studio 2012. I used Rect to make a rectangle border for the ball. I received this error. 'System.Windows.Rect' does not contain a definition for 'Intersects' and no extension method 'Intersects' accepting a first argument of type 'System.Windows.Rect' could be found (are you missing a using directive or an assembly reference?) The codes are as below. var greenBallPositionX1 = Canvas.GetLeft(this.greenBall1)

Rotate and scale view proportionally using Matrix

假如想象 提交于 2019-12-11 07:59:48
问题 Initially I am having following following values to draw ovel, RectF(0.0, 0.0, 164.0, 1112.0) Matrix{[1.0, 0.0, 370.97623][0.0, 1.0, 196.02643][0.0, 0.0, 1.0]} bitmap = Bitmap.createBitmap((int) rect.width(), (int) rect.height(), Bitmap.Config.ARGB_8888); bitmap.eraseColor(getColor()); Here is onDraw method, canvas.drawBitmap(bitmap, matrix, null); canvas.save(); canvas.concat(matrix); canvas.drawOval(0, 0, bitmap.getWidth(), bitmap.getHeight(), mPaint); Now I am getting following sc: after

Convert rectangle to surface in pygame

白昼怎懂夜的黑 提交于 2019-12-11 06:20:51
问题 In my code it keeps giving me the error: pygame.surface.Surface.blit(a, (x1, y1)) TypeError: descriptor 'blit' requires a 'pygame.Surface' object but received a 'pygame.Rect'. Help! This is my code: import pygame import time pygame.init() screen = pygame.display.set_mode() display_width = 1366 display_height = 768 white = (255,255,255) red = (255,0,0) green = (0,255,0) gameDisplay = pygame.display.set_mode((display_width,display_height)) clock = pygame.time.Clock() global x1 global y1 global

Pygame, move a square on the screen, but can not erase the previous movements

…衆ロ難τιáo~ 提交于 2019-12-11 04:24:30
问题 This is my first post in StackOverflow, hope you guys can help a newbie programmer. It's Pygame Python simple ask. I am trying to move a square on the screen, but can not erase the previous movements. import pygame pygame.init() screen = pygame.display.set_mode((400,300)) pygame.display.set_caption("shield hacking") JogoAtivo = True GAME_BEGIN = False # Speed in pixels per frame x_speed = 0 y_speed = 0 cordX = 10 cordY = 100 def desenha(): quadrado = pygame.Rect(cordX, cordY ,50, 52) pygame

how to draw a Bitmap on the Top Right of the Canvas

拜拜、爱过 提交于 2019-12-10 17:12:45
问题 I am trying to draw a bitmap on top right hand corner of the Canvas So far I have done the following: //100x40 dimensions for the bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.backbutton); Rect source = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); Rect bitmapRect = new Rect(0, 0, canvasWidth -200,50); canvas.drawBitmap(bitmap, source, bitmapRect, paint); The problem is that when I run the app, the bitmap doesn't appear on the screen. Full code: public class

Unity 三种截屏方式以及截屏时出现的问题

丶灬走出姿态 提交于 2019-12-10 16:39:19
参考链接: https://blog.csdn.net/qq_33337811/article/details/69421936 参考链接: https://www.jianshu.com/p/460803bbd5a9 第一种:使用ScreenCapture进行截屏,只能截全屏,不针对相机 /// <summary> ///第一种: unity自带的全屏截图 /// </summary> public void OneShot() { var url = path + "OneShot" + Time.realtimeSinceStartup.ToString() + ".png"; ScreenCapture.CaptureScreenshot(url); Application.OpenURL(path); } 第二种:利用Texture2D读取屏幕像素进行截图,可以自定义屏幕范围大小 /// <summary> /// 第二种:利用屏幕像素进行截图 /// </summary> /// <returns>The screenshot2.</returns> /// <param name="rect">Rect.截图的区域,左下角为o点</param> private Texture2D CaptureScreenshot2(Rect rect,string url) { /

KineticJS: right click fires click

扶醉桌前 提交于 2019-12-10 09:43:50
问题 I'm using Kineticjs and I'm defining a rect event like this this.rect.on('click tap', function(){ foo(); }); The event is fired when I left-click, but also when right-click. How can I avoid to fire this event with right-click? (I can't disabled the right-click in the page because I want to open a context menu if I rightclick over the rect) Thank you 回答1: You need to filter out right mouse click this.rect.on('click tap', function(e){ // 1:left, 2: middle, 3: right, for IE 8, e.button != 2 if

c# GDI+简单绘图(二)

亡梦爱人 提交于 2019-12-10 06:30:03
在上一片里已经向大家介绍了如何使用GDI+绘制简单的图像,这一片继续向大家介绍其它一些绘图知识. 1. 首先我们来看下上一片中我们使用过的Pen. Pen的属性主要有: Color(颜色),DashCap(短划线终点形状),DashStyle(虚线样式),EndCap(线尾形状), StartCap(线头形状),Width(粗细)等. 我们可以用Pen 来画虚线,带箭头的直线等 Pen p = new Pen(Color.Blue, 5);//设置笔的粗细为,颜色为蓝色 Graphics g = this.CreateGraphics(); //画虚线 p.DashStyle = DashStyle.Dot;//定义虚线的样式为点 g.DrawLine(p, 10, 10, 200, 10); //自定义虚线 p.DashPattern = new float[] { 2, 1 };//设置短划线和空白部分的数组 g.DrawLine(p, 10, 20, 200, 20); //画箭头,只对不封闭曲线有用 p.DashStyle = DashStyle.Solid;//恢复实线 p.EndCap = LineCap.ArrowAnchor;//定义线尾的样式为箭头 g.DrawLine(p, 10, 30, 200, 30); g.Dispose(); p.Dispose();

D3.js 动画 过渡效果 (V3版本)

我的梦境 提交于 2019-12-10 02:34:30
一 、 过渡的启动 启动过渡效果,与以下四个方法相关: d3.transition([selection],[name]) //创建一个过渡对象。但是由于每个选择集中都有transition()方法,可用d3.select("rect").transition()的方式来创建过渡,因此一般不直接用d3.transition()。 transition.delay([delay]) //设定延迟的时间。过渡会经过一定时间后才开始发生。单位是毫秒。 transition.duration([duration]) //设定过渡的持续时间(不包括延迟时间),单位是毫秒。如:duration(2000),是持续2000ms。 transition.ease(vlaue[,arguments]) //设定过渡样式,例如线性过渡、在目标处弹跳几次等方式。 接下来制作一个过渡效果: 1     var width = 600; 2 var height = 400; 3 4 var svg = d3.select("#body") 5 .append("svg") 6 .attr("width",width) 7 .attr("height",height) 8 9 svg.append("rect") 10 .attr("fill","yellow") 11 .attr("x",100) 12

[翻译]Android接口定义语言 (AIDL)

孤人 提交于 2019-12-09 15:00:55
AIDL(Android接口定义语言)与你可能使用过的其它的IDLs是类似的。它允许你定义客户端与service协调一致的编程接口,以便于彼此之间使用进程间通信(IPC)机制进行通信。在Android上,一个进程通常不能访问另一个进程的内存。可以说,它们需要把它们的对象分解为操作系统能够理解的原始数据类型,并在进程之间按次序排列对象。那种排列对象的代码写起来是很乏味的,因此Android通过AIDL来为你处理这些事情。 注意: 只有在你允许来自于不同的应用的客户端访问你的service以实现IPC,并想要在你的service中处理多线程时,才需要使用AIDL。如果你不需要跨不同应用执行并发IPC,你应该通过 实现一个Binder 来创建你的接口,或者如果你想要执行IPC,但不需要处理多线程,可以 使用一个 Messenger 来实现你的接口。无论哪种,请确保在实现一个AIDL之前,你理解了 Bound Services 。/ 在开始设计你的AIDL接口之前,请意识到对于一个AIDL接口的调用是 直接的函数调用 (大概指的是阻塞调用,在调用一个IPC方法时,客户端线程会一直等待,直到service端处理完成并返回) 。你不应该假设调用所发生的线程。依赖于调用是来自于本进程的一个线程,还是一个远端进程,则会发生不同的事情。特别地: 发起于本进程的调用将在发起调用相同的线程中执行