graphics

What do I need to do to replicate this component with gradient paint?

吃可爱长大的小学妹 提交于 2019-12-23 09:07:37
问题 I attempted to replicate this component (at the bottom of the post), but I can't seem to get it to look nice. So I'm wondering, how do I replicate this gradient paint? Or if it isn't the gradient paint, what do I do to get similar results? My attempt turned out very flat black compared to this component. Also it had the JFrame options (close, minimize, etc) and it didn't have a 'rounded' look to the components. I'm looking for someone who can improve what I have and explain where I went wrong

Getting anti-aliased plots with R on Ubuntu

久未见 提交于 2019-12-23 08:54:49
问题 I upgraded my system and reinstalled R, and now my standard X-11 plots are not anti-aliased -- they look jagged and the font looks bad. I seem to recall a problem like this in the past but don't remember what I did about it. Some other info: qplot also comes out non-anti-aliased plotting to a png device produces non-anti-aliased output as well plotting to a pdf device, however, produces nice looking anti-aliased output Another thing: I've been running this version of R/Ubuntu for a while now,

Understanding how drawLine works

喜欢而已 提交于 2019-12-23 08:33:07
问题 Given the following code: import javax.swing.*; import java.awt.*; public class NewClass extends JPanel { public void paintComponent(Graphics g) { g.drawLine(0, 0, 90, 90); } public static void main(String[] args) { JFrame jf = new JFrame(); jf.add(new NewClass()); jf.setSize(500, 500); jf.setVisible(true); } } Why does it draw a line if the method drawLine is abstract and, as I managed to understand, an abstract method has no definition? Thank you in advance! 回答1: paintComponent() gets a non

How to invert colors of an image in pygame?

故事扮演 提交于 2019-12-23 07:56:39
问题 I have a pygame Surface and would like to invert the colors. Is there any way quicker & more pythonic than this? It's rather slow. I'm aware that subtracting the value from 255 isn't the only definition of an "inverted color," but it's what I want for now. I'm surprised that pygame doesn't have something like this built in! Thanks for your help! import pygame def invertImg(img): """Inverts the colors of a pygame Screen""" img.lock() for x in range(img.get_width()): for y in range(img.get

Getting a gestureoverlayview

十年热恋 提交于 2019-12-23 06:38:25
问题 I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here: http://developer.android.com/resources/articles/gestures.html That takes these lines of code: GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures); gestures.addOnGesturePerformedListener(this); This is fine and dandy yet I realize in my demo i'm trying to build using code from "Playing with Graphics in Android". The demos make sense,

Getting a gestureoverlayview

老子叫甜甜 提交于 2019-12-23 06:38:18
问题 I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here: http://developer.android.com/resources/articles/gestures.html That takes these lines of code: GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures); gestures.addOnGesturePerformedListener(this); This is fine and dandy yet I realize in my demo i'm trying to build using code from "Playing with Graphics in Android". The demos make sense,

Getting a gestureoverlayview

痴心易碎 提交于 2019-12-23 06:38:05
问题 I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here: http://developer.android.com/resources/articles/gestures.html That takes these lines of code: GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures); gestures.addOnGesturePerformedListener(this); This is fine and dandy yet I realize in my demo i'm trying to build using code from "Playing with Graphics in Android". The demos make sense,

Getting a gestureoverlayview

不羁的心 提交于 2019-12-23 06:38:05
问题 I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here: http://developer.android.com/resources/articles/gestures.html That takes these lines of code: GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures); gestures.addOnGesturePerformedListener(this); This is fine and dandy yet I realize in my demo i'm trying to build using code from "Playing with Graphics in Android". The demos make sense,

Question about “Additive blending” and “Hue replacement”

爷,独闯天下 提交于 2019-12-23 05:49:07
问题 Since drawing fonts is quite expensive in terms of CPU, many developers use a rasterized font to draw text on video games; that's what I did too. Using additive blending when drawing the text works fine regarding glyph edges, these merge nicely with the background color. But it brought another issue, I decided to implement a 'color' parameter for drawing the font, instead of producing glyphs bitmaps for each color, otherwise memory usage might be an issue soon; depending how many glyphs and

Is there a program to view a raw array as an image?

大城市里の小女人 提交于 2019-12-23 05:39:15
问题 I have a heightmap which is just a 16-bit wide big-endian array. I haven't looked into encoding a jpg or png from the raw data, but before I do I would like to know if there are any programs that I can download to view it as an image, because I want to know what it looks like. When I do a search for viewing raw image data all the results return information about RAW image formats as used for camera image formats, which also differ between manufacturers, I don't think that's what I'm looking