graphics

Draw rectangle around Textbox inside a Groupbox

假如想象 提交于 2019-12-12 02:47:36
问题 I want to add a custom border around a TextBox control which is in a GroupBox . Since I'm new to this Graphic stuff I'm having a hard time figuring out the problem. This is the code i'm using: Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint Dim _g As Graphics = Me.GroupBox1.CreateGraphics Dim pen As New Pen(Color.Red, 2.0) _g.DrawRectangle(pen, New Rectangle(TextBox1.Location, TextBox1.Size)) pen.Dispose() End Sub This form is a secondary form that shows when I

How to use multiple layers in Piccolo2D?

陌路散爱 提交于 2019-12-12 02:42:14
问题 I want t have some picture above another one and want to utilize PCamera's addLayer() method. Is this possible? The following code throws NullPointerException . What's wrong with it? package test.piccolo; import java.awt.Color; import edu.umd.cs.piccolo.PCamera; import edu.umd.cs.piccolo.PLayer; import edu.umd.cs.piccolo.nodes.PPath; import edu.umd.cs.piccolox.PFrame; public class Try_Cameras_01 { @SuppressWarnings("serial") public static void main(String[] args) { new PFrame() { private

Is there a 2D graphics API with both pixel perfect drawing and 2D hardware acceleration? [closed]

被刻印的时光 ゝ 提交于 2019-12-12 02:37:04
问题 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 2 years ago . We are in the first stages of making a 2D game at the moment, which will focus on destructible environments and objects. However, we have already encountered serious problems with the choice of the right graphics API At the moment, we use SDL - but the problem we see with it is that it isn't really performant,

OpenGl texturing … ppm background

旧时模样 提交于 2019-12-12 02:35:22
问题 i am using a ppm loader to set image as a background , but there is a problem in colors here is the code and the image that i am use . http://imgur.com/w732d6j http://imgur.com/mJr26Ik here is the code ..... texture.h #ifndef TEXTURE_H #define TEXTURE_H struct Image { unsigned char* pixels; int width; int height; int numChannels; }; class Texture { public: Texture (); void Prepare (int texN); void ReadPPMImage (char *fn); GLuint texName; Image image; }; #endif texture.cpp #include <fstream>

Trying to make checkerboard

空扰寡人 提交于 2019-12-12 02:34:23
问题 I am trying to make a checkerboard given a template from a CS class I am taking. However, when I run it, nothing comes up on the screen. I am guessing I am missing some code to actually draw the squares onto the screen but I have tried a lot of things and still nothing. import java.applet.Applet; import java.awt.*; import java.util.Random; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class Checkers extends JApplet { private final int MAX

ioctl to block operation

蓝咒 提交于 2019-12-12 02:28:19
问题 I am using ioctl function to access framebuffer The problem is that for each frame, I am writing framebuffer three times For instance, each frame, I first fill frame with Red color, do some computation, fill Green, then do another computation, then fill Blue. In other words, each frame, I have three layers, Red as the bottom, Green, then Blue as the top. Therefore, Red and Green is invisible and all I can see is the Blue. Now, my question is that when I use ioctl call, it seems like it can't

How to find the intersection of two lines given a point on each line and a parallel vector

做~自己de王妃 提交于 2019-12-12 02:25:06
问题 I need an algorithm that can find the intersection of two 2D lines. Each line will come in the form of a point on the line and the dx/dy of a parallel vector . I've tried parameterizing each line and solving the system of equations to solve for the parameterized variable which I could plug back into the parametric equation of the lines and get my x/y, but my attempt failed. Any ideas? I'm programming in Python but the language doesn't much matter. 回答1: You basically have to solve the

Draw section of shape with EaselJS

試著忘記壹切 提交于 2019-12-12 02:19:27
问题 I have been trying to find out if it is possible to draw only a section of a shape using EaselJS. For example, is it possible to create a Rounded Rectangle, but only draw the top two thirds of it? (Effectively not displaying the bottom third). Thank you in advance for any advice you may have! 回答1: What is the end goal? Depending on what you want to do, there are a few ways to do it: Mask it using another shape to crop it Cache it to the size you want http://jsfiddle.net/lannymcnie/f1zh3qwx/ /

Is there any System.Drawing.Graphics for Windows Phone 8.1?

帅比萌擦擦* 提交于 2019-12-12 02:18:55
问题 I'm trying to create an image generator in a Windows Phone 8.1 application . I want to be able to create an empty bitmap, write some text in it and then add basic content to the bitmap (lines, circles, etc.). I am using WritableBitmap and I can get the pixels as an integer array. I can modify the array "by hand" but drawing a text for example would be very complicated using this rough method . WriteableBitmap bmpCreator = new WriteableBitmap(iImgWidthPX, iImgHeightPX); int[] vPixels =

Drawing with brush on UserControl

社会主义新天地 提交于 2019-12-12 02:16:21
问题 I am trying to draw with brush on UserControl control. I can draw lines, circles and rectangles. I don't exactly understand why I cannot draw with brush. The code below gives me just point on MouseDown and then it moves to the position set in MouseUp. There is no content drawn during MouseMove. I suppose that I do not understand some basic rule here. This code works for lines: public override void Draw(Graphics graphics) { graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode