Cut and move image using mouse ?

Hello,
I am developing one paint program. I am making it similar to microsoft paint. In This paint, I want to use lasso, magic wand tool and select tool. But I am not too familiar with java. And want to do with your help. Please help on this topic. If lasso and magic wand tools behave same. Then please tell me about only select tool that will use for the purpose of select a particular area from canvas (canvas is drawing sheets that holds the drawing). Please help me.
If there is any snippet of this above declaration please send. Can we use system clipboard to cut, move and paste for this drawing by the help of mouse. Please help me. I will really thankful to you.
Thanks in advance.
Manveer

For the Magic Wand (at least for what I suppose it is) I would consider the image as a graph, where two pixels are connected if the difference between their color values is below some tolerance value. Then you can easily perform the iterative breadth-first algorithm to collect the pixels of the selection. I recently did something similar (although not on an image itself, but on some higher abstraction of it).
For the Lasso i would collect all the pixels, the user selects, then calculate the bounding box over the selected pixel area and finally determine for each pixel inside the bounding box, that is no member of the lasso/selection pixels, whether it lies inside or outside the selection area. This could be accomplished by performing another bfs from one pixel, that includes all pixels besides the ones lying outside the bounding box or are pixels of the selection lasso.

Similar Messages

  • Drag and drop images using tilelist in flex

    i just want the working code for drag and drop images using
    tilelist in flex

    Try JDK 1.4 and call setDragEnabled(true)
    I will also post updated version of MediaChest soon using custom TransferHandler for DnD different types of Objects.

  • Cut and Paste images from flash to power point

    Can you cut and paste images from flash player to power point?
    Thanks!

    Are the settings for the two Sequences completely indentical?
    -DH

  • Why does my compuer lose its cursor and/or loses sound and have to use mouse to get back?

    I will be typing along and suddenly nothing shows on screen and have to use mouse to get back.
    Also will be doing solitare or other game and lose sound and have to mouse to get things moving again.Is this a virus?
    I updated my windows and nothing showed as a problem there.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Cannot move an image using mouse (was: Hi;)

    I m trying to move a image via mouse.
    But i cant move that image.
    I wrote this;
    this.onMove(e.pageX, e.pageY);
    and took mouse position but i cant find how can i move image with X and Y coordinats.
    Can you help me pls

    Hi im using this code
    >>MySymbol.click<<
    sym.$('MySymbol').offset({
        left: 50,
        top: 20
    but it doesnt change anything. Can you help me plss

  • Move components using mouse - drag and drop action?

    Hi,
    As attached, I want to move one component at the bottom to top using mouse in drag and drop action.
    But I don't know why it returns to the origianl position. it never move.
    Is there anyway I can change configuration to accomplish this?

    Hi,
    I tried this as you said, but it wont' work.

  • Rotating and dragging of image using mouse

    hi everyone,
    I've got problems with dragging and rotating of images using the mouse
    Can anyone show me how to that?
    Thanks a million

    Implement a MouseMotionListener on the Panel that you want to drag the image on.
    public void mouseDragged  (   MouseEvent e   )
           if ( e.getModifiers() == MouseEvent.BUTTON1_MASK )
              if ( dragged )
                  processMove( new Point2D.Double( e.getPoint().x, e.getPoint().y ) );
             else
               wasDragged = true;
                  dragged    = true;
                  dragPoint  = new Point2D.Double( e.getPoint().x, e.getPoint().y );
                  xDiff      = 0;
                  yDiff      = 0;
    private void processMove
         Point2D.Double    point
              Point2D.Double paintPoint = new Point2D.Double( point.x - dragPoint.x, point.y - dragPoint.y );
           BufferedImage  imageBak   = getCurrentBackgroundImage();
           BufferedImage  background = new BufferedImage( imageBak.getWidth(), imageBak.getHeight(), imageBak.getType() );
           Graphics2D     gr         = background.createGraphics();
           gr.setColor( adaptee.getUserProfile().getBackgroundColor() );
           gr.fillRect( 0, 0, imageBak.getWidth(), imageBak.getHeight() );
           gr.drawImage( imageBak, null, (int) paintPoint.x, (int) paintPoint.y );
              gr.finalize();
           xDiff += paintPoint.x;
           yDiff += paintPoint.y;
           dragPoint = point;
           getGraphicsForPanelToDrawOn()..drawImage( background, null, 0, 0 );       
           setCurrentBackgroundImage(  background );
              }

  • How to  upload and display image using bsp application

    hi
    I  just wants to know that
    1- how to  upload image from BSP page with attachment into sap server .?
    2-how to display image in to BSP page(webpage).
    thanks

    Hello Gupta Prashant,
    Just to upload and display an image, import image in MIME repository. Not only still images but also flash files can also be uploaded in the MIME repository. Once you import the image in it, use normal html code for image call;
    <img src = "file.jpg/gif" width=  height=>
    Besides it, if your requirement is to store the image in the database and fetch it based on specified field-name, then you have to go for BLOBs i.e Binary Large Object, using this you can also store images, videos, pdfs, applications in the database.
    MBLOB - Medium BLOBs store videos and pdfs,
    LBLOB  - Large BLOBs store movie files and applications.
    You have got 2 ways to use it; some databases store BLOB objects into themselves and some store the path of the BLOB object maintained on the FTP server.
    You can also implement it in ABAP;
    read the following link and practice the tutorial;
    [ Use of MIME Types|http://help.sap.com/saphelp_45b/helpdata/en/f1/b4a6c4df3911d18e080000e8a48612/content.htm]
    also check this
    [TYPES - LOB HANDLE|http://help.sap.com/abapdocu/en/ABAPTYPES_LOB_HANDLE.htm]
    And looking at your question, in order to upload an image, you can make use of FILEUPLOAD tag provided by HTMLB.
    Step 1: FILEUPLOAD provides a browse button to choose desired image file.
    Step 2: Store that image in database using BLOBs.
    Step 3: Retrieve the image using normal select query and display it on the screen.
    Hope it helps you,
    Zahack

  • Need to select and move images across multiple pages...

    Hi,
    I am using Indesign CS2 on a Windows machine and have a 25 page document with 4-up photos (4"X6") on individual pages. I used the ImageCatalog javascript to load these images so I don't seem to have any control from the Master page. I would like to group and move these images to a different location on their own pages.
    Do you know how to select these images across multiple pages? Or can a simple script be written to process this task?
    Thanks in advance for your help.
    -Greg

    Hi Greg,
    A script can certainly do what you want to do--but you have to be a bit more specific. Do you want to move them to different pages in some predefined way, or do you just want to adjust them a bit on the pages they're already on?
    Thanks,
    Ole

  • Scan to pdf page wanted to cut and move bottom text up

    I have a scanned to pdf (raster image) that I attempted to
    OCR in Acrobat 9 Pro.  Then I opened it PS CS4 and wanted to cut
    the bottom text and move it up but I did not know how.  How would you do this?
    The page had narrow top and bottom margins with much white space in the middle.  I thought I could move the bottom text up but I either did not have the rght tool or something was not working because it acted like one image on te page.
    Thanks!

    I may still give the Epson Artisan 810 a hard look...it appears to be a nice AIO. One other thing I hate about my HP is if I haven't printed in a day or two the first time I send something to it, it just sits there making noises for five minutes before doing anything. Same thing when it quits...it makes noises for a couple of minutes and then quiets down. Does the 810 do anything similar? Lastly, I'm pretty happy with the color prints that this one makes...how are they with the 810.
    Thanks for your time in answering these questions.

  • Cut and move in OS X: is it really possible?

    Hello,
    Usually, when I want to move a file/folder to another location, all I get is just copy & paste! Well, I can always delete the files/folders from the original place after copying them, but this is an extra redundant work. Sometimes, it can be quite annoying if it is about a big video file: imagine a 10gb-20gb file may take 10minute to be copied and another couple of minutes to be deleted!
    I have blindly tried various keyboard possibilities such as holding apple key or option key or ctrl key while moving the file with no help. However, sometimes when I drag and drop, it automatically moves the file instead of copying it.
    Honestly, I am quite upset about this. I find it absurd that they claim 'OS X is the most advanced operating system' if it doesn't even have a move option and all you can do is copying! I hope this is not true. If it does, then I have to say OS X is extremely nonuser-friendly because I am quite experienced with computer environments and I can't still find this!
    Thanks, Ramin

    Thanks guys for your answer. I really appreciate them. Regarding the first response I got: yes, that was rude. If I didn't promptly write a response, it was because I didn't care much about it. I understand some people see it as their mission to promote or support a tool they are using. Some may see it crucial to defend their favorites against 'dangers' if it could have interpreted that way. On the contrary, I see it my mission to criticize things. This is somehow what I believe to be a more useful thing to do. Apple OS X is a great operating system but it is far from being perfect and it has certain obvious imperfections even comparing to Windows while it also has certain advantages over the pther OS's. By doing fair comparisons, we encourage companies in putting their efforts into resolving imperfections hence, seeing improvements in both OS X and Windows and through this, we consumers will be the winners!
    Now let's look at it: Being the most advanced OS is subjective, I admit. I am talking of my own personal view. When Apple talks of OS X in their website, most of the talks are about eye-candies and candy-tools. Don't get me wrong, I do care about appearance and I find some of these candy-tools quite useful. However, as an example, a more advanced OS must have a more sophisticated multitasking engine or must have implemented a kernel that better utilizes the potential of a multi-processor system. When I check their website, Apple boasts OS X a lot on this, but it fails to provide us with any argument on why OS X is more advanced than say Linux or even Windows in this regard. That is why I say they have claimed something without proving it! I am not an expert in computer science, but I can easily see if an argument has been presented to us, the audience, or not.
    As per moving files and folders from one drive to another drive, in Windows and Linux, you can press ctrl + x and ctrl + c to cut and paste a file or folder. The problem is that there is no similar operation in OS X, as you confirm it. Since, I move files and folders across the drives quite often, I find this annoying. I have to spend twice as much time in OS X to do so as I do in Windows.
    By the way, what is the Delete button do in OS X? It seems it does nothing! In Windows and Linux it send the item to the garbage bin. In Os X doesn't do that. So why is that button there?
    There are other places where improvements are possible, but this message has already got too long.
    Once again, thanks for your answers.
    Ramin

  • Can anyone help me to add method to rotate the image using mouse?

    Hi everyone, i am currently creating a game which require the user to be able to drag and rotate the image
    on the screen..but sadly...i'm only able to do the dragging part..
    Can anyone be able to help me add the method to rotate the image using the mouse?
    Thanks :-)
    the code
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    class Game extends JFrame {
         DisplayCanvas canvas;
         public Game() {
              super("My Game");
              Container container = getContentPane();
              canvas = new DisplayCanvas();
              TitledBorder border = new TitledBorder("Game Window");
              border.setTitlePosition(TitledBorder.BOTTOM);
              canvas.setBorder(border);
              container.add(canvas);
              addWindowListener(new WindowEventHandler());
              setSize(450,400);
              show();
              class WindowEventHandler extends WindowAdapter {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              public static void main(String arg[]) {
                   new Example();
         class DisplayCanvas extends JPanel {
              int x, y;
              BufferedImage bi;
              DisplayCanvas() {
                   setBackground(Color.white);
                   setSize(450,400);
                   addMouseMotionListener(new MouseMotionHandler());
                   Image image = getToolkit().getImage("duke.gif");
                   MediaTracker mt = new MediaTracker(this);
                   mt.addImage(image, 1);
                   try {
                        mt.waitForAll();
                   catch (Exception e) {
                        System.out.println("Exception while loading image.");
                   if (image.getWidth(this) == -1) {
                        System.out.println("***Make sure you have the image "
                        + "(duke.gif) file in the same directory.*****");
                        System.exit(0);
                   bi = new BufferedImage(image.getWidth(this),
                   image.getHeight(this),
                   BufferedImage.TYPE_INT_ARGB);
                   Graphics2D big =bi.createGraphics();
                   big.drawImage(image, 0, 0, this);
              public void paintComponent(Graphics g) {
                   super.paintComponent(g);
                   Graphics2D g2D = (Graphics2D) g;
                   g2D.drawImage(bi, x, y, this);
              class MouseMotionHandler extends MouseMotionAdapter {
                   public void mouseDragged(MouseEvent e) {
                        x = e.getX(); y = e.getY();
                        repaint();

    research a bit on AffineTransforms. you can set the rotated instance of the Graphics2D class and it will do the rotations for you :-D

  • How to cut-and-paste image into forms

    using forms9i, is it possible to cut and paste into a forms image field (database blob field) in the browser?

    Jeff,
    as far as I know this isn't possible. We only support drag and drop operations for text.
    Frank

  • Cut and Paste with Mighty Mouse?

    I just bought a new mighty mouse and I cannot figure out how to cut and past using the mouse. Do I right click, double click on the highlighted word or left click? Also, how do I drag highlighted phrases?
    Thanks!
    mighty mouse Mac OS X (10.4)

    if you go to
    http://www.mac-switch.com
    scroll down and you will find an article on enabling the right click on the mighty mouse.
    Good luck.

  • Rotate and move image

    Hi,I'm trying to make a game kinda like gta or asteroids whereyou have top view. I am using an image to be the player and, I want to rotate that image using left and righ keys and with the up key move the player to the direction whereit is rotated.
    The problem is that i cannot display the rotation and movement at the same time.
    I'm using a code like this.
    AffineTransform transform = new AffineTransform
    public void checkGameInput(){
         float velocityX=0;
         float velocityY=0;
         if(rotateLeft.isPressed()){
               angle1+=angle2;    
              transform.rotate(-angle2, player.getWidth()/2, player.getHeight()/2);
    // similar for rightkey
       if (moveFront.isPressed()){
               velocityX=_Player.SPEED*Math.cos(angle1),
               //same for velocityY
    }the problem is when i try to print on the sceen.
    I can update position
    public void draw(Graphics 2D g){
    g.drawImage(player. getImage(), Math.round(player.getX()), Math.round(player.getY()),null)  // player.getX(9 returns position of playeror update rtation
    public void draw(Graphics 2D g){
    g.drawImage(player.getImage(),transform, null);is there a way to join this to drawImageso I can rotate ane move the rotatyed image?
    thank you very much for any kind of help.
    Edited by: Muninn on Nov 29, 2008 3:13 AM

    Use the transform to do both rotation and translation (multiple transform operations can be concatenated)
    transform.rotate(-angle2, player.getWidth()/2, player.getHeight()/2);
    transform.translate(player.getX(), player.getY());

Maybe you are looking for

  • Mail Receiver Adapter Attachment Content Encoding

    Hello to all, we use a mail receiver adapter to sent XI messages as email. Everything works fine but the content encoding of the  attachment is set to UTF-8. I need ISO-8859-1 instead of UTF-8. How could I achieve this ? Thanks Christian

  • Select and update rownum sender jdbc

    Dear all i am using PI 7.31 sender jdbc adapter. table(TB_AA)  has 10000 row with pi_stat = 'R'   and then  sender jdbc adapter tried  10 row  in using rownum  every  120 second and update same rownum but  result of select query and udpate query  wer

  • My problem in RESULT CACHE FUNCTION

    Hi Please pay attention to my scenario I use Oracle 11.2.0.3 create table chr1 (n1 number(8,3),n2 number(8,3),n3 number(8,3));   begin    for i in 1..1000 loop       insert into chr1 values (dbms_random.value(1,1000),dbms_random.value(1,1000),dbms_ra

  • How to set up firmware password?

    Here's the problem. I have a recently purchased MBP that can only boot from Snow Leopard 10.6.7 and up. I have a Snow Leopard install disk that is 10.6.0. The mac will not boot from the disk, which means that I cannot use the disk to set up a firmwar

  • Buying Hebrew/Arabic

    Do I have to buy a special Middle East version of CS6 to use InDesign with Hebrew or Arabic (so these languages are entered right-to-left)? If so, WHERE can I buy CS5 or CS6 using a student ID? Trying to find this out through Adobe support has led no