graphics

How do I capture a WinForm window to a bitmap without the caret

南笙酒味 提交于 2019-12-24 01:11:13
问题 I've got window on a WinForm that I want to get the bitmap representation of. For this, I use the following code (where codeEditor is the control I want a bitmap representation of): public Bitmap GetBitmap( ) { IntPtr srcDC = NativeMethods.GetDC( codeEditor.Handle ) ; var bitmap = new Bitmap( codeEditor.Width, codeEditor.Height ) ; Graphics graphics = Graphics.FromImage( bitmap ) ; var deviceContext = graphics.GetHdc( ) ; bool blitted = NativeMethods.BitBlt( deviceContext, 0, 0, bitmap.Width,

Swing font names do not match? (Making a font chooser, and am trying to display the default system font in a JComboBox)

放肆的年华 提交于 2019-12-24 01:01:36
问题 I am creating a swing font chooser. (See also: How to prevent JComboBox from becoming unresponsive when using a custom ListCellRenderer) To get all available fonts, I do: GraphicsEnvironment gE = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = gE.getAllFonts(); In my font chooser (a JComboBox), which contains all the available fonts, I want to initialize it showing the default system font as selected. To do this, I use a static base font (which is gotten from a static base

tooltip text erases panel drawing in java

痞子三分冷 提交于 2019-12-24 00:59:54
问题 I have a JPanel on which some drawing is performed using paintComponent method and after that when ever a user clicks on the JPanel a string is drawn (or any drawing) on it and as the user moves mouse over the JPanel it shows the coordinates in the tooltip of the JPanel . 1) The problem is that when the tooltip comes over the drawn string it erases it but this tooltiptext has no erasing effect on the drawing part which I performed in paintComponent method. I am not able to understand that why

<ul> Sprite Issue

≡放荡痞女 提交于 2019-12-24 00:59:54
问题 I have the following code <ul id ="menu"> <%foreach (var pckg in Model) { %> <li style = "text-align:center;width:60px;" class = "top-<%=pckg.Controller.ToLower() %>"> li-text </li> <%} %> </ul> and following is the sprite CSS .top-pkg1{ background-position: -184px 0; width: 36px; height: 36px; } .top-pkg2{ background-position: -270px 0; width: 36px; height: 36px; } .top-pkg3{ background-position: -356px 0; width: 36px; height: 36px; } .top-pkg4{ background-position: -517px 0; width: 36px;

3D-Animation plot with the hgtransform command in Matlab

穿精又带淫゛_ 提交于 2019-12-24 00:56:23
问题 I continue to think of the possibilities for the 3d-animation (moving point along a curve). I have written the following code to try it using the hgtransform command but I do not understand why does not work. t = 0:pi/50:10*pi; x = sin(t); y = cos(t); z = t; ah = axes; set(ah,'XLim',[min(x) max(x)],'YLim',[min(y) max(y)],... 'ZLim',[min(z) max(z)]); plot3(x,y,z,'Color','red'); hold on; view(3); hpoint = line('XData',x(1),'YData',y(1),'ZData',z(1),'Color','black','Marker',... 'o','MarkerSize'

How to draw graphics outside of the paint() function in a JFrame

三世轮回 提交于 2019-12-24 00:48:47
问题 I would like to be able to paint Image s onto a JFrame , but whenever I want (not in the JFrame.paint method. For the project I am working on, I have a class Bullseye extends BufferedImage , and am trying to put it onto a JFrame : class DrawingFrame extends JFrame { public void drawImage(Image img, int x, int y) { getGraphics().drawImage(img,x,y,null); repaint(); } } class Main { public static void main(String[] args) { DrawingFrame frame = new DrawingFrame(); Bullseye bullseye = new Bullseye

Subtract (mask away?) a path by a circle shape

最后都变了- 提交于 2019-12-24 00:45:02
问题 I'm drawing a path in Flex using Spark:Path. I want to subtract a circle shape from this path, as in the following image: (The path is black and wide) Any ideas? I tried creating a mask using a Shape object but couldn't quite manage to create a mask that has a circular hole in it. 回答1: Found it. No masks involved. I took the Path and wrapped a Group around it: <s:Group blendMode="layer"> <s:Path id="connector" ... /> <s:Ellipse id="hole" blendMode="erase"> I set the blendMode to "layer" and

Resource for understanding view, projection, 'virtual camera' in OpenGL or graphics in general [closed]

Deadly 提交于 2019-12-24 00:38:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I noticed most resources either assume you know a lot already or assume you know math of professional level or assume you're going to find other resources to fill gaps. Is there a resource that takes someone without already a knowledge on view matrices in graphics and takes them to understanding fully how to set

How do I draw thick lines with closely spaced points properly with Java2D graphics?

China☆狼群 提交于 2019-12-24 00:35:50
问题 I'm trying to draw maps using Java2D. When my map is zoomed out my roads are full of drawing artefacts. This is a small part of the screen when drawing a complete US state: This is a similar section of the road when zoomed closer in: The line style used is a solid blue line with width scaled to be equivalent to 2 pixels. I've tried various rendering hints and line joining rules and nothing seems to help. I'm using Open JDK 1.7 on a Mac running the OS/X 10.8 and this is also reproducible on a

Slight undesired transparency from FillRectangle

北城余情 提交于 2019-12-23 23:56:31
问题 I have a window created with the WS_EX_LAYERED window style. I am currently drawing onto a memory bitmap using GDI+, and using UpdateLayeredWindow to update the graphical content of my layered window. Here's a snippet of my code: void Redraw(HWND hWnd, int width, int height) { static bool floppy = true; floppy = !floppy; HDC hScreenDC = GetDC(HWND_DESKTOP); HDC hMemDC = CreateCompatibleDC(hScreenDC); HBITMAP hBmp = CreateCompatibleBitmap(hScreenDC, width, height); HGDIOBJ hObj = SelectObject