Questions tagged [custom-painting]
147 questions
0
votes
1 answer
Redraw CustomPaint without updating state / rebuilding widget?
I'm trying to understand how customPaint works, I want to draw a custom frame by frame animation on a canvas.
I can make it work by redrawing the widget every 1/60 seconds, but that doesn't sound very efficient. I would like render the CustomPainter…

jptsetung
- 9,064
- 3
- 43
- 55
0
votes
1 answer
Flutter displaying cropped widgets
I would like to paint widgets outside the canvas and display only cropped portion ie., the screen's size or my own size and I want to do this dynamically.
Eg:sample img
I was able to do this by using
UnconstrainedBox(
child: Align(
…

veradeus
- 41
- 4
0
votes
1 answer
How can I have equality check on a Function in a dart (to use in CustomPainter's shouldRepaint method)?
I have a problem with dart equality checks on a Function.
I have a CustomPainter and I want to implement it's shouldRepaint() method efficiently.
There is a Function field (ColorResolver) in the painter that gives a y value and gets a color for…

imaN NeoFighT
- 480
- 4
- 13
0
votes
1 answer
canvas drawLine offset property in flutter
OK so straight to the point
in flutter in order to draw a line we have to define offset points and as a dummy i cant understand how they work. I know that the offset displaces the drawn line but how am I suppose to know what values should I pass.…

Mansour Farokhinezhad
- 23
- 1
- 7
0
votes
0 answers
Flutter: onTap is not triggering on Gesture detector which is in top of a Custom Paint Widget
Here is my Widget
child: Scaffold(
body: GestureDetector(
behavior: HitTestBehavior.deferToChild,
onPanUpdate: (DragUpdateDetails details) {
setState(() {
RenderBox box =…

Utsab Malakar
- 1
- 1
0
votes
0 answers
List of all rendered words' boxes in Flutter
How can I have list of boxes containing all words I render, I need it to determine which word is user long clicking?
In other words how can I find what maxRange so I can use getBoxesForRange in code below?
My code :
var pin = Offset(0, 0);
//…

AVEbrahimi
- 17,993
- 23
- 107
- 210
0
votes
0 answers
Height of CustomPaint in flutter
I am buildig a CustomPaint widget to display text in a custom way, using ParagraphBuilder, named it myHtmlWidget.
My problem is how to determine height of widget before painting it?
I tried to call ParagraphBuilder in constructor of MyHtmlPainter…

AVEbrahimi
- 17,993
- 23
- 107
- 210
0
votes
1 answer
Custom painting and Z-order: query re painting order
So, I want to Z-order some components in a JFrame.
The component(s):
public class aBLUEBox extends JPanel{
int xPos = 19;
int yPos = 20;
int width = 10;
int height = 80;
public void paintBox(Graphics g){
…

ZanyGoose
- 3
- 2
0
votes
0 answers
Why can't I remove a dashed circle (arc) by drawing it twice with ctx.globalCompositeOperation = "xor";?
I want to make a dashed circle on a canvas in pure JavaScript, that moves to follow the mouse pointer. The circle has no (solid) fill. I thought that by just painting over it again with ctx.globalCompositeOperation = "xor"; would remove it, but that…

user2943111
- 421
- 1
- 5
- 15
0
votes
1 answer
How can I change the image size with giving one single int value instead changing all the time all the values?
private Image GetIcon(bool nodeIsExpanded)
{
if (openedImage == null)
InitImage();
return nodeIsExpanded ? openedImage : closedImage;
}
In the InitImage I'm setting the size in this case triangle :
private void…

Daniel Lip
- 3,867
- 7
- 58
- 120
0
votes
1 answer
Use multiple threads to update GUI
I'm learning to work with java threads, so I decided to make a simple bouncing balls program.
However, the program shows multiple threads but only one takes advantage of the window size, other balls are restricted to one area.
I tried setting the…

NullForest
- 3
- 1
- 2
0
votes
1 answer
Trying to divide color's to draw rainbow donut
Board class:
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import javax.swing.JPanel;
public class Board extends JPanel {
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
…
0
votes
1 answer
How to draw a bar in this example?
In this exercise, when you enter the name of a city and its population, in the window it must be graphed a bar that represents the population of that city as shown in the figures, the exercise is almost complete but it doesn't work, could someone…

Luis Alejandro
- 57
- 5
0
votes
0 answers
How do you draw one shape under another in Java?
I know how to draw shapes and stuff in Java and know that more recently-drawn shapes stack up on previously drawn shapes, but how do you draw one shape under another? Like let's say you filled a Rectangle() r1, but then filled another Rectangle() r2…

MineEnim
- 1
- 1
0
votes
1 answer
How do I draw on a JPanel from multiple outside classes?
I am currently making a game with a main menu and a world where you actually play.
I have a class called Game, which inherits from JPanel and implements the Runnable, MouseListener, KeyListener and ActionListener interfaces
(only important parts…

Keheck
- 131
- 1
- 10