graphics

Using several bufferedImages in java

∥☆過路亽.° 提交于 2019-12-23 10:55:04
问题 I'm making a game in a java applet and I'm trying to optimise my code to reduce flickering. I've already implemented double buffering, so I'm trying to use another BufferedImage in order to store a picture of the elements of the game's background that don't change. Here's the relevant portion of my code... public class QuizApplet extends Applet { //The image I'm trying to use to store components of the game's gui that don't change within a game private BufferedImage QBuffImg = new

DPI Graphics Screen Resolution Pixels WinForm PrintPageEventArgs

回眸只為那壹抹淺笑 提交于 2019-12-23 10:26:05
问题 How do Dpi Points relate to Pixels for any display my application is running on? int points; Screen primary; public Form1() { InitializeComponent(); points = -1; primary = null; } void OnPaint(object sender, PaintEventArgs e) { if (points < 0) { points = (int)(e.Graphics.DpiX / 72.0F); // There are 72 points per inch } if (primary == null) { primary = Screen.PrimaryScreen; Console.WriteLine(primary.WorkingArea.Height); Console.WriteLine(primary.WorkingArea.Width); Console.WriteLine(primary

Java Game Programming: JOGL vs LWJGL? [closed]

删除回忆录丶 提交于 2019-12-23 10:19:54
问题 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 years ago . I am currently writing a Turret Defense style game using the GTGE engine, this engine has the ability to use either JOGL or LWJGL to drive the graphics and so I was wondering, which one should I use? What are the pros/cons of each? What factors should I consider when deciding

Highlight effect like snipping tool

家住魔仙堡 提交于 2019-12-23 09:58:49
问题 Im creating a new snipping tool similar to the windows 7 snipping tool. however I cant get the highlight effect working the same. for example, the snipping tool highlight works as follows: (The highlight is very bright on a white background, it looks like it has no transparency and my snipping tool highlight looks as follows: Im sure the color used is the same (255,255,0) with an alpha channel of 110. if i decrease the transparency then it just overwrites the text below. my snip is applying

Obtain a CGContextRef of NSView outside of drawRect?

て烟熏妆下的殇ゞ 提交于 2019-12-23 09:38:49
问题 I need to get CGContextRef of NSView object. It won't be so bad if I knew how. In Carbon this thing was done like this: CGContextRef cgref = (libvlc_drawable_t)GetWindowPort(HIViewGetWindow((OpaqueControlRef*)hiViewRef)); Obviously it can be done by subclassing NSView (or it's subclass) and catching it in it's drawRect, but that's too ugly. Your ideas? 回答1: I've never used it but it think this is your way: [myView lockFocus]; imageContext = (CGContextRef)[[NSGraphicsContext currentContext]

Gradient Fill using Graphics in Mathematica

扶醉桌前 提交于 2019-12-23 09:38:44
问题 How could I create the following using Rectangle[] in Graphics[] ? 回答1: Using Polygon , you can Graphics[{EdgeForm[Black], Polygon[{{0, 0}, {3, 0}, {3, 1}, {0, 1}}, VertexColors -> {White, Red, Red, White}]}] 回答2: Also: Graphics[Raster[{Range[100]/100}, ColorFunction -> (Blend[{White, Red}, #] &)], AspectRatio -> .3, Frame -> True, FrameTicks -> None] 来源: https://stackoverflow.com/questions/8142179/gradient-fill-using-graphics-in-mathematica

GLES20Canvas.nDrawDisplayList is slow

隐身守侯 提交于 2019-12-23 09:33:08
问题 I have a custom view that I am trying to display, however I am seeing a bunch of jitter on it. Everything scrolls slow and it isn't as responsive as it should be. I used traceview and saw that GLES20Canvas.nDrawDisplayList seems responsible for taking a lot of time to execute. Any help please? 回答1: GLES20Canvas.nDrawDisplayList is expected to have a large portion of the time if you are drawing a lot, especially very big views. If you are seeing this all over your traceview the answer is "DRAW

Floodfill algorithm in Android

被刻印的时光 ゝ 提交于 2019-12-23 09:25:09
问题 I am not able to find a floodfill algorithm implementation for Android. Any idea if a floodfill API is available in Android, and if not, is there any other alternative? 回答1: Do you have some definition of the shape? If so, have a look at the Canvas docs. You can fill a region by defining a clip area and then calling canvas.drawColor. Rough example: Rect r = new Rect(0,0,300,300); canvas.clipRect(r); // see also clipRegion canvas.drawColor(Color.RED); There are several clip functions, so you

sampler1D not supported in nVidia GLSL?

守給你的承諾、 提交于 2019-12-23 09:18:33
问题 In the GLSL spec, and other sources about GLSL, sampler types are available in 3 dimensions: sampler1D , sampler2D , and sampler3D . However when I try to compile GLSL programs using WebGL in Chrome (both regular, and also in Canary), sampler2D and sampler3D are accepted but sampler1D gives a syntax error. Code: uniform sampler1D tex1; Error: FS ERROR: ERROR: 0:9: 'sampler1D' : syntax error This error occurs even if I give Canary the command line argument --use-gl=desktop . I am running

Fully transparent windows in Pygame?

泄露秘密 提交于 2019-12-23 09:09:29
问题 Is it possible to get a fully transparent window in Pygame (see the desktop through it)? I've found how to create a window without a frame, but there doesn't seem to be any obvious way to make it transparent. I'd be willing to tie into system-specific technology/frameworks as long as there are solutions for both Windows and Mac OS X, but I'm not sure which direction to be looking. The only topic I was able to find recommended using wxPython, which isn't something I can do for this particular