Jump to content

RefreshedMango

Newbies
  • Posts

    3
  • Joined

  • Last visited

Posts posted by RefreshedMango

  1. How would insert an image using code, and what file would I put it in? Or how could I do it with a URL?


    How would make the image start from lets say "Top Left Point (0,0)"?


    How would I cut out a rectangle so it is transparent (no background)?


    How would I make a rectangle with 1 thickness and start from (0,0 top left) to (0,0 bottom right)?

    I have looked everywhere and I cant find an answer. I am using c# language and codelab.

    Your help will be very much appreciated.

  2. Thank you,

     

    Thank you for the warm welcome @Ego Eram Reputo and thank you for the help however I have two more questions I'm hoping you could answer.

    How would insert an image using code, and what file would I put it in?
    How would make the image start from lets say "Top Left Point (0,0)"?
    How would I cut out a rectangle so it is transparent (no background)?
    How would I make a rectangle with 1 thickness and start from (0,0 top left) to (0,0 bottom right)?

    I have looked everywhere and I cant find an answer. I am using c# language and codelab.

    Your help will be very much appreciated.

  3. Hey People,

     

    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;
            }
        }
    }
    
    

     

×
×
  • Create New...