Cloning BufferedImage

Please can someone advise on the correct way to produce a deep copy of a BufferedImage. Normal cloning does not seem to work.
Is this a correct implementation, so that copied images will not have shared raster data with the original (ie. so when I change the original, the changes are not replicated in the copy).
public BufferedImage copyBufferedImage(BufferedImage original_image)
return (BufferedImage)original_image.getScaledInstance(original_image.getWidth(), original_image.getHeight(),BufferedImage.TYPE_BYTE_GRAY);
Many thanks in advance
Dave

Why not create a new BufferedImage of the same type as
the original then just draw the original image onto
the graphics of the second.
BufferedImage newImage = new BufferedImage(original.getWidth(),original.getHeight(), original.getColorModel());There's no BufferedImage constructor that takes a width, height and colormodel, or did you mean for
the third argument to be original.getType()? Even then, you can't do this if the type of the BufferedImage is
TYPE_CUSTOM, which is not unusual. Why not use deepCopy:
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
public class Test {
    static BufferedImage deepCopy(BufferedImage bi) {
        ColorModel cm = bi.getColorModel();
        boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
        WritableRaster raster = bi.copyData(null);
        return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
    public static void main(String[] args) throws IOException {
        URL url = new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg");
        BufferedImage image = ImageIO.read(url);
        BufferedImage image2 = deepCopy(image);
        Graphics2D g = image.createGraphics();
        g.setColor(Color.RED);
        g.fillRect(100,100,50,50);
        g.dispose();
        JPanel p = new JPanel();
        p.add(new JLabel(new ImageIcon(image)));
        p.add(new JLabel(new ImageIcon(image2)));
        JFrame f = new JFrame("Test");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setContentPane(p);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);

Similar Messages

  • Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that- thanks

    Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that… thanks

    There's more to it than that.
    Folders in Aperture do not hold Images.  They hold Projects and Albums.  You cannot put an Image in a Folder without putting it in a Project or an Album inside that Folder.
    The relationship between Projects and Images is special:  every Image must in a Project, and can be in only one Project.
    Images can be in as many Albums you want.  Putting an Image in an Album does not move it from the Project that holds it.
    You can make as many Versions from a Master as you want.
    What you want to do may appear simple to you, but it still much adhere to how Aperture works.  I still can't tell exactly what you are trying to do (specifically: Images don't live in Folders; moving an Image from a Folder is non-sensical).
    It can be very confusing (and frustrating) to get going with Aperture -- but it does work, and can be enormously helpful.  If you haven't, take a look at the video tutorials on Apple's Aperture support site.
    I feel as though I haven't helped you much -- but we need to be using the same names for interface items in order to get anything done -- and my sense is that you still haven't learned the names of the parts.

  • Will the late 2013 Mac Pro boot from an external drive (4Tb, USB 3) with a cloned Win7 x64 partition on it?

    Hello all,
    I ordered a CTO Mac Pro for heavy rendering and animating work, and I am planning on using bootcamp to install a windows partition (for 3DsMax). As I am now using a HP Elitebook 8770W that has several valuable files and projects on it, I have bought a Seagate 4Tb external Desktop Drive that uses USB 3.0 to use as a backup drive. Now, as I saw that Bootcamp Assistant only supports installing a x64 version of Windows 8, my question is:
    Will a late 2013 Mac Pro using bootcamp assistant boot from an external USB drive with a cloned partition running x64 win7? Or do I really have to buy Windows 8 and install that to my internal SSD, and then use the migration assistant to copy over my projects?
    Thanks!

    Posted? or found in new builds?
    BCA should really just pull whatever the latest drivers are when run. 
    If it is with how it partitions and sets up nMP and its partition for Windows that is another matter and makes sense.
    Some people want UEFI native booting in Windows, and my experieince with that on PCs has been that it boots faster and runs well, but has different partitions that it wants. For one thing, there is now a backup "system reserved" partition, just as Apple GUID has some volume information blocks and backup and areas that were once optional (and if format erase was not able to, it would not create one) are now mandatory.
    Windows 8.1 is req'd, reason a backup should be a big must - is it might overwrite and use another OS's  partition table entries.  Especially when doing UEFI install.
    There was something about which linux OS was safe and how they would each add entries in the table, but one would not place nice.  That one had to be done first or not at all.

  • Can not request reports after cloning process

