graphics

Zooming graphics without scrolling

北战南征 提交于 2019-12-12 03:46:39
问题 I have a user control and I'm using ScaleTransform() to implement zoom. However, in order to keep the center content in the center after the zoom, it is also necessary to scroll. For example, if I zoom in (make things bigger), the X and Y origin should increase so that most of the content does not move down and to the right. (That is, as I zoom in, some of the content should disappear to the left and top.) Has anyone worked out the calculations of how much to scroll in the X and Y direction

Prevent drawing over the same area of a Graphics2D

主宰稳场 提交于 2019-12-12 03:33:34
问题 Language: Java. Hi, I need to prevent drawing over the same location of a Graphics2D more than once. For example, if the user draws using a BasicStroke with a round cap and a width of 10 over a certain area, that same area cannot be drawn on a second time. The reason I want to do this is so that the user can draw (free-hand) translucent colours over an image without drawing over the same stroke (thus increasing the density of the colour and reducing its translucency). I've tried storing the

Keeping graphics unaltered when TabPage changes

人走茶凉 提交于 2019-12-12 03:33:24
问题 I have a form that displays a set of graphics using a Paint event on a Panel that is docked inside a particular TabPage of a TabControl . The problem is the following: When the user switches to a different TabPage and then decides to go back to the TabPage where the graphics were originally displayed, those graphics are invalidated by default so the Panel appears blank. I would like those graphics to stay unaltered and totally independent from the user's action when switching between

Prevent Alpha Color Pen from Overlapping?

。_饼干妹妹 提交于 2019-12-12 03:28:47
问题 I have a simple highlighter using a Pen object. When the size is very large, it creates odd stripes which you can fix by defining its Start & End Cap with System.Drawing.Drawing2D.LineCap.Round but it instantly overlaps itself and loses its transparency. A flat cap also loses its transparency when you draw over itself multiple times. How can I create an opaque pen that does not overlap itself or create stripes with a large pen width? private static Color baseColor = Color.Yellow; bool Draw;

convert window coordinates to 3D world coordinates with glut function glutMouseFunc()

时光怂恿深爱的人放手 提交于 2019-12-12 03:17:12
问题 I am trying to get the 3D coordinates of a mouse click C++/OpengGL with the glut function glutMouseFunc(). So I created a function like this: void mouse(int button, int state, int x, int y){ if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { mouse_x=x; mouse_y=y; } } The function gets the window coordinates of the click of the mouse and i use it with the glut function glutMouseFunc() like this: glutMouseFunc(mouse); My question is how would I modify the coordinates given by the mouse

How to get control points for a curve from a set of points which make a straight line?

随声附和 提交于 2019-12-12 03:07:22
问题 I have a set of n points which make a line, but I would like to have a curve instead of a line.For doing curves in processing, there are control points which are needed, I would like to know how can I get control points from a set on n points. Also I would be dragging curves, hence I would need to find new control points all the time I presume? 回答1: Well, you can basically just parse the array of coordinates and use them to create a curveVertex() shape in Processing like this: // create an

Graphics will not cover entire canvas

旧城冷巷雨未停 提交于 2019-12-12 03:04:52
问题 What I know: Canvas is displayed properly, due to the yellow. However, graphics will not cover the canvas completely, nor will my law class recognized it past the end of the black area... So what is causing this to happen? And how could I draw on my currently undrawable section of canvas(yellow part), or should I just implement my graphics another way? EDIT: The UI class creates a canvas and a buffer, then the graphics class takes over and starts drawing on them, however for some reason it

About LookAt() function

烂漫一生 提交于 2019-12-12 03:03:05
问题 I need to implement a quaternion for rotating a camera. Before implementing quaternion, I use LookAt(&eye, &at, &up) for expressing a camera coordinate (vpn, vup, ...). vec3 eye = vec3(0.0,0.0,-10.0); vec3 to = vec3(0.0,0.0,0.0); // initial vec3 up = vec3(0.0,1.0,0.0); vec3 d = to - eye; and at display callback. m = LookAt(eye,to,up); glUniformMatrix4fv(ModelView,1,GL_TRUE,m); and Add an rotation (it is still euclidean rotation, and keyboard interation) case 'a': temp = RotateX(1.0) * vec4(d

How to programmatically put vector images in iOS asset catalog

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:55:01
问题 I am working on a card editor app. I wanted to show images in different screen sizes. I have read that new xcode suports pdf images and we don't need to put many images for different screens. http://martiancraft.com/blog/2014/09/vector-images-xcode6/ According to that we have to put pdf in ios asset catalog. In my app images loaded from dynamically from a web service. Then how can i save pdf image programmatically in ios asset catalog. If this is not possible what is the better approach for

Select drawn figure within panel box

做~自己de王妃 提交于 2019-12-12 02:49:48
问题 I am working on an 'use-case-diagram-form' where an user can select an element and a modus Just a simple form. It al works fine, made a class for each actor element and each use-case element. Both are added in a list after beeing created. But somehow I just can't figure out how to select a created element and after do something with it. classes i made: class Actor { private static int _id; private Panel _panel; public string Name { get; private set; } public int X { get; private set; } public