graphics

.net onpaint vertical sync

家住魔仙堡 提交于 2020-01-02 06:24:09
问题 I'm trying to implement some animation using winforms and gdi+, but I get a lot of tearing moving sprites inside a control. Is there a way in managed .net to have the overriden Control.OnPaint method wait for the vertical retrace of the monitor? 回答1: Are you already using double buffering? If not I would suspect that would remove the tearing, and it is simpler than trying to wait for the vertical retrace. 来源: https://stackoverflow.com/questions/819762/net-onpaint-vertical-sync

How do you create an off-center PerspectiveCamera in WPF?

99封情书 提交于 2020-01-02 06:00:30
问题 I'm trying to more or less recreate Johnny Lee's Wii head tracking app, but using an augmented reality toolkit for the tracking, and WPF for graphics. To do this, I need to create a perspective camera using the top, bottom, right, and left parameters to create my viewing frustum, instead of field of view and aspect ratio (to those familiar with OpenGL, I want to use the WPF equivalent of glFrustum instead of gluPerspective) The problem is, those options don't seem to be available on WPF's

How do you create an off-center PerspectiveCamera in WPF?

早过忘川 提交于 2020-01-02 06:00:22
问题 I'm trying to more or less recreate Johnny Lee's Wii head tracking app, but using an augmented reality toolkit for the tracking, and WPF for graphics. To do this, I need to create a perspective camera using the top, bottom, right, and left parameters to create my viewing frustum, instead of field of view and aspect ratio (to those familiar with OpenGL, I want to use the WPF equivalent of glFrustum instead of gluPerspective) The problem is, those options don't seem to be available on WPF's

java printing - setting size of the border

本小妞迷上赌 提交于 2020-01-02 05:30:29
问题 I try to set the size to zero or remove the border of a printed document in java. It always has a standard white border. Here is my function printing a JPanel and some components: public void printComponent(){ PrinterJob pj = PrinterJob.getPrinterJob(); pj.setJobName(" Print Component "); pj.setPrintable (new Printable() { @Override public int print(Graphics pg, PageFormat pf, int pageNum) throws PrinterException { if (pageNum > 0){ return Printable.NO_SUCH_PAGE; } Graphics2D g2 = (Graphics2D

Checking if a point is inside a rotated rectangle

我怕爱的太早我们不能终老 提交于 2020-01-02 05:18:30
问题 I know this question has been asked a few times before, and I have read various posts about this. However I am struggling to get this to work. bool isClicked() { Vector2 origLoc = Location; Matrix rotationMatrix = Matrix.CreateRotationZ(-Rotation); Location = new Vector2(0 -(Texture.Width/2), 0 - (Texture.Height/2)); Vector2 rotatedPoint = new Vector2(Game1.mouseState.X, Game1.mouseState.Y); rotatedPoint = Vector2.Transform(rotatedPoint, rotationMatrix); if (Game1.mouseState.LeftButton ==

nVidia SLI Tricks [closed]

我的梦境 提交于 2020-01-02 05:04:28
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 months ago . I'm optimizing a directx graphics application to take advantage of nVidia's SLI technology. I'm currently investigating some of the techniques mentioned in their 'Best Practices' web page, but wanted to know what advice/experience any of you have had with this? Thanks! 回答1:

Is it possible to enable hardware acceleration with Java FX on Windows 2008 server?

别说谁变了你拦得住时间么 提交于 2020-01-02 04:39:05
问题 As discussed in this question, it's possible to detect whether Java FX is using hardware acceleration by passing -Dprism.verbose=true as a system property. When I do this on my Java FX app on Windows 2008 Server R2, it is apparently falling back to the software rendering: Prism pipeline init order: d3d j2d Using t2k for text rasterization Using dirty region optimizations Prism pipeline name = com.sun.prism.d3d.D3DPipeline Loading D3D native library ... succeeded. Direct3D initialization

Can an SVG vector graphic be converted to a PNG file format for use in Fireworks?

天大地大妈咪最大 提交于 2020-01-02 04:33:08
问题 As many of you know, there are quite a few websites that sell royalty free graphics. Some sites sell vector graphics (svg) or give you the option to download them as such. I don't have a graphics editor that will support SVG. Currently, I'm working with an older version of Fireworks. I cannot open a SVG file type. (I also cannot afford to purchase PhotoShop or Illustrator software). I'm running Windows on my PC. Questions : What are my options? Is there a SVG to PNG converter? Would the

Java - Draw text in the center of an image

夙愿已清 提交于 2020-01-02 04:08:19
问题 I need to write text in the center of an image. The text to write is not always the same. The code I'm using is here: // Here I first draw the image g.drawImage(img, 22, 15, 280, 225, null); // I get the text String text = photoText.getText(); // Set the text color to black g.setColor(Color.black); // I draw the string g.drawString(text, 79.5F, 220.0F); The problem is that the text isn't at the center of the image, what can I do? I only need to draw the text at the horizontal center. 回答1:

Save rendered HTML as image

最后都变了- 提交于 2020-01-01 18:42:26
问题 I am building a web app that needs to export a div to an image. That div will contain images, other divs, text with css styling, etc. At the end, the user should have an image that would look the same as if he had taken a screenshot of that div. I 've looked into server-side php libs but I don't see anything that would handle the complexity of the rendered HTML. HTML5 canvas has that capability but I can't use a canvas for my case. Any ideas? Thanks! 回答1: Check out html2canvas. A javascript