    hello All,
    I am new in oracle please guide me.
    I have tried to make the process of cloning from dev machine to test machine, but after that the applications in dev machine was not able to request another report.
    With Status: No Manager and phase: Inactive
    we use:
    RDBMS : 10.2.0.2.0
    Oracle Application: 12.0.2(HRMS)
    os: AIX 5.3 (64 bit)
    I previously tried the ways of my search results on the forums and internet
    1. Truncate FND_CONCURRENT_PROCESSES...
    truncate table FND_CONCURRENT_PROCESSES;
    2. Update FND_CONCURRENT_REQUESTS as follows:
    update fnd_concurrent_requests
    set status_code='X', phase_code='C'
    where status_code='T'
    3. Update FND_CONCURRENT_QUEUES.RUNNING_PROCESSES to zero
    update fnd_concurrent_queues
    set running_processes = 0;
    4. restart conccurent managers,and has not succeeded.
    and then I tried another way of information that I got
    1. Stop the Internal Concurrent Manager.
    2. Connect to the database via SQL*Plus as the APPS user.
    3. Execute the following to alter the FNDSM trigger on FND_NODES:
    CREATE OR REPLACE TRIGGER fndsm
    AFTER INSERT OR UPDATE ON FND_NODES <---- ( "OR UPDATE" I do additional)
    FOR EACH ROW
    BEGIN
    if ( :new.NODE_NAME <> 'AUTHENTICATION' ) then
    if ( (:new.SUPPORT_CP='Y')
    or (:new.SUPPORT_FORMS='Y')
    or (:new.SUPPORT_WEB='Y') ) then
    fnd_cp_fndsm.register_fndsm_fcq(:new.NODE_NAME);
    end if;
    if (:new.SUPPORT_CP = 'Y') then
    fnd_cp_fndsm.register_fndim_fcq(:new.NODE_NAME);
    end if;
    end if;
    END;
    4. Cleanup the FND_NODES table by executing the following:
    SQL> exec FND_CONC_CLONE.SETUP_CLEAN;
    5. Run AutoConfig on each node.
    6. Restart the Concurrent Managers. and still does not work.
    if something is missing or wrong from the way I do or there are other ways more appropriate for me to do?
    Thanks,
    Batara

    earlier thanks for your concern and support for you all ,     
    I've run as shown in MOS Doc 134007.1 , but it still does not work, and the clone,
    actually the clone that we do is still in trial and we have not too much concentration to the test instance as the target system, but the problem is that dev instance as the source system should not in fact the configuration changes become problematic,as not requesting another report.
    and this is my next piece of the internal display manager log:
    ========================================================================
    Starting DEV_1111@DEV Internal Concurrent Manager -- shell process ID 725148
    logfile=/u01/oracle/DEV/inst/apps/DEV_hrmdev/logs/appl/conc/log/DEV_1111.mgr
    PRINTER=noprint
    mailto=devmgr
    restart=N
    diag=N
    sleep=30 (default)
    pmon=4 (default)
    quesiz=1 (default)
    Reviver is ENABLED
    Application Object Library: Concurrent Processing version 11.5
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    Internal Concurrent Manager started : 11-NOV-2009 11:43:06
    Process monitor session started : 11-NOV-2009 11:43:06
    Starting PODAMGR Concurrent Manager : 11-NOV-2009 11:43:07
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager PODAMGR with library /u01/oracle/DEV/apps/apps_st/appl/po/12.0.0/bin/POXCON.
    Check that your system has enough resources to start a concurrent manager process. Contact y : 11-NOV-2009 11:43:07
    Starting INVTMRPM Concurrent Manager : 11-NOV-2009 11:43:07
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager INVTMRPM with library /u01/oracle/DEV/apps/apps_st/appl/inv/12.0.0/bin/INCTM.
    Check that your system has enough resources to start a concurrent manager process. Contact : 11-NOV-2009 11:43:07
    Starting RCVOLTM Concurrent Manager : 11-NOV-2009 11:43:07
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager RCVOLTM with library /u01/oracle/DEV/apps/apps_st/appl/po/12.0.0/bin/RCVOLTM.
    Check that your system has enough resources to start a concurrent manager process. Contact : 11-NOV-2009 11:43:08
    Starting FFTM Concurrent Manager : 11-NOV-2009 11:43:08
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager FFTM with library /u01/oracle/DEV/apps/apps_st/appl/ff/12.0.0/bin/FFTM.
    Check that your system has enough resources to start a concurrent manager process. Contact your s : 11-NOV-2009 11:43:08
    Could not find service instance context for service instance number 804345408
    Could not find service instance context for service instance number 804345408
    Could not find service instance context for service instance number 804345408
    Could not find service instance context for service instance number 804345408
    Check that your system has enough resources to start a concurrent manager process. Contac : 11-NOV-2009 11:43:11
    Starting STANDARD Concurrent Manager : 11-NOV-2009 11:43:11
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager STANDARD with library /u01/oracle/DEV/apps/apps_st/appl/fnd/12.0.0/bin/FNDLIBR.
    Check that your system has enough resources to start a concurrent manager process. Contac : 11-NOV-2009 11:43:11
    Starting STANDARD Concurrent Manager : 11-NOV-2009 11:43:11
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager STANDARD with library /u01/oracle/DEV/apps/apps_st/appl/fnd/12.0.0/bin/FNDLIBR.
    Starting OAMCOLMGR Concurrent Manager : 11-NOV-2009 15:13:32
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager OAMCOLMGR with library /u01/oracle/DEV/apps/apps_st/appl/fnd/12.0.0/bin/FNDLIBR.
    Check that your system has enough resources to start a concurrent manager process. Conta : 11-NOV-2009 15:13:33
    Starting INVMGR Concurrent Manager : 11-NOV-2009 15:13:33
    Could not initialize the Service Manager FNDSM_HRMDEV_DEV. Verify that HRMDEV has been registered for concurrent processing.
    Routine AFPEIM encountered an error while starting concurrent manager INVMGR with library /u01/oracle/DEV/apps/apps_st/appl/inv/12.0.0/bin/INVLIBR.
    Check that your system has enough resources to start a concurrent manager process. Contact : 11-NOV-2009 15:13:33
    Process monitor session ended : 11-NOV-2009 15:13:33
    please help and guidance
    Regards
    Batara

