paint

creating clickable “buttons” c++

断了今生、忘了曾经 提交于 2019-12-21 02:42:21
问题 hey i am trying to basically just make a button in my little console application which can be pressed. here's a snippet of what i use to get the cursor location if (GetKeyState(VK_LBUTTON) < 0) { { POINT p; if (GetCursorPos(&p)) { cout<<"\nSCREEN\nx coord->"; cout<<p.x; cout<<"\ny coord->"; cout<<p.y; } SetConsoleTitle("paint"); HWND hWnd; hWnd = FindWindow(NULL, "paint"); if (ScreenToClient(hWnd, &p)); { cout<<"\n\nWINDOW\nx coord->"; cout<<p.x; cout<<"\ny coord->"; cout<<p.y; } int pwx; int

Android custom brush pattern/image

早过忘川 提交于 2019-12-21 02:25:10
问题 I have an 8x8 Image. (bitmap - can be changed) What I want to do is be able to draw a shape, given a Path and Paint object onto my SurfaceView . At the moment all I can do is fill the shape with solid colour. How can I draw it with a pattern. In the image you can see the brush pattern (The cross). It can be anything from a cross to a donut or an elf. How would I go about drawing this pattern background. I also eventually want to apply colours to it. So far, my theory is to create a clip area

Painting to panel after .Update() call

大兔子大兔子 提交于 2019-12-20 06:25:25
问题 I have a problem when trying to draw to a panel immediatly after calling a panel.Update(); Here's the code: public void AddAndDraw(double X, double Y){ AddPoint (X, Y); bool invalidated = false; if (X > _master.xMaxRange) { _master.Update (); invalidated = true; } if (Y > _master.yMaxRange) { _master.Update (); invalidated = true; } if (!invalidated) { _master.UpdateGraph (this); } else { _master.PaintContent (); } } When running this problem I only see the cleared panel and not he content I

Post overriding the paint method of the components in java

时光毁灭记忆、已成空白 提交于 2019-12-20 05:49:23
问题 In java awt or swing when you want to change painting of some component you usually have to override the method paint(Graphics g) (in awt) or paintComponent(Graphics g) (in swing). This is usually (maybe allways - I'm not sure) done when you are creating the component for example: JPanel jPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; //... my implementation of paint, some transfromations, rotation, etc }

How to paint an invisible JFrame elsewhere?

主宰稳场 提交于 2019-12-20 05:41:38
问题 I want to paint the contents of a JFrame onto another frame. Currently, I only get it to work if the JFrame is visible. Is there a way to paint a hidden JFrame? Additional info: In my project I need to be able to rotate and scale windows. I do not want to write my own window-api, so I thought I might be able to just paint JFrames or similar container classes in a rotated way (which the Graphics2D-API supports perfectly well). It would be awesome to be able to use standard JFrames for that,

How to increase drawing speed of JPictureBox for large image?

五迷三道 提交于 2019-12-20 05:38:21
问题 I have a JPictureBox extends from a java.awt.Component see code here http://pastebin.com/SAJc6Sht. But it only works well when there is no image stretching. Especially for the big picture, it slows program dramatically. How to increase drawing speed of JPictureBox for large image? @Override public void paint(Graphics g) { super.paint(g); int x = 0; int y = 0; int w = 0; int h = 0; if (image != null) { switch (sizeMode) { case AUTO_SIZE: case NORMAL: w = image.getWidth(); h = image.getHeight()

Draw a line on ImageView set by Picasso

时间秒杀一切 提交于 2019-12-20 04:38:41
问题 I am trying to figure out how to simply draw a line on an image that is being set in Picasso. I found that if I simply set the image, given a URI, with Picasso and try to draw paint to it using the following: canvas = new Canvas(bitmap); image.draw(canvas); topEdge = new Paint(); topEdge.setColor(context.getResources().getColor(R.color.blue)); topEdge.setStrokeWidth(5); canvas.drawLine(c1.getX(), c1.getY(), c2.getX(), c2.getY(), topEdge); Then I get a crash saying that the bitmap needs to be

android - how to set custom typeface in paint object?

拜拜、爱过 提交于 2019-12-20 04:09:35
问题 I want to use a Paint to draw something and here is my code : Paint mMonthTitlePaint = new Paint(); mMonthTitlePaint.setFakeBoldText(true); mMonthTitlePaint.setAntiAlias(true); mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE); mMonthTitlePaint.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/iran_sans_.ttf")); mMonthTitlePaint.setColor(mDayTextColor); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.setStyle(Style.FILL); but it is not working and typeface did not apply

cannot draw ellipse on form load in c#

若如初见. 提交于 2019-12-20 04:03:42
问题 I am trying to draw some ellipse in a picturebox that contains a PNG on a formload in c#. When I execute the code down below, I see my ellipses for half of a second, then I don't see them no more. When I click on my picturebox, I am able to draw an ellipse however, when I minimize the form, they don't appear no more. I've read that you shouldn't put your drawing code in the formload but rather in the OnPaint method, which is what I did. I don't know what to try anymore. thank you. (Be aware

Repainting Continuously in Java

浪尽此生 提交于 2019-12-19 10:58:34
问题 I have a Java program that uses threads. In my run method, I have: public void run() { while(thread != null){ repaint(); System.out.println("hi"); try { Thread.sleep(1000); } catch (InterruptedException e) { break; } } } public void paintComponent(Graphics g) { // painting stuff } The problem is that the run method is executed, but the paintComponent section is not called. If this is not the right way to keep repainting the component, then how should I repaint it? 回答1: Cal repaint from a