rectangles

Qt drawing a filled rounded rectangle with border

落花浮王杯 提交于 2020-01-09 19:03:07
问题 I want to draw a rectangle with rounded corners (border radius same for all 4 corners) with a specific color filling the entire rectangle, and a separate border color (say border is 1 px wide). From my observation, Qt provides three methods - fillRect and drawRect and drawRoundedRect . I have tried them, they don't work like I want to. There is no method like fillRoundedRect . Which means that I can draw a rounded rectangle but it won't be filled with the color I want. How do I do it? And

Having trouble drawing simple rectangle in picturebox

断了今生、忘了曾经 提交于 2020-01-06 20:38:13
问题 I have a picture box that will be showing an image. I want the user to be able to click, drag, and mouse up to a rectangle on the image. Like "I want to do something using this rectangle I drew here on this picture". If they click again, I want the previous rectangle to disappear and they start over or when I click a button to clear the highlighting rectangle they drew. So I did find some good starting code from the msdn example about creating a zoom in rubber band rectangle that I edited a

Draw rectangle on mouse click [Python]

旧街凉风 提交于 2020-01-03 03:45:05
问题 def xaxis(event): x1, y1 = (event.x - 1), (event.y - 1) def yaxis(event): x2, y2 = (event.x + 1), (event.y + 1) def create(event): w.create_rectangle(x1,y1,x2,y2,fill='Black') w = Canvas(root, width=canvas_width, height=canvas_height) w.config(cursor='cross') w.pack(expand=YES, fill=BOTH) w.bind("<Button-1>", xaxis) w.bind("<ButtonRelease-1>", yaxis) w.bind("<ButtonRelease-1>", create) The shell says Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks

Paint method java - Rectangle with outline

半腔热情 提交于 2020-01-02 10:03:46
问题 I want to create a wall with a blue line outline and black filling. I have only a blue wall now and I tried a couple of the Graphics methods but wasn't working. public void paint(Graphics g) { g.setColor(Color.blue); g.fillRect(x, y, size, size); } 回答1: First, override paintComponent , not paint . Second, there's no need to re-invent the wheel like that. Instead, use an existing Swing component (e.g. JPanel ), import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout;

Extracting text from pdf (java using pdfbox library) from a table's rows with different heights

扶醉桌前 提交于 2020-01-02 09:24:17
问题 Black shapes are text that need to be extracted: So far, i've extracted the text from columns, but manually, because there are only 5 (using the Rectangle class for the regions). My question is: is there a way to do so for rows since the size (height) of the Rectangles are different and manually doing it to 50+ rows would be an atrocity? More specific, can i change the rectangle according to every row's height using a function? Or any suggestion that may help? 回答1: As proposed in comments,

Extracting text from pdf (java using pdfbox library) from a table's rows with different heights

最后都变了- 提交于 2020-01-02 09:23:29
问题 Black shapes are text that need to be extracted: So far, i've extracted the text from columns, but manually, because there are only 5 (using the Rectangle class for the regions). My question is: is there a way to do so for rows since the size (height) of the Rectangles are different and manually doing it to 50+ rows would be an atrocity? More specific, can i change the rectangle according to every row's height using a function? Or any suggestion that may help? 回答1: As proposed in comments,

How do I draw the outline of a collection of rectangles?

ⅰ亾dé卋堺 提交于 2020-01-02 06:38:44
问题 As part of a project I'm working on I have to store and restore magic wand regions from an image. To obtain the data for storage, I'm utilizing the GetRegionData method. As the specification specifies, this method: Returns a RegionData that represents the information that describes this Region. I store the byte[] kept in the RegionData.Data property in a base64 string, so I can retrieve the RegionData later through a somewhat unconventional method: // This "instantiates" a RegionData object

How do I see if two rectangles intersect in JavaScript or pseudocode?

℡╲_俬逩灬. 提交于 2020-01-02 02:32:27
问题 I have two rectangles which I must return in a function whether they intersect or not. They are represented by [ x0, y0, x1, y1 ] pairs that represent the top-left and bottom-right corner of the rectangles. Alternatively, your solution could be [ x0, y0, width, height ] if its somehow simpler, I can adapt my function's parameter input by it. I tried to see if any of the two corners from rectangle A are included in rectangle B but if A is larger than B and B is partially included in A, it will

java.awt.Rectangle. intersection()

不问归期 提交于 2020-01-01 19:42:07
问题 I was developing an task when I decided to use java.awt.Rectangle to calculate the intersection between two rectangles. I realised that the output is different from what I expected. I'm not sure if I understood how this method works or not. For the values in the example here java.awt.Rectangle[x=0,y=10,width=5,height=8] java.awt.Rectangle[x=3,y=15,width=17,height=14] I expect the intersection to be java.awt.Rectangle[x=3,y=10,width=2,height=8] but the program prints java.awt.Rectangle[x=3,y

Merging and splitting overlapping rectangles to produce non-overlapping ones

余生长醉 提交于 2020-01-01 07:02:29
问题 I am looking for an algorithm as follows: Given a set of possibly overlapping rectangles (All of which are "not rotated", can be uniformly represented as (left,top,right,bottom) tuplets, etc...), it returns a minimal set of (non-rotated) non-overlapping rectangles, that occupy the same area. It seems simple enough at first glance, but prooves to be tricky (at least to be done efficiently). Are there some known methods for this/ideas/pointers? Methods for not necessarily minimal, but