  • Can I use both newly cloned MBPR retina and old-MBP with same Time Machine

    When my new-MBPR retina cloned from the old-MBP back up in Time Machine via migration assistance, will this newly-cloned MBPR continue thereon backing up with the same old-MBP back up in Time Machine? I.e. continuing same timeline?
    And what happen to my old-MBP back up, if I continuing to use my old-MBP with the same Time Machine on? Will TM recognised 2 different MBP and thus creating 2 back ups? I seem to have problem to keep 2 MBP running with same TM. Programs not responding even force quitting them!
    And what should I do to use both? Appreciate your help. Thank you.

    OK, but in general I can use this one device as both file storage and Time Machine.
    I thought that (for some reason) once I set up the Time Capsule to act just as Time Machine storage I would be unable to access it as a plain file storage.
    I have just tested it now, and it seems it can work as both - file storage and Time Machine. I can see the Time Machine backup file on it and folders where I can dump regular files.
    The only thing I would need to occasionally do is delete some old backups to keep Time Machine segment below 1 TB just so I have plenty of space for regular files.
    This thing is awesome. :)

  • BufferedImage creation slow in JDK 1.4.2

    Hi,
    The creation of BufferedImage of size 400x400 takes 156ms in JDK1.4.2. It used to take less than 10ms in JDK1.3.1.
    Image image = new BufferedImage(400, 400, BufferedImage.TYPE_INT_ARGB);
    In JDK1.4.2, for sizes 363x363 and above, it takes 156ms and
    for sizes under 363x363, it takes close to 0ms.
    Is this a bug in JDK 1.4.2? I noticed similar behavior in JDK1.5 also.
    My machine configuration:
    Windows XP, 512MB Ram, 1.7GHz
    Thanks,
    Bindu

    The arg type of the setter and the return type of the getter must match up or you'll get this exception.

  • Image processing with BLOBS: how to write BufferedImage to a BLOB

    Hi everybody - thanks in advance for any input on that topic.
    I'm doing image processing using AWT and 2D. Images are stored in a RDBMS as BLOB Type, which I get using JDBC and convert to a BufferedImage using a JDBCImageDecoder.
    Now, I have my BufferedImage and I can process them using the appropriate filters (ConvolveOp e.g.)
    Writing the BufferedImages to disk or display on screen is easy. But I can't get to write them to a BLOB Object. Any Hint ?
    (Of course, I'm speaking of oracle.sql.BLOB objects, not java.sql.Blob).
    Thanks and have a nice day

    Billy,
    Thank you for your answer. I have two questions.
    First what that means "Bob's your uncle ?" I'm a french man, not used to english special sentences ou jargon. Would enjoy to know !
    Second, I have created a PL/SQL procedure to update my table. I face a problem.
    I want to initialize b_lob with the img_blob value but I get an error : "ORA-22922: nonexistent LOB value". WHere do my error comes from ? I am fairly new in this stuff of BLOB.
    Below my procedure.
    Thank for your kind help.
    Christian.
    create or replace
    procedure insert_img as
    f_lob bfile;
    b_lob blob;
    loops number default 0 ;
    lines number default 0;
    stmt varchar2(4000);
    cursor c1 is select img_blob, file_name, pk from photos FOR UPDATE ;
    begin
    NULL;
    dbms_output.enable(900000);
    stmt := 'SELECT COUNT(*) FROM PHOTOS';
    EXECUTE IMMEDIATE stmt INTO LINES ;
    for ligne in c1 loop
    exit when loops >= lines ;
    loops := loops+1;
    update photos set img_blob= empty_blob() where CURRENT OF C1;
    -- return img_blob into b_lob;
    b_lob := ligne.img_blob ;
    f_lob := bfilename( 'MY_FILES', ligne.file_name );
    IF (DBMS_LOB.FILEEXISTS(f_lob) != 0)
    THEN
          DBMS_OUTPUT.PUT_LINE('BFILE exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
          dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
          dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
          dbms_lob.fileclose(f_lob);
          dbms_output.put_line('ligne.pk :' || ligne.pk || ', lines : ' || lines || ', loops ' || loops);
      ELSE
        DBMS_OUTPUT.PUT_LINE('BFILE does not exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
      END IF;
    end loop;
    commit;
    end insert_img;

  • Need help: BufferedImage and zooming

    please help me understand what i am doing wrong. i am having a hard time understanding the concept behind BufferedImage and zooming. the applet code loads an image as its background. after loading, you can draw line segments on it. but when i try to zoom in, the image in the background remains the same in terms of size, line segments are the only ones that are being zoomed, and the mouse coordinates are confusing.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.imageio.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.io.IOException;
    import java.net.URL;
    import java.awt.image.*;
    public class Testing extends JApplet {
         private String url;
         private Map map;
         public void init() {
         public void start()
              url = "http://localhost/image.gif";
                  map = new Map(url);
                 getContentPane().add(map, "Center");
                 validate();
                 map.validate();
    class Map extends JPanel implements MouseListener, MouseMotionListener{
         private Image image;
         private ArrayList<Point2D> points;
         private ArrayList<Line2D> lineSegment;
         private Point2D startingPoint;
         private int mouseX;
         private int mouseY;
         private BufferedImage bimg;
         private AffineTransform xform;
         private AffineTransform inverse;
         private double zoomFactor = 1;
         public Map(String url)
                         super();
              //this.image = image;
              try
                   image = ImageIO.read(new URL(url));
              catch(Exception e)
              Insets insets = getInsets();
              xform = AffineTransform.getTranslateInstance(insets.left, insets.top);
              xform.scale(zoomFactor,zoomFactor);
              try {
                   inverse = xform.createInverse();
              } catch (NoninvertibleTransformException e) {
                   System.out.println(e);
              points = new ArrayList();
              startingPoint = new Point();
              bimg = new BufferedImage(this.image.getWidth(this), this.image.getHeight(this), BufferedImage.TYPE_INT_ARGB);
              repaintBImg();
              addMouseListener(this);
              addMouseMotionListener(this);
         public void paintComponent(Graphics g)
            Graphics2D g2d = (Graphics2D)g;
              g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
              g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING , RenderingHints.VALUE_RENDER_QUALITY ));
            bimg = (BufferedImage)image;
            g2d.drawRenderedImage(bimg, xform);
            if(!points.isEmpty())
                 for(int i=0; i<points.size(); i++)
                      if(i > 0)
                           drawLineSegment(g2d,points.get(i-1),points.get(i));
                      drawPoint(g2d, points.get(i));
            if(startingPoint != null)
                drawTempLine(startingPoint, g2d);
            else
                mouseX = 0;
                mouseY = 0;
         private void repaintBImg()
              bimg.flush();
              Graphics2D g2d = bimg.createGraphics();
              g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
              g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING , RenderingHints.VALUE_RENDER_QUALITY ));
            g2d.drawRenderedImage(bimg, xform);
            g2d.dispose();
         private void drawPoint(Graphics2D g2d, Point2D p)
            int x = (int)(p.getX() * zoomFactor);
            int y = (int)(p.getY() * zoomFactor);
            int w = (int)(13 * zoomFactor);
            int h = (int)(13 * zoomFactor);
              g2d.setColor(Color.ORANGE);
              g2d.setStroke(new BasicStroke(1.0F));
            g2d.fillOval(x - w / 2, y - h / 2, w, h);
            g2d.setColor(Color.BLACK);
            g2d.drawOval(x - w / 2, y - h / 2, w - 1, h - 1);
         private void drawLineSegment(Graphics2D g2d, Point2D p1, Point2D p2)
              double x1 = p1.getX() * zoomFactor;
                 double y1 = p1.getY() * zoomFactor;
                 double x2 = p2.getX() * zoomFactor;
                 double y2 = p2.getY() * zoomFactor;
                 g2d.setColor(Color.RED);
                 g2d.setStroke(new BasicStroke(3.0F));
                 g2d.draw(new java.awt.geom.Line2D.Double(x1, y1, x2, y2));
             private void drawTempLine(Point2D p, Graphics2D g2d)
                 int startX = (int)(p.getX() * zoomFactor);
                 int startY = (int)(p.getY() * zoomFactor);
                 if(mouseX != 0 && mouseY != 0)
                         g2d.setColor(Color.RED);
                          g2d.setStroke(new BasicStroke(2.0F));
                          g2d.drawLine(startX, startY, mouseX, mouseY);
         public void mouseClicked(MouseEvent e)
         public void mouseDragged(MouseEvent e)
              mouseX = (int)(e.getX()*zoomFactor);
              mouseY = (int)(e.getY()*zoomFactor);
              repaint();
         public void mousePressed(MouseEvent e)
              if(e.getButton() == 1)
                   points.add(inverse.transform(e.getPoint(), null));
                   if(points.size() > 0)
                        startingPoint = points.get(points.size()-1);
                        mouseX = mouseY = 0;
                   repaint();
              else if(e.getButton() == 2)
                   zoomFactor = zoomFactor + .05;
                   repaintBImg();
              else if(e.getButton() == 3)
                   zoomFactor = zoomFactor - .05;
                   repaintBImg();
         public void mouseReleased(MouseEvent e)
              if(e.getButton() == 1)
                   points.add(inverse.transform(e.getPoint(), null));
              repaint();
         public void mouseEntered(MouseEvent mouseevent)
         public void mouseExited(MouseEvent mouseevent)
         public void mouseMoved(MouseEvent mouseevent)
    }Message was edited by:
    hardc0d3r

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import java.io.*;
    import java.net.URL;
    import java.util.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ZoomTesting extends JApplet {
        public void init() {
            //String dir = "file:/" + System.getProperty("user.dir");
            //System.out.printf("dir = %s%n", dir);
            String url = "http://localhost/image.gif";
                         //dir + "/images/cougar.jpg";
            MapPanel map = new MapPanel(url);
            getContentPane().add(map, "Center");
        public static void main(String[] args) {
            JApplet applet = new ZoomTesting();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(applet);
            f.setSize(400,400);
            f.setLocation(200,200);
            applet.init();
            f.setVisible(true);
    class MapPanel extends JPanel implements MouseListener, MouseMotionListener {
        private BufferedImage image;
        private ArrayList<Point2D> points;
        private Point2D startingPoint;
        private int mouseX;
        private int mouseY;
        private AffineTransform xform;
        private AffineTransform inverse;
        RenderingHints hints;
        private double zoomFactor = 1;
        public MapPanel(String url) {
            super();
            try {
                image = ImageIO.read(new URL(url));
            } catch(Exception e) {
                System.out.println(e.getClass().getName() +
                                   " = " + e.getMessage());
            Map<RenderingHints.Key, Object> map =
                        new HashMap<RenderingHints.Key, Object>();
            map.put(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            map.put(RenderingHints.KEY_RENDERING,
                    RenderingHints.VALUE_RENDER_QUALITY);
            hints = new RenderingHints(map);
            setTransforms();
            points = new ArrayList<Point2D>();
            startingPoint = new Point();
            addMouseListener(this);
            addMouseMotionListener(this);
        private void setTransforms() {
            Insets insets = getInsets();
            xform = AffineTransform.getTranslateInstance(insets.left, insets.top);
            xform.scale(zoomFactor,zoomFactor);
            try {
                inverse = xform.createInverse();
            } catch (NoninvertibleTransformException e) {
                System.out.println(e);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D)g;
            g2d.setRenderingHints(hints);
            g2d.drawRenderedImage(image, xform);
            if(!points.isEmpty()) {
                for(int i=0; i<points.size(); i++) {
                    if(i > 0)
                        drawLineSegment(g2d,points.get(i-1),points.get(i));
                    drawPoint(g2d, points.get(i));
            if(startingPoint != null) {
                drawTempLine(startingPoint, g2d);
            } else {
                mouseX = 0;
                mouseY = 0;
        private void drawPoint(Graphics2D g2d, Point2D p) {
            int x = (int)(p.getX() * zoomFactor);
            int y = (int)(p.getY() * zoomFactor);
            int w = (int)(13 * zoomFactor);
            int h = (int)(13 * zoomFactor);
            g2d.setColor(Color.ORANGE);
            g2d.setStroke(new BasicStroke(1.0F));
            g2d.fillOval(x - w / 2, y - h / 2, w, h);
            g2d.setColor(Color.BLACK);
            g2d.drawOval(x - w / 2, y - h / 2, w - 1, h - 1);
        private void drawLineSegment(Graphics2D g2d, Point2D p1, Point2D p2) {
            double x1 = p1.getX() * zoomFactor;
            double y1 = p1.getY() * zoomFactor;
            double x2 = p2.getX() * zoomFactor;
            double y2 = p2.getY() * zoomFactor;
            g2d.setColor(Color.RED);
            g2d.setStroke(new BasicStroke(3.0F));
            g2d.draw(new java.awt.geom.Line2D.Double(x1, y1, x2, y2));
        private void drawTempLine(Point2D p, Graphics2D g2d) {
            int startX = (int)(p.getX() * zoomFactor);
            int startY = (int)(p.getY() * zoomFactor);
            if(mouseX != 0 && mouseY != 0) {
                g2d.setColor(Color.RED);
                g2d.setStroke(new BasicStroke(2.0F));
                g2d.drawLine(startX, startY, mouseX, mouseY);
        public void mouseClicked(MouseEvent e) {}
        public void mouseDragged(MouseEvent e) {
            mouseX = (int)(e.getX()*zoomFactor);
            mouseY = (int)(e.getY()*zoomFactor);
            repaint();
        public void mousePressed(MouseEvent e) {
            if(e.getButton() == 1) {
                points.add(inverse.transform(e.getPoint(), null));
                if(points.size() > 0) {
                    startingPoint = points.get(points.size()-1);
                    mouseX = mouseY = 0;
            } else if(e.getButton() == 2) {
                zoomFactor = zoomFactor + .05;
                setTransforms();
            } else if(e.getButton() == 3) {
                zoomFactor = zoomFactor - .05;
                setTransforms();
            repaint();
        public void mouseReleased(MouseEvent e) {
            if(e.getButton() == 1) {
                points.add(inverse.transform(e.getPoint(), null));
            repaint();
        public void mouseEntered(MouseEvent mouseevent) {}
        public void mouseExited(MouseEvent mouseevent) {}
        public void mouseMoved(MouseEvent mouseevent) {}
    }

  • Photoshop cc 2014 suddenly trouble with cloning and healing tool

    I just updated photoshop cc 2014. I use a wacom tablet. Suddenly, when I use the healing brush or cloning brush. The brush control panel pops up and the tool simply doesn't work. After repeated attempts, I do succeed in getting this to work. Sure slows me down though.

    Sorry for the lack of the report it was my first time reporting an error for software... Never had an issue before.
    I haven't experienced the crash via text tool since I posted the question, but the Photoshop is still constantly crashing at startup, but every time I try to enter the report I get the error: Please try again later.m5

  • Cloned HD running Snow Leopard won't boot in new MBP running Lion., cloned HD running Snow Leopard won't boot in new MBP running Lion.

    Hi, I've seen a lot of discussion on this topic but nothing specific to my situation.  I have two macs, a personal mac (macbook running Snow Leopard vers. 10.6) and a newer work macbook pro (late 2011 running Lion vers. 10.7.5).  I want to use some of the applications at work (that is on the Macbook Pro) that are on my home macbook with Snow Leopard.  I cloned the entire HD of my Macbook onto an external drive.  The clone seems to have worked as I can use it as a boot disk for the macbook (from which it was cloned).  However, if I try to boot the MacBook Pro running Lion, with this same clone on the external drive it won't work.  I get a bit of text in the background and an overlay in dark grey saying (in several languages) restart the Mac by holding down the start key etc.  I don't know if this has to do with the kernel panic problem or the Lion restore disk business.  I don't see the point in trying to do an internal partition of the MacBook Pro hard drive and then add the cloned Snow Leopard, if I can't get the thing to boot externally as it is. 
    Does anyone have any fixes for what really should be a simple proceedure but is not?

    Make sure the mac you are cloning from has the combo 10.6.8 update applied to it. The late 2011 models need at least 10.6.7 and better with 10.6.8. So if your older mac is running anything lower than 10.6.7 it will not boot on the 2011 model.

  • Getting rgb values from BufferedImage

    BufferedImage.getRGB(int x, int y) returns the colour of an image pixel as an integer. My problem is that i need the seperate red/blue/green components of this. Does anyone know how I can get these?
    Thanks.

    I've done that before but cant actually remember howe to go about it ... but here is an idea that should work
    Color TEMP = new Color(BufferedImage.getRGB(int x, int y)) ;
    Now to extract each component just use the methods getRed() getGreen() and getBlue() on TEMP.
    Does it make sence to you?
    If it does work let me know, just out of curiosity!
    Rui

  • Hard drive keeps cloning itself in finder

    This is the second time I saw this on a Mac, and never happened to me before (being working in a AASP for the last 9 years)
    The disc fails, and won't boot, but you can see all the data starting up in Target or mounting the HD as an external device in a known good computer and system.
    But, after a few minutes the disc mounts again as a new FW external drive, and kees doing it as long as its conected.
    I was able (apparenty) to extract all the info, conning it with third party software, but, the surprise is that none of the cloned files worked.
    Disk utilities repairs the volume, and restores permissions... but the disc fails again.
    I've tryed disc warrior (wich is unable to fix the drive as it keeps mounting itself every few minutes) techtools, data rescue... all with the same result, the drive seems to be repaired but as it keeps clonning or mounting, eventually fails again, and no data can be copyed  if the copy time tooks more time than the time the drive takes to cole itsef agai.
    So, any idea what this could be?
    any possible solutions or work arounds to extract the info?
    Even GSX didn't know what that was, at least a few months ago...
    I will appreciate any ideas.
    (Mac OsX 10.7 installed on bad HDD, OsX 10.7, 10.8 & 10.9 tryed to solve this matter)
    * One common error when trying to copy items is: The finder can't complete the operation because some data in ".DS_Store" can't be read or written. (Error code -36)
    Picture shows three FW external units identical to each other.. (as it turns to be the same one replicating itself)

    Assume for second your drive has failed totally, and get another backup drive to backup your source.
    Once backed up you can determine how bad the failure is with Disk Utility Repair Disk, or if not revealing Alsoft Disk Warrior. Always have at two known working copies of your data at all times.

  • Problem using HDTV as cloned monitor

    Hey Mac Community... here's a tough one.
    I have a 2.66 quad core Xeon Mac Pro tower with an upgraded ATI Radeon HD 3870 Graphics Card (it has 2 DVI outputs). I bought an HDTV specifically so I could clone one of my 2 monitors and watch videos that are on my computer from my bed. It doesn't have a native DVI in port (beggars can't be choosers), but I have a DVI to HDMI cable and I can tell the tv which audio channel to use, so in theory that part should work.
    Here's where the problem starts: I bought a DVI splitter from eBay (nothing fancy... dvi female out to 2 dvi female) and plugged it in to the primary monitor slot on my graphics card. When I plugged in the monitor then the HDTV, or plugged them in both at the same time and detected displays, only my 2ndary monitor was recognized. Only when i reversed the order, and plugged in the HDTV THEN the primary display did it work... sort of. The display thinks it is a clone of the tv and not vice versa, so my display's resolution is all wonky. I tried playing around with it, and I just can't get it right. I don't mind if the tv was a bit off, but since I need my computer to function as a computer, I need both displays to work properly.
    My friends (who are much more tech/mac savvy than I am) told me that this happened because monitors have a special ID encoded in them, telling the computer "hey, I'm a monitor," which is why most monitors don't need drivers. My tv, they explained, doesn't have this special ID, and so when it gets plugged in to be a slave of my primary monitor, it doesn't understand what it's supposed to do. When I plug it in first however, the computer is smart enough to say "ahh... you're a tv being used as a monitor."
    My question is this: is there any way I can make my TV a slave of the display and not the other way around? Further, once I change channels/inputs on the TV, it forgets that it's a monitor on HDMI 2, and when I go back, I have to fiddle with the cables again. Is there any way to have it permanently remember that it is a cloned display on HDMI 2? My tech-savvy roommate suggested buying a cheap graphics card and dedicating its own line rather than using the splitter. This would help, but it would cost a lot of money. Is there a way to get the desired effect with what I have? I don't need it to be a third display. Cloning/mirroring/slaving is just fine.... As long as it works @_@
    Thanks!
    ~Bryan

    DVI splitters work properly only with displays of identical resolution. It is unlikely your TV and computer monitor have matching resolutions. As you have seen, the splitter has one port that sends display information to the computer. The computer uses that information to determine the resolution(s) supported by that display, and video of that resolution will be sent go both displays. The display on the second port my not work properly with that signal.
    If you don't need all three displays on at once, you could use a DVI switch. If you need all three at once, you will need a second graphics card. If you click the "?" near the bottom-rigth of the "Arrangement" tab of "Displays" system preference, it will tell you how to mirror just some of the displays.

  • URGEND: After cloned backup neither usb nor bluetooth mouse recognized

    ahhhhhh, help needed....
    after bootcamp kills my complete system disc during installing xp i've cloned my backup copy onto my ereased system disc. every things fine (besides some errors) but now my macpro don't recognize neither the usb nor the bluetooth mouse.
    the keyboard works fine and i've tried every usb slot and a powered hub without no luck.
    the bt mouse getting recognized by the bt assistant, connect and ready, BUT it's not working. the "tray" symbol shows it's connected.....
    i've tried the following: pr reset, board reset, permission repaired, new directory by diskwarrior = nothing
    behind the error window of chronosync is another one from parallels which says that the "connectusb.kext" extension wasn't correctly installed.
    i've tried to copy the extensions from my macbook parallels but the error still occurs.
    i'm not sure but i think there can't be any connection between the parallels extension error and my overall mouse dis function, or can it be???
    plz help, cause i've got no possibility to archive and install the system cause i'm on an non authorized tiger 10.4.11 system on an early macpro
    thx sooooooo much/___sbsstatic___/migration-images/migration-img-not-avail.png
    cheers and sorry for double posting

    Just watching various posts on forums to see what I should do next. I updated to 10.6 from DVD, then went to 10.6.5, and my keyboard and mouse would stop working, and then start working again when I unplugged and replugged the keyboard (I have the mouse plugged into the keyboard). I don't want to spend all day unplugging and plugging my keyboard. I just went back to core 10.6 from the DVD, all my main software seems to work, so unless I have problems, I'm just sticking with core 10.6 until things get resolved.
    I might try updating to 10.6.2, or 10.6.4, but not until I'm forced into it (when something is really not working on unstable). I do mostly music and video work. The only reason I updated was because something new I want to run (Wavelab 7) only works with 10.6. I usually never update my OS unless I'm forced into it, I'm way not an OS early adopter, I have work to do! I was truly expecting 10.6.5 to be OK, they've had plenty of time to get the kinks worked out. I wasn't expecting Apple to introduce new ones. Sounds like I'm not bothering with 10.6.6 now. 10.6.7 anyone? Do I hear .8?
    Way to go Apple.

  • EBS 12.1.3 RAC to RAC Cloning

    BismillahirRehmanirRahim
    Dear All,
    I need to Clone our Production EBS Environment from RAC to RAC with Shared APPL_TOP and Multi Tier Appl Tiers.
    We have EBS 12.1.3 Environment with 2 Appl Tier Nodes with Shared Appl_Top & EBS DB is on 11gR2 RAC 11..2.0.4.
    I am following Doc IDs 406982.1 & 559518.1.
    But its not clear which directories need to be copy and restore for Shared Appl top on each Node.
    Also what Steps will need to be executed on Each Nodes and
    What Steps need to be executed only on one Node.
    Appreciate your feedback.
    P.S.
    Kindly share if anyone have Step by Step Doc for RAC to RAC EBS Cloning.

    Jay
    Edit /u01/startapps.sh  and stopapps.sh
    Add VIS to the environment lines " . /u01/E-BIZ/apps/apps_st/appl/APPS*.env"
    Change to => ". /u01/E-BIZ/apps/apps_st/appl/APPSVIS*.env"
    I had the same problem found the solution here...refer to the Fix Environment File section of the following
    http://ltd.kentw.co.uk/technical/r12-installation/create-apps-vm/
    A little late, I hope it helps someone in the future..
    Ben

Maybe you are looking for