Jump to content

BoltBait

Administrator
  • Posts

    14,115
  • Joined

  • Last visited

  • Days Won

    235

BoltBait last won the day on September 29

BoltBait had the most liked content!

About BoltBait

  • Birthday 11/03/1963

Contact Methods

  • Website URL
    http://www.BoltBait.com

Profile Information

  • Gender
    Male
  • Location
    California, USA
  • Interests
    Movies, Magic the Gathering, Computers, Music, Writing Plugins

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

BoltBait's Achievements

Grand Master

Grand Master (14/14)

  • Reacting Well Rare
  • Addicted Rare
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges

3.5k

Reputation

Single Status Update

See all updates by BoltBait

  1. Hey Bolt,

     

    I have question, how would I make the following script copy the rectangle and put it on "named layer"? Basically copying the 6 rectangles and putting them onto a new layer which I need to be automatically created. All 6 rectangles should be copied onto a new layer (all on same layer).
     

    void Render(Surface dst, Surface src, Rectangle rect)
    {
        //torso
        Rectangle fromRect = Rectangle.FromLTRB(231, 74, 359, 202);
        Rectangle toRect1 = Rectangle.FromLTRB(229, 125, 357, 353);
    
        //left arm
        Rectangle fromRect2 = Rectangle.FromLTRB(308, 355, 372, 483);
        Rectangle toRect2 = Rectangle.FromLTRB(357, 125, 421, 253);
    
        //right arm
        Rectangle fromRect3 = Rectangle.FromLTRB(217, 355, 281, 483);
        Rectangle toRect3 = Rectangle.FromLTRB(165, 125, 229, 253);
    
        //back
        Rectangle fromRect4 = Rectangle.FromLTRB(427, 74, 555, 202);
        Rectangle toRect4 = Rectangle.FromLTRB(229, 305, 357, 433);
    
        //back left arm
        Rectangle fromRect5 = Rectangle.FromLTRB(85, 355, 149, 483);
        Rectangle toRect5 = Rectangle.FromLTRB(357, 305, 421, 433);
    
        //back right arm
        Rectangle fromRect6 = Rectangle.FromLTRB(440, 355, 504, 483);
        Rectangle toRect6 = Rectangle.FromLTRB(165, 305, 229, 433);
    
    
        ColorBgra CurrentPixel;
        for (int y = rect.Top; y < rect.Bottom; y++)
        {
            if (IsCancelRequested) return;
            for (int x = rect.Left; x < rect.Right; x++)
            {
                CurrentPixel = src[x,y];
    
                if (toRect1.Contains(x, y))
    
                {
                    int offSetX = x - toRect1.Left + fromRect.Left;
                    int offSetY = y - toRect1.Top + fromRect.Top;
                    CurrentPixel = src[offSetX, offSetY];
                }
                if (toRect2.Contains(x, y))
                {
                    int offSetX = fromRect2.Right - toRect2.Right + x;
                    int offSetY = y - toRect2.Top + fromRect2.Top;
                    CurrentPixel = src[offSetX, offSetY];
                }
                 if (toRect3.Contains(x, y))
                {
                    int offSetX = fromRect3.Right - toRect3.Right + x;
                    int offSetY = y - toRect3.Top + fromRect3.Top;
                    CurrentPixel = src[offSetX, offSetY];
                }
                 if (toRect4.Contains(x, y))
                {
                    int offSetX = fromRect4.Right - toRect4.Right + x;
                    int offSetY = y - toRect4.Top + fromRect4.Top;
                    CurrentPixel = src[offSetX, offSetY];
                }
                if (toRect5.Contains(x, y))
                {
                    int offSetX = fromRect5.Right - toRect5.Right + x;
                    int offSetY = y - toRect5.Top + fromRect5.Top;
                    CurrentPixel = src[offSetX, offSetY];
                }
                if (toRect6.Contains(x, y))
                {
                    int offSetX = fromRect6.Right - toRect6.Right + x;
                    int offSetY = y - toRect6.Top + fromRect6.Top;
                    CurrentPixel = src[offSetX, offSetY];
                    }
                
                dst[x,y] = CurrentPixel;
            }
        }
    }
    
    

     

    1. BoltBait

      BoltBait

      Please post your plugin programming question in this forum:

       

      https://forums.getpaint.net/forum/17-plugin-developers-central/

×
×
  • Create New...