Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!goblin1!goblin3!goblin.stu.neva.ru!news.netfront.net!not-for-mail From: Wanja Gayk Newsgroups: comp.lang.java.programmer Subject: Re: Mirror an image Date: Sun, 6 Apr 2014 20:18:52 +0200 Organization: Netfront http://www.netfront.net/ Lines: 58 Message-ID: References: <2299213c-18fc-4e55-ab39-22dce863b255@googlegroups.com> NNTP-Posting-Host: 77.177.60.159 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1396808341 60576 77.177.60.159 (6 Apr 2014 18:19:01 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Sun, 6 Apr 2014 18:19:01 +0000 (UTC) User-Agent: MicroPlanet-Gravity/3.0.4 Xref: csiph.com comp.lang.java.programmer:27962 In article , Roedy Green (see_website@mindprod.com.invalid) says... > > On Tue, 1 Apr 2014 07:44:03 -0700 (PDT), pgmbento93@gmail.com wrote, > quoted or indirectly quoted someone who said : > > >dont pay attention to the the comments.. what can i do? im new in java and = > >i dont know what to do > > The trick I suspect is to use an Affine transform to map each point to > its corresponding new position. > > See http://mindprod.com/jgloss/affinetransform.html Mirroring is actually much easier: Just use a negative width or height for the Graphics#drawImage method. Without any test, this would be my first, rough idea: The image: +-----+ +AAAAA+ +BBBBB+ +CCCCC+ +DDDDD+ +-----+ public void paintComponent(Graphics _g){ final Graphics2D g = (Graphics2D)_g; g.setClip( /* upper half, covering lines A and B */) g.drawImage( image, 0, 0 , width, height); //height > 0! g.setClip( /* lower half, covering lines C and D */) g.drawImage( image, bottomLeftCorner, width, -height); //height < 0! } Should result in: +-----+ +AAAAA+ +BBBBB+ +BBBBB+ +AAAAA+ +-----+ Not sure if that's bottom half corner or middle left, but that's just one attempt away, if it doesn't work as expected. Have fun. Kind regards, -Wanja- -- ..Alesi's problem was that the back of the car was jumping up and down dangerously - and I can assure you from having been teammate to Jean Alesi and knowing what kind of cars that he can pull up with, when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer] --- news://freenews.netfront.net/ - complaints: news@netfront.net ---