graphics

Java Challenge on Creating a Canvas

Deadly 提交于 2019-12-13 06:43:29
问题 This is probably an elementary question. However, I have completed reading the 9th Chapter of Java Programming for the Absolute Beginner and have approached the Challenges section. I cannot quite understand the question. The question asks: "Create a Canvas that paints a gradient that’s dark on one side and slowly gets lighter as it moves to the other side." This might be helpful information: prior to this challenge question, the word 'gradient' has not appeared within code methods or within

Get same graphic output under Xcode 10 as under Xcode 9?

依然范特西╮ 提交于 2019-12-13 06:33:37
问题 I build the SheepShaver emulator (which, in its current version, uses SDL2 to create and display its window) for use in macOS. When I build under Xcode 9, the fonts and graphics are sharp and clear; when I build under Xcode 10 (on the same MacBook Pro running Mojave), the fonts and graphics are slightly fuzzy. I use exactly the same code when building on both Xcode versions. Is there a setting in Xcode 10 that will produce the same visual output that Xcode 9 produces? I've already got the

Pipe Game - PipeObject in class PipeObject cannot be applied to given types

自古美人都是妖i 提交于 2019-12-13 06:26:45
问题 I keep getting the error "PipeObject in class PipeObject cannot be applied to given types" public Pipes() { pipes.add(new PipeObject(x1, y1)); pipes.add(new PipeObject(x1 + 200, y2)); pipes.add(new PipeObject(x1 + 400, y3)); } I have an object class that I want to be added to a JPanel by a class that controls the objects and draws 3 instances of it to the screen. It needs to be able to give different values to the object class. My third class is the main() class and should add the class with

Reverse image blur filter (not unsharp mask)

被刻印的时光 ゝ 提交于 2019-12-13 06:21:08
问题 I am looking for method to obtain reverse blur filter. I have original bitmap and I want to make something like Gaussian Blur Inverse. Let us call it invB, and operation of Gaussian blur as function GBlur and original image O. Filter I would like to have gives invB as output, so that GBlur(invB) = O. This operation has nothing to do with sharpening image (I assume it will disort image not make it sharper) and will never be used to restore original image from blurred one (it differs in

Calculating the scale factor for “bar rectangles” of Chart app

风流意气都作罢 提交于 2019-12-13 06:14:48
问题 I have an array of integer values String[] values={3100,7500,8000,4200,88000,71000,32000}; that need to be scaled into a known height of my JComponent , the question is how to scale these values into e.g. h=600px? Here is a pic just for more clarification of what i want to achieve: Thanks 回答1: bar_height = chart_height*(value/max_value) To determine bar_height , you scale (multiply) chart_height by (value/max_value) , where: bar_height is the height of the a bar in pixels. value is the value

Reflecting text in java

笑着哭i 提交于 2019-12-13 06:13:31
问题 I am trying to make a digital clock in this way: As shown in the image 1 i want the clock to be reflected . What i have tried: I tried using java (Graphics2D)g by rotating the string and the using substring but i got this problem: My code for this: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; @SuppressWarnings("serial") public class

Graphics.h refresh screen

扶醉桌前 提交于 2019-12-13 06:10:44
问题 I made a small program that displays a 3d cube that you can scale on any axis using the arrow keys. Only problem is that im using cleardevice(); for refreshing the cube ( so that there is no "smearing" when scaling the cube ). that works fine its just that every time the cube refreshes using this method the screen goes black for a split second resulting in annoying flickering. Is there a better way of refreshing the screen every time the user changes the cube? I did actually research this but

Trying to fill large gap in pie chart using ggplot2

旧巷老猫 提交于 2019-12-13 06:07:31
问题 Attempting to create pie chart with ggplot2 but cannot seem to get it using other references online. The chart I create is missing most of its fill. ggplot(sae,aes(x=1,fill=factor(State), width=1))+ geom_bar()+ ggtitle("House by State")+ coord_polar(theta='y') This code gives: How do I fill the center? Any other improvements appreciated. 回答1: With sample data sae <- data.frame(State=sample(LETTERS[1:6],60,T)) ggplot(sae,aes(x=factor(1),fill=factor(State)))+ geom_bar(width=1)+ ggtitle("House

Draw 2.5D or 3D Map with C# from lines

十年热恋 提交于 2019-12-13 05:46:20
问题 I'm developing a turn-by-turn navigation software for Windows Mobile using C# and .NET CF. I'm able to draw a 2D maps by drawing lines. My problem is I would like to get a 2.5D map like in the picture. I tried non-affine transformation on the 2D rendered image but it is too slow for the Windows Mobile device we are targeting. Could anyone give me a clue on my problem? (source: cartotype.com) 回答1: Use a perspective transformation, because it will map straight lines to straight lines. More

How to combine multiple image as single image in UWP

倖福魔咒の 提交于 2019-12-13 05:39:06
问题 I have multiple image(near by 40 images), I need to combine these images as single image. I have referred the below link, Combine two Images into one new Image but I dint find anything like Graphics in UWP. How toacheive this requirement 回答1: Making a render target bitmap and draw the image to render target bitmap. The example that how to draw image to render target bitmap. And you can save render target bitmap to file, see http://jamescroft.co.uk/blog/how-to/storing-a-uwp-inkcanvas-drawing