drawing

Draw Shapes That User Selects

主宰稳场 提交于 2020-02-16 06:28:19
问题 I need to create a program to draw shapes(user chooses with radio button), and whether or not the shape is filled(user chooses with check box). This is the code I have so far: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class SelectShape extends JFrame implements ItemListener{ private JRadioButton line = new JRadioButton("Line"); private JRadioButton rect = new JRadioButton("Rectangle"); private JRadioButton oval = new JRadioButton("Oval"); private JCheckBox fill

Using System.Drawing to draw a crosshair on the desktop?

和自甴很熟 提交于 2020-02-07 07:14:41
问题 I'm trying to create a very small c# utility application that will utilize System.Drawing to draw a full screen, static, fixed cross-hair on my desktop so that I can align some desktop items to the relevant screen center. I tried looking up a few examples but didn't come up with a whole lot and was wondering if anyone had any experience in this area. I would prefer not making a transparent full screen window to accomplish this feat if possible. 回答1: Loads of issues come up when you try this.

Using System.Drawing to draw a crosshair on the desktop?

回眸只為那壹抹淺笑 提交于 2020-02-07 07:14:05
问题 I'm trying to create a very small c# utility application that will utilize System.Drawing to draw a full screen, static, fixed cross-hair on my desktop so that I can align some desktop items to the relevant screen center. I tried looking up a few examples but didn't come up with a whole lot and was wondering if anyone had any experience in this area. I would prefer not making a transparent full screen window to accomplish this feat if possible. 回答1: Loads of issues come up when you try this.

Draw image as a polygon

﹥>﹥吖頭↗ 提交于 2020-02-07 03:38:44
问题 I'm trying to draw an image as a polygon in Swing but I don't know how. Now I only have code to draw filled polygon. This is not a cropped image, it is distorted. What I need (Polygon with texture): What I have - Filled polygon gr.fillPolygon(x_points, y_points, points.length); 回答1: The easiest way to render 3D is using JOGL library which uses OpenGL to render in JPanel. 来源: https://stackoverflow.com/questions/55949306/draw-image-as-a-polygon

Draw image as a polygon

此生再无相见时 提交于 2020-02-07 03:38:25
问题 I'm trying to draw an image as a polygon in Swing but I don't know how. Now I only have code to draw filled polygon. This is not a cropped image, it is distorted. What I need (Polygon with texture): What I have - Filled polygon gr.fillPolygon(x_points, y_points, points.length); 回答1: The easiest way to render 3D is using JOGL library which uses OpenGL to render in JPanel. 来源: https://stackoverflow.com/questions/55949306/draw-image-as-a-polygon

How to draw a transparent ellipse in Python with Pillow without outline

北城余情 提交于 2020-02-06 08:44:45
问题 I am trying to draw multiple transparent ellipses with Pillow, and I want to draw them without outlines. I can't seem to make it work without outlines. Here is some test code: from PIL import Image, ImageDraw w,h = 100,100 img = Image.new('RGB', (w,h),(255,255,255)) drw = ImageDraw.Draw(img,"RGBA") drw.polygon([(50, 0), (100, 100), (0, 100)], (255, 0, 0, 125)) drw.polygon([(50,100), (100, 0), (0, 0)], (0, 255, 0, 125)) drw.ellipse([(40, 40), (w - 10, h - 10)], fill=(0,0,255,125), outline=None

Cairo Fill with Transparency

大兔子大兔子 提交于 2020-02-02 20:09:51
问题 I'm new to Cairo, trying to create text with transparent color and stroke. stroke color's transparency works but text fill color transparency transparency_value doesn't work. If i reduce transparency_value , text color just gets darker(black) and increasing transparency_value makes text color brighter (green in my case) cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 640, 480); cairo_t* cairo = cairo_create(surface); cairo_set_font_face(cairo, myfont_face); cairo

Multiple Clipped Rects to Create Collage in Core Graphics

一个人想着一个人 提交于 2020-01-30 18:13:03
问题 I am creating a collage combined with elements from other images. Here is some ASCII art to explain what I am doing: Given images A, B and C, AAA, BBB, CCC AAA, BBB, CCC AAA, BBB, CCC I take part of A, part of B and part of C as columns: Axx, xBx, xxC Axx, xBx, xxC Axx, xBx, xxC ...and combine them in one image like this: ABC ABC ABC where the first 1/3rd of the image is a colum of A's pic, the middle is a column of B's pic and the last is a column of C's pic. I have some code written but it

Multiple Clipped Rects to Create Collage in Core Graphics

谁说我不能喝 提交于 2020-01-30 18:11:39
问题 I am creating a collage combined with elements from other images. Here is some ASCII art to explain what I am doing: Given images A, B and C, AAA, BBB, CCC AAA, BBB, CCC AAA, BBB, CCC I take part of A, part of B and part of C as columns: Axx, xBx, xxC Axx, xBx, xxC Axx, xBx, xxC ...and combine them in one image like this: ABC ABC ABC where the first 1/3rd of the image is a colum of A's pic, the middle is a column of B's pic and the last is a column of C's pic. I have some code written but it

Drawing in JavaScript / HTML5 using XOR to remove old sprite

别来无恙 提交于 2020-01-29 05:39:09
问题 I'm building the engine for a tiny game, and right now I have just got a red circle with two little eyes as a main character. I have keyPress functions to detect movement, and that works, but I wanted to use something I used a long time ago in QBASIC to remove the character and redraw at a new location: XOR Basically, on keypress this happens: if (code == 39) { mainChar.drawChar(); mainChar.x += 1; mainChar.leftEye.x += 1; mainChar.rightEye.x += 1; mainChar.drawChar(); } I thought drawing the