Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4741 [classlib][awt] Graphics XORMode drawing doesn't implemented
  3. HARMONY-4825

[classlib][awt] Can not use XORMode to erase what was drawn previously

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • None
    • Classlib
    • None
    • Win32
    • Novice

    Description

      A common trick in XORMode is to draw something, in XORMode, a second time to erase what was drawn the first time. But this does not work in Harmony to me. See below reproducer:

      import java.awt.*;
      import javax.swing.*;

      public class DrawStringTest extends JFrame {
      int xPosition = 100;
      int yPosition = 100;
      public static void main(String[] args)

      { DrawStringTest aTest = new DrawStringTest(); aTest.setSize(800, 600); aTest.show(); }

      public DrawStringTest(){}
      public void paint(Graphics g){
      super.paint(g);
      System.out.println("drawString at " + xPosition + ", " + yPosition);
      g.drawString("XOR mode drawString test", xPosition, yPosition);
      g.setXORMode(getBackground());
      for (int i = 0; i < 5; i ++)

      { g.drawString("XOR mode drawString test", xPosition, yPosition); //used to erase what was drawn previously xPosition += 100; yPosition += 100; if (xPosition > 600) xPosition = 100; if (yPosition > 400) yPosition = 100; g.drawString("XOR mode drawString test", xPosition, yPosition); }

      g.setPaintMode();
      }
      }

      Attachments

        1. RI.JPG
          14 kB
          Chunrong Lai
        2. Harmony.JPG
          60 kB
          Chunrong Lai

        Activity

          People

            cap Alexey Petrenko
            chunrong lai Chunrong Lai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: