graphics

How to adapt DirectX-style world/view/projection matrices to OpenGL?

此生再无相见时 提交于 2020-01-03 01:55:08
问题 I have an application which uses DirectX, and hence a left-handed world-coordinate systen, a view which looks down positive z and a projection which projects into the unit cube but with z from 0..1. I'm porting this application to OpenGL, and OpenGL has a different coordinate system etc. In particular, it's right-handed, the view looks down along negative z, and the projection is into the real unit cube. What is the easiest way to adapt the DirectX matrices to OpenGL? The world-space change

Android fill in part of a path?

戏子无情 提交于 2020-01-02 22:11:14
问题 I have a shape that I'm drawing with a path. I'm filling that shape in with a gradient and then I need to put another gray area ontop of that gradient dependent upon a %. I'm using path.quadTo to make my shape so I don't know the y coordinate of the top line to properly intersect it. This is what I'm getting when I just set it to the maximum y: The white stroke is the image I'm trying to partially fill in. The right gray area I want to keep, but I need to get rid of the left gray area. Any

PDFsharp draws text under graphics

浪子不回头ぞ 提交于 2020-01-02 15:41:08
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

PDFsharp draws text under graphics

风流意气都作罢 提交于 2020-01-02 15:40:47
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

PDFsharp draws text under graphics

霸气de小男生 提交于 2020-01-02 15:39:06
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

Overlapping UIViews of Differing Color and Alpha

一个人想着一个人 提交于 2020-01-02 13:16:11
问题 Is there a way to overlap 2 or more UIViews with differing background colors and alphas to give the appearance of another color? For example place a red UIView on top of a blue UIView to give the appearance of a single magenta UIView . 回答1: On iOS the only blending mode for views if the so-called "source over" mode. Basically RGB_result = RGB_back * (1 - Alpha_front) + RGB_front * Alpha_front Thus a red (1, 0, 0) view with 0.5 alpha on top of a blue (0, 0, 1) view will result in dark magenta

Paint method java - Rectangle with outline

半腔热情 提交于 2020-01-02 10:03:46
问题 I want to create a wall with a blue line outline and black filling. I have only a blue wall now and I tried a couple of the Graphics methods but wasn't working. public void paint(Graphics g) { g.setColor(Color.blue); g.fillRect(x, y, size, size); } 回答1: First, override paintComponent , not paint . Second, there's no need to re-invent the wheel like that. Instead, use an existing Swing component (e.g. JPanel ), import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout;

How to interpret the pixel array in a 1 bpp BMP file

旧街凉风 提交于 2020-01-02 09:35:05
问题 I can't find a way to explain the pixel array in the following situation: I created a BMP image 2x2 pixels with MS Paint on Windows 7. Saved it as monochrome BMP (which I think means BMP with color depth 1 bit per pixel) This is how the image looks like when zoomed it (black pixel, white pixel, white pixel, black pixel) Then I open the bmp with a hex editor and I can see the following info: 00: 424d 4600 0000 0000 0000 3e00 0000 2800 BMF.......>...(. 10: 0000 0200 0000 0200 0000 0100 0100

Windows 10 NotifyIcon Icon always looks very pixilated

孤者浪人 提交于 2020-01-02 07:04:09
问题 I am having trouble making a NotifyIcon in Windows 10 whose icon resource looks anything but a blurry mess. This happens with both icons from the SystemIcons class, or my own using Properties.Resources . I have tried creating a new instance of the icon with the Icon (Icon original, int width, int height) constructor, and all sorts of other mad things, including this nugget: Icon ico = Icon.FromHandle((new Icon(Resources.InfoIcon, 256, 256).ToBitmap()).GetHicon()); to no avail. Any advice

.net onpaint vertical sync

旧时模样 提交于 2020-01-02 06:24:38
问题 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