graphics

Multithreading System.Windows.Graphics

自作多情 提交于 2019-12-18 06:50:44
问题 I know of course that I can not draw onto the same Graphics object from different threads, but is it also true that I can not draw to different Graphics objects in different threads? Consider the following console program: class Program { static ThreadDrawer[] drawers; static void Main(string[] args) { int numThreads = 8; drawers = new ThreadDrawer[numThreads]; for (int i = 0; i < numThreads; i++) { drawers[i] = new ThreadDrawer(); drawers[i].Start(); } for (int i = 0; i < numThreads; i++) {

Multithreading System.Windows.Graphics

混江龙づ霸主 提交于 2019-12-18 06:50:31
问题 I know of course that I can not draw onto the same Graphics object from different threads, but is it also true that I can not draw to different Graphics objects in different threads? Consider the following console program: class Program { static ThreadDrawer[] drawers; static void Main(string[] args) { int numThreads = 8; drawers = new ThreadDrawer[numThreads]; for (int i = 0; i < numThreads; i++) { drawers[i] = new ThreadDrawer(); drawers[i].Start(); } for (int i = 0; i < numThreads; i++) {

How to force Mac window to foreground?

你。 提交于 2019-12-18 06:19:02
问题 How can I programmatically force a mac window to be the front window? I have the window handle, and want to ensure that my window is displayed above all other windows. I can use both Carbon & Cocoa for this. 回答1: For Cocoa, you can set the window level using: [window setLevel:NSFloatingWindowLevel]; A floating window will display above all other regular windows, even if your app isn't active. If you want to make your app active, you can use: [NSApp activateIgnoringOtherApps:YES]; and [window

Possible to have anti-aliasing when drawing a clipped image?

荒凉一梦 提交于 2019-12-18 05:55:22
问题 Currently, I'm successfully using the Graphics class to draw a non-rectangular clipped image (the turtle inside): My code looks something like: using (var g = Graphics.FromImage(image)) { g.InterpolationMode = InterpolationMode.HighQualityBicubic; using (var gfxPath = new GraphicsPath()) { gfxPath.AddEllipse(r); using (var region = new Region(r)) { region.Exclude(gfxPath); g.ExcludeClip(region); g.DrawImage(turtleImage, r, r2, GraphicsUnit.Pixel); } } } This all works just as expected. What I

SceneKit Culling Plane

耗尽温柔 提交于 2019-12-18 05:01:52
问题 I have a SCNScene rendering in a SCNView. I have some *.dae models that are rendered/moving in the scene. I have a transparent cube, when one of my models goes behind it, I would like the model to not be rendered, because at the moment, as the cube is transparent, you can see it through the cube. Is there any property/setting/shader I can apply to the transparent cube so that anything behind it is not rendered? Example: My eye is the green dot, the cube is the blue square, my model is the red

Android Rotatable ImageView

风流意气都作罢 提交于 2019-12-18 05:01:17
问题 I am trying to create a Rotatable an ImageView to which I will specify certain angle and pivot point and see it rotated around that pivot point. I tried something like this: Matrix matrix = new Matrix(); matrix.postRotate(45, imageView.getWidth(), imageView.getHeight()); imageView.setScaleType(ScaleType.MATRIX); imageView.setImageMatrix(matrix); but the parameters of postRotate method (the second and third - the pivot points) make NO CHANGE at all. even if they are 0, 0 - it's the same thing.

Core profile vs version string? Only getting GLSL 1.3/OGL 3.0 in mesa 10.0.1

℡╲_俬逩灬. 提交于 2019-12-18 04:49:08
问题 In theory, mesa 10.0.1 should support OpenGL 3.3 but currently I'm only getting 3.0 support. glxinfo gives some confusing results... [pdel@architect build]$ glxinfo | grep -i opengl OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.0.1 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile

How to rotate legend symbols in ggplot2?

和自甴很熟 提交于 2019-12-18 04:34:28
问题 Consider for example this plot using the data mtcars and the function coord_flip library(ggplot2) library(Hmisc) ggplot(mtcars,aes(x=gear,y=cyl)) + stat_summary(aes(color=as.factor(rep(1:2,16))), fun.data=mean_cl_boot, position=position_dodge(0.4)) + coord_flip() The fact that error bars are horizontal on the graph but vertical in the legend bothers me :) How can I rotate these symbols? 回答1: I'm not coming up with an answer that works within the normal ggplot2 workflow, so for now, here's a

Draw Beautiful Speech Bubbles in Swing [closed]

為{幸葍}努か 提交于 2019-12-18 04:26:14
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am trying to create beautiful speech bubbles in swing but the result is not very good...I mean I want something better and more beautiful! here is the code i'm using: import javax.swing.*; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; public class BubbleTest

JPanel Graphics clearing and repainting?

你。 提交于 2019-12-18 04:16:06
问题 I have a JPanel with a paintComponent() function. I'll call it once, then when the user clicks a different JButton , I'll set some flag and want to call this function again as it will do something slightly different after the flag is set. So here's what I'm wondering: how do I clear the existing stuff from paintComponent ? And to redraw, do I just call paintComponent again? Currently I'm trying the following: flag2 = true; repaint(); //I expect (want) paintComponent to be called again In