Announcement

Collapse
No announcement yet.

ScreenCopyPaste Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ScreenCopyPaste Problem

    Hello,

    I'm having problem with the gfx_ScreenCopyPaste function. I'm using the uOLED-32828-P1 and I've rotated the screen using 'gfx_Set(SCREEN_MODE, LANDSCAPE_R);' so that the connector is at the bottom of the screen. When I do copy paste it also rotates the copy. It's really strange. I've attached an image of what happens when I plot a circle and triangle on the screen, then do the copy paste. The code is:

    gfx_Circle(250, 50, 50, WHITE);
    gfx_Triangle(200,70,300,50,100,10,PURPLE);
    gfx_ScreenCopyPaste(2,1,1,1,157,61);
    Attached files

  • #2


    Is there any way to get the source code for this function? I have an idea that it's doing two things that are easily fixable.
    1. It's doing some sort of transpose.
    2. It's reading and writing at the same time, so after it pastes a section, it's possible that it could re-read that line that was pasted and paste it again. This could be fixed by having it read and paste in a different direction.

    Comment


    • #3


      Also I've tried writing my own screenCopyPaste function but it runs far too slow. Here's the code:
      HTML Code:
      //================================================== ======================================
      func gfx_MyCopyPaste(var xs, var ys, var xd, var yd, var width, var height, var mode)
      var xs_end, ys_end, yd_end;
      var color;
      var xs_cnt, xd_cnt;
      
      xs_end := xs+width;
      ys_end := ys+height;
      yd_end := yd+height;
      
      if (mode==1)//then do copy paste from left to right and top to bottom
      repeat
      xs_cnt:=xs;
      xd_cnt:=xd;
      repeat
      color := gfx_GetPixel(xs_cnt,ys);
      gfx_PutPixel(xd_cnt,yd,color);
      xs_cnt++;
      xd_cnt++;
      until (xs_cnt == xs_end)
      ys++;
      yd++;
      until (ys == ys_end);
      else if (mode==2)//then do copy paste from left to right and bottom to top
      repeat
      xs_cnt:=xs;
      xd_cnt:=xd;
      repeat
      color := gfx_GetPixel(xs_cnt,ys_end);
      gfx_PutPixel(xd_cnt,yd_end,color);
      xs_cnt++;
      xd_cnt++;
      until (xs_cnt == xs_end)
      ys_end--;
      yd_end--;
      until (ys_end == (ys-1));
      endif
      endfunc        
      //================================================== ======================================
      Any ideas on speeding this up?

      Comment


      • #4


        There are a few things that don't work well in Landscape mode at the moment.

        Have you tried putting it into Portrait mode, doing the screen copypaste, then putting it back into Landscape mode?

        Comment


        • #5


          Yeah I have tried that. The problem is with the overlap of the function. I'm trying to shift a big block just 1 pixel. In portrait mode, the call I'd need is:

          HTML Code:
          gfx_ScreenCopyPaste(1,1,1,2,117,317);
          but since the gfx_ScreenCopyPaste function essentially does a getpixel and putpixel, when it copies the second line, it's reading what it's already pasted. Thus it's basically duplicating, or stretching out whatever's in the first line.

          Comment

          Working...
          X