paint

Dynamically generated line with glow effective

柔情痞子 提交于 2019-11-27 09:29:44
问题 I want to draw line with glow effect like this The problem - i must generate this line in program in dependence on user's interaction ( the form of line will be generated in onTouchEvent - ACTION_MOVE ). Can i generate this effect without xml files or drawing premaid bitmap ? 回答1: I imitate this effect in this way : Draw line with BlurMaskFilter; Draw over it normal line. I use Path class to generate line and save coordinates of MOVE_ACTION event to generate only part of path what i need.

How did this person code “Hello World” with Microsoft Paint?

两盒软妹~` 提交于 2019-11-27 09:00:09
问题 I have just seen this within the past few days and cannot figure out how it works. The video I talk about is here: It's the top rated answer from this Stack Overflow question: Why was this program rejected by three compilers? How is this bitmap able to show a C++ program for "Hello World"? 回答1: A BMP (DIB) image is composed by a header followed by uncompressed 1 color data (for 24 bpp images it's 3 bytes per pixel, stored in reverse row order and with 4 bytes row stride). The bytes for color

How to implement an infinite image loop?

半城伤御伤魂 提交于 2019-11-27 08:50:53
问题 I am currently working on a 2D shooter with moving background. The background is just a simple image. I want to implement that the image is moving endless from top to bottom. I thought about determining the part of the image that is at the bottom outside the visible part of the frame and paint it on the top again. @Override public void paint(Graphics go) { Graphics2D g = (Graphics2D) go; g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.drawImage(this.imgBackground, 0, this.yBackground,

How to improve painting performance of DataGridView?

雨燕双飞 提交于 2019-11-27 08:21:42
(sorry for bad English) I have a big problem with performance of DataGridView when it re-paints. I'm using a DataGridView to show logs from an external application stream. Messages from the stream come in with a high frequency (less than 1 ms). If I add new row to the DataGridView immediately when each new message comes, the DataGridView doesn't have time to re-paint itself before the next message comes. A possible solution is to use a queue to collect messages and re-paint DataGridView every 100 ms with messages from queue. This is good but the DataGridView blinks when it auto-scrolls to the

How to detect if the area was 100% painted in as3

…衆ロ難τιáo~ 提交于 2019-11-27 08:05:19
问题 I´m making a game that simulates an industry of pan, and one of the process is Painting. What I want to do is to let the player paint the pan, but i don´t want it to be easy using FILL, i want that the player paint the pan with an brush and then the game detects if all the area was painted and let the player advance. For the painting i intend to use that library: http://www.nocircleno.com/graffiti/ But i have no idea how to detect if all the area was painted. Can someone show me some way of

setShadowLayer Android API differences

三世轮回 提交于 2019-11-27 07:35:01
I develop a custom view component for my application and I am struggling with adding a shadow to a circle. Here is the code of my class extending View public class ChartView extends View { public ChartView(Context context, AttributeSet attributeSet){ super(context, attributeSet); init(); } Paint paint; public void init(){ paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(Color.WHITE); paint.setStyle(Paint.Style.FILL); paint.setShadowLayer(30, 0, 0, Color.RED); } @Override protected void onDraw(Canvas canvas) { canvas.drawCircle(getWidth()/2, getHeight()/2,50, paint); } } However, I

Gradually speeding a sprite

情到浓时终转凉″ 提交于 2019-11-27 07:31:28
问题 I'm trying to make the sprite speed-up gradually on button press and not to move constant speed only. Also set a max-speed limit. I hope you understand what i mean. timer = new Timer(5, this); timer.start(); public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.drawImage(image, x, y, this); //x,y = position Toolkit.getDefaultToolkit().sync(); g.dispose(); } private class TAdapter extends KeyAdapter { public void keyPressed(KeyEvent e) { int key = e.getKeyCode();

java JFrame graphics

和自甴很熟 提交于 2019-11-27 07:20:30
问题 I have the following simple code in a JFrame constructor super(name); setBounds(0,0,1100,750); setLayout(null); setVisible(true); g = this.getGraphics(); int[] x =new int[]{65, 122, 77, 20, }; int[] y =new int[]{226, 258, 341, 310}; g.setColor(Color.RED); g.drawPolygon (x, y, x.length); System.out.println(g); I get the output on console as: sun.java2d.SunGraphics2D[font=java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12],color=java.awt.Color[r=255,g=0,b=0]] But no red polygon drawn

JLayeredPane and painting

我只是一个虾纸丫 提交于 2019-11-27 05:21:24
I am writing an application which has a JLayeredPane (call it layers) containing two JPanels in different layers. I override the paintComponent method of the JPanel at the bottom (call it grid_panel) so it paints a grid, and the the paintComponent method of the one at the top (call it circuit_panel) so it paints a circuit. Here's a summary of the structure: layers - |-circuit_panel (on top) |-grid_panel (at bottom) I want the grid_panel to stay static, ie, not to do any repaint (except the initial one) since it does not change. The trouble is, whenever I call circuit_panel.repaint(), grid

Is there already a canvas drawing directive for AngularJS out there?

拟墨画扇 提交于 2019-11-27 05:01:40
问题 Is there already a directive to draw/paint things on a canvas? So you can implement something like Paint or even something bigger like Photoshop etc., but a very basic example would suffice. I haven't found one in my search and if there's already one that is considered best practice I would like to use it. Else I have to implement one myself. 回答1: Ok I did one and it is actually pretty easy: app.directive("drawing", function(){ return { restrict: "A", link: function(scope, element){ var ctx =