graphics

Draw tbitmap with scale and alpha channel faster

我的未来我决定 提交于 2019-12-24 09:27:33
问题 The following code copies a large bitmap blends it with the correct background and then draws a semi transparent image with a clipped region to save draw time... Images are in an array and prescaled... This has been through several levels of optimization based on my limited knowledge of C++ and the Builder graphics... Edit: Updated code... blend(); void blend(Graphics::TBitmap *dst,int x,int y,Graphics::TBitmap *src,BYTE alpha) { const int n=3; // pixel align [Bytes] int dx0,dy0,dx1,dy1, //

How to stop flickering in java.awt.graphics?

旧街凉风 提交于 2019-12-24 08:53:59
问题 So i started to learn Java and tried to create a basic pong game using java.awt.graphics. After finishing it i saw that it was a lot of flickering to the point when the game was unplayable. This is my main class named "pong"(What a creative name). package pong; import java.applet.Applet; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class pong extends Applet implements Runnable,KeyListener { public static void main(String[] args){} public final

Why am I getting this NullPointerException?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 08:38:36
问题 I can't figure this out. After initializing a Canvas with new Canvas(), referencing it results in a NullPointerException. The doc tells me this can occur when the Canvas is not "enabled", but I don't know what it means to be enabled. I tried to debug it by including while(! cvs.isEnabled()); but the program just hung. What are the conditions that could result in a Canvas not being enabled, and how do I fix them? Exception in thread "main" java.lang.NullPointerException at matt.io

what is path & subpath in Java2D?

一笑奈何 提交于 2019-12-24 08:33:10
问题 I hope it is not a silly question: What is path, subpath, and endpoint in Java2D? 回答1: Most commonly, a path is a combination of lines and cubic Bezier segments. This is represented procedurally by a sequence of moveTo, lineTo, curveTo, and closePath methods. These correspond to the operators of the same name in PostScript (but lowercased), from which the Java2D imaging model derives. (Also, there is quadTo, which is a quadratic Bezier segment, but this is less important and easily simulated

GPU Chipset Detection

徘徊边缘 提交于 2019-12-24 08:22:52
问题 Seeking most efficient method for retrieving the GPU model in Objective-C or Carbon. I want to avoid using system_profiler because it is slow, but if it comes down to that I am willing to use it, but I wanna exhaust other options first. 回答1: You could try glGetString(GL_RENDERER) from the OpenGL library. 来源: https://stackoverflow.com/questions/3171529/gpu-chipset-detection

Set up X-axis and Y-axis on Jmeter graphic

坚强是说给别人听的谎言 提交于 2019-12-24 08:18:02
问题 Basically I want to generate a graphic with a counter variable on X-axis and response time on Y-axis. I did a research and most of plugins can generate graphics but with X and Y axis predefined. I would like to try any approach to avoid writing a report file myself, but if it is the only possible way, then please give an example on how to do it. 来源: https://stackoverflow.com/questions/45418279/set-up-x-axis-and-y-axis-on-jmeter-graphic

How do I create a 3D polygon from a series of 3D points in three.js?

我是研究僧i 提交于 2019-12-24 08:16:04
问题 I wonder what would be the best way to generate a custom 3D polygon given an array of 3D points in three.js. It is a simple polygon without holes. The points are ordered so that they represent neighboring vertices.I can do it in 2D, but I don't want the vertices to be coplanar. Thank you for your help! 回答1: The main problem here is how to create a 3D mesh from a bunch of points. In other words: you need to figure out which of the vertices should be connect to form a triangle. This is an

DirectX capabilities on different graphics cards

大城市里の小女人 提交于 2019-12-24 07:59:05
问题 I'm writing a Direct3D application, using DirectX 9. Although it works on my PC, I need to make it work on a wide range of systems. I need to know what capabilities I can expect to see on other systems. Is there a list of the DirectX capabilities that graphics cards support? I've found one site, which I'll post as an answer, but it's a bit out of date. Edit #1: Of course I will test for all the capabilities before I use them. But there are two different approaches to a missing capability:

Paint a JPanel to a BufferedImage or Print it without rendering it to screen first

微笑、不失礼 提交于 2019-12-24 07:48:15
问题 Picture this... A program GUI JFrame that is split in 2, EAST and WEST. The first JPanel is just a print preview screen. The EAST side of the JFrame is where the user can create a 1 2 or 3 size image. The user clicks the "Add" button and the defined image on the right goes to the panel on the left. So if the user clicks "Add" 3 times with different size images, then the panel uses FlowLayout to organize the added panel images added on the left. When you run this code, you can see a sorta idea

Drawing and scaling rectangle using a ratio

人盡茶涼 提交于 2019-12-24 07:24:17
问题 I have a program where I can, with the mouse, draw a rectangle in any of four directions. These rectangles are used on a pictureBox to crop parts of an image. These rectangles must be drawn while maintaining the ratio of a given dimension for example 320 x 200. I want this tool to behave pretty much exactly like the crop tool in Photoshop, or like in the crop example found here: https://imageresize.org/ I have most elements working correctly I'm just struggling on a few geometric calculations