graphics

Why might Graphics.RotateTransform() not be applied?

偶尔善良 提交于 2019-12-25 03:49:17
问题 I have the following function: static private Image CropRotate(Image wholeImage, Rectangle cropArea) { Bitmap cropped = new Bitmap(cropArea.Width, cropArea.Height); using(Graphics g = Graphics.FromImage(cropped)) { g.DrawImage(wholeImage, new Rectangle(0, 0, cropArea.Width, cropArea.Height), cropArea, GraphicsUnit.Pixel); g.RotateTransform(180f); } return cropped as Image; } It's supposed to crop an image, then rotate the resulting sub-image. In actuality though, it only performs the crop.

How to change background color of an OpenGL surface?

≯℡__Kan透↙ 提交于 2019-12-25 03:42:35
问题 Having srf = pygame.display.set_mode(viewport, OPENGL | DOUBLEBUF) and performing srf.fill([255,255,255]) results in the following error message: pygame.error: Cannot call on OPENGL Surfaces How to solve this issue? How can I change the background color? 回答1: You have to use the glClearColor function to set the color you want to clear your screen to, and then use glClear to actually clear the screen with the color specified. E.g. call glClearColor(0.7, 0, 0, 1) to set the color to red and

Extract colour gradient pixel information

心已入冬 提交于 2019-12-25 03:32:58
问题 I am attempting to control a 240 long line of RGB pixels (ws2812b) using an artnet to dmx controller and need to generate colour gradients down the length of the line of pixels. I had the idea of using the C# built in graphics libraries to generate the colour gradients and then extract the individual pixel values and send these to the dmx controller. Is it possible to extract individual interpolated values from a LinearGradientBrush or a LinearGradientBrush applied to a shape (line/rectangle

simplify combinatorial map using CGAL

大兔子大兔子 提交于 2019-12-25 03:02:29
问题 I want to simplify or edge collapse a mesh read from .off file as a combinatorial map using CGAL std::ifstream ifile(fileName.toStdString().c_str()); if (ifile) { CGAL::load_off(lcc, ifile); lcc.display_characteristics(std::cout)<<", is_valid="<<CGAL::is_valid(lcc)<<std::endl; } namespace SMS = CGAL::Surface_mesh_simplification ; SMS::Count_stop_predicate<LCC> stop(lcc.number_of_halfedges()/2 - 1); int r = SMS::edge_collapse (lcc ,stop ,CGAL::parameters::halfedge_index_map(get(CGAL::halfedge

Java Graphics Updating Too Fast

南楼画角 提交于 2019-12-25 02:48:13
问题 I have searched the problem, but everyone seems to have problems with graphics updating too slow. To present my situation: I have a JFrame which I set to full screen, by using a compatible display mode. Within the JFrame I have a couple of JPanels and JButtons... On one of JPanels I am drawing moving objects that need to be updated. I am updating the graphics like this : validate and repaint the JFrame, then revalidate and repaint the corresponding JPanel. The graphics are updating too fast.

Setting arc position in Java using Mouse

旧街凉风 提交于 2019-12-25 02:46:44
问题 I am writing a 2D program. On my paintComponent I created an arc. public class Board extends Panel{ protected void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D graphics2d = (Graphics2D)g; int x = MouseInfo.getPointerInfo().getLocation().x;//set mouses current position int y = MouseInfo.getPointerInfo().getLocation().y; graphics2d.setStroke(wideStroke); graphics2d.draw(new Arc2D.Double(200, 200, 100, 100, ?, 180, Arc2D.OPEN)); } } In my main I am using a Thread to update the

NURBS in the OpenGL Graphics Pipeline

﹥>﹥吖頭↗ 提交于 2019-12-25 02:43:26
问题 I'm curious about how NURBS are rendered in GPU's / the OpenGL graphics pipeline. I understand there are various calls within OpenGL and GLUT for easily rendering NURBS objects from a coding perspective using glMap and glMapGrid, but what I don't get is the process OpenGL goes through to do this. The idea behind NURBS is using curves to define surfaces, whereas the graphics pipeline appears to be build around triangle rasterization and triangle meshes, whereas NURBS are based around Bezier

NURBS in the OpenGL Graphics Pipeline

こ雲淡風輕ζ 提交于 2019-12-25 02:42:39
问题 I'm curious about how NURBS are rendered in GPU's / the OpenGL graphics pipeline. I understand there are various calls within OpenGL and GLUT for easily rendering NURBS objects from a coding perspective using glMap and glMapGrid, but what I don't get is the process OpenGL goes through to do this. The idea behind NURBS is using curves to define surfaces, whereas the graphics pipeline appears to be build around triangle rasterization and triangle meshes, whereas NURBS are based around Bezier

Getting IllegalSrgumentException: input==null. When trying to load an image

孤人 提交于 2019-12-25 02:39:33
问题 i am trying to load an image to be used as a texture and i keep getting input==null errors; This is my code where i am trying to load the image and where most of the errors are pointing to. package com.mime.minefront.graphics; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Texture { public static Render floor = loadBitmap("/C:\\Users\\Danny\\Documents\\NetBeansProjects\\MyFirstgame\\src\\res\\textures\\floor.png"); public static Render loadBitmap(String

“saturation” globalCompositeOperation without changing transparency?

∥☆過路亽.° 提交于 2019-12-25 02:25:44
问题 I have a canvas containing art on a transparent background. I desaturate it like this: boardCtx.fillStyle = "rgba(0, 0, 0, 1.0)"; boardCtx.globalCompositeOperation = 'saturation'; boardCtx.fillRect(0, 0, boardCanvas.width, boardCanvas.height); and find that the transparent background has turned opaque black. I wouldn't expect the saturation blend mode to change the alpha channel... am I doing something wrong? My current solution is to copy the canvas before desaturation and use it to mask the