graphics

java paint problem - black components

旧巷老猫 提交于 2020-02-24 07:50:31
问题 I am having a weird java problem - For some reason quite often when I open a dialog it becomes black. When I force a repaint (for example, draging it out and into the screen again) it draws itself normaly again. The problem seems to occur only on my computer (The same code works for a friend), and its not just one class - it seems that almost every dialogs I open (on different projects) gets this problem. Even JOptionPane.showMessageDialog() gets this problem. Even weirder, it even happens

Analyze colors of an Image

大兔子大兔子 提交于 2020-02-21 03:29:02
问题 I have part of an Image cropped out, and 2 Color Ranges (H/S/L) defined via 12 trackbars. I also have a "Precision/Speed" slider ranging from 1 to 10. I need to analyze how many pixels of the Image fall into each of the specified Color Ranges. Based on the precision/speed slider, I skip some rows/pixels. Its working great but its too slow. With high precision (trackbar value = 1), it takes about 550 ms. With low precision but high speed (trackbar value = 10) it takes about 5 ms. Is there a

Analyze colors of an Image

萝らか妹 提交于 2020-02-21 03:28:09
问题 I have part of an Image cropped out, and 2 Color Ranges (H/S/L) defined via 12 trackbars. I also have a "Precision/Speed" slider ranging from 1 to 10. I need to analyze how many pixels of the Image fall into each of the specified Color Ranges. Based on the precision/speed slider, I skip some rows/pixels. Its working great but its too slow. With high precision (trackbar value = 1), it takes about 550 ms. With low precision but high speed (trackbar value = 10) it takes about 5 ms. Is there a

Jcrop not cropping properly the images

落爺英雄遲暮 提交于 2020-02-20 07:55:06
问题 My jcrop code $(function(){ // Create variables (in this scope) to hold the API and image size var jcrop_api, boundx, boundy, // Grab some information about the preview pane $preview = $('#preview-pane'), $pcnt = $('#preview-pane .preview-container'), $pimg = $('#preview-pane .preview-container img'), xsize = $pcnt.width(), ysize = $pcnt.height(); //console.log('init',[xsize,ysize]); $('#target').Jcrop({ onChange: updateInfo, onSelect: updateInfo, onRelease: clearInfo, setSelect: [0, 0, 150,

Updating a JLabel within a JFrame

爱⌒轻易说出口 提交于 2020-02-15 06:52:19
问题 I've been searching around this site and the internet for hours trying to figure out how to fix this problem. I'm creating a game and it's my first time using graphics. I figured out how to create a JFrame, JPanel and JLabel, and the only problem I can't seem to get around is updating the JLabel. Let's say I start it out like this: JLabel testing = new JLabel ("blah", JLabel.CENTER); testing.setAlignmentX(0); testing.setAlignmentY(0); frame.add(testing); I am able to change the text after a

Convert Graphics object to Bitmap

杀马特。学长 韩版系。学妹 提交于 2020-02-14 21:37:51
问题 I do have following issue with my graphics object. EDIT: I do have a picturebox_image (imageRxTx) which is a live stream from a camera. What I do in the paint event is to draw some lines on top of the image imageRxTx (not shown in the code below). This works so far without problem. Now I need to check for circles in imageRxTx and therefore I have to use the method ProcessImage() which needs a Bitmap as parameter. Unfortunately I do not have the Bitmap image but rather the handle (hDC) to my

Convert Graphics object to Bitmap

怎甘沉沦 提交于 2020-02-14 21:35:36
问题 I do have following issue with my graphics object. EDIT: I do have a picturebox_image (imageRxTx) which is a live stream from a camera. What I do in the paint event is to draw some lines on top of the image imageRxTx (not shown in the code below). This works so far without problem. Now I need to check for circles in imageRxTx and therefore I have to use the method ProcessImage() which needs a Bitmap as parameter. Unfortunately I do not have the Bitmap image but rather the handle (hDC) to my

Convert Graphics object to Bitmap

天涯浪子 提交于 2020-02-14 21:35:12
问题 I do have following issue with my graphics object. EDIT: I do have a picturebox_image (imageRxTx) which is a live stream from a camera. What I do in the paint event is to draw some lines on top of the image imageRxTx (not shown in the code below). This works so far without problem. Now I need to check for circles in imageRxTx and therefore I have to use the method ProcessImage() which needs a Bitmap as parameter. Unfortunately I do not have the Bitmap image but rather the handle (hDC) to my

Equality of GDI+ Regions

╄→гoц情女王★ 提交于 2020-02-04 20:45:50
问题 Why does the assertion fail in the following code? Why aren't regions a and b equal? Region a = new Region(new RectangleF(0.0f, 0.0f, 10.0f, 10.0f)); Region b = new Region(); b.MakeEmpty(); b.Union(new RectangleF(0.0f, 0.0f, 10.0f, 10.0f)); Debug.Assert(a == b, "Regions not equal"); 回答1: From what I can see, System.Drawing.Region does not override Object 's implementation of Equals() . Therefore your == call is using ReferenceEquals and simply telling you a and b are not the same object. Try

Equality of GDI+ Regions

心不动则不痛 提交于 2020-02-04 20:43:50
问题 Why does the assertion fail in the following code? Why aren't regions a and b equal? Region a = new Region(new RectangleF(0.0f, 0.0f, 10.0f, 10.0f)); Region b = new Region(); b.MakeEmpty(); b.Union(new RectangleF(0.0f, 0.0f, 10.0f, 10.0f)); Debug.Assert(a == b, "Regions not equal"); 回答1: From what I can see, System.Drawing.Region does not override Object 's implementation of Equals() . Therefore your == call is using ReferenceEquals and simply telling you a and b are not the same object. Try