Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3232
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Color of a pixel of a |
| Message-ID | <47cdad67$0$9381$4d87748@newsreader.readnews.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <2051eaf6-6ee3-4e0c-8050-3a9d98c45bf6@8g2000hse.googlegroups.c |
| Date | 2011-04-27 15:43 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui mearvk wrote: > I'm stuck and tired. > > How can I find the color of an arbitrary pixel of a JPanel or > JComponent for that matter? Something like: getColor(x, y) is all I > really need. > > Also while I'm posting is this a cleverer way than color > differentiation (hence the above question) to satisfy an arbitrary > (custom) Shape's contains(Point2D p) method? I let the user draw a > pair of identical CubicCurve2D curves and connect them with a pair of > Line2Ds. I need a good way to determine, for an arbitrary "strip", if > an arbitrary point is in or out of it. I would even settle for a way > to get at all the points Graphics2D fills when I do a > g2.fill(myShape). > > [API] > > contains(Point2D p) > Tests if a specified Point2D is inside the boundary of the Shape. > > http://java.sun.com/javase/6/docs/api/index.html > > [API] > > > Thanks! Look up GeneralPath (or Path2D in version 1.6) You can create your own Shape object based on several other shapes, and then you can call .contains. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread
Re: Color of a pixel of a "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
csiph-web