Jump to content

Putting an image in paint.net using c# codelab (help)


Recommended Posts

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.

Link to comment
Share on other sites

10 hours ago, RefreshedMango said:

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

 

You could put it in any file. The filename won't matter unless you hard code it and it's path (NOT recommended). Use the FileSelect dialog as a file picker. It will allow you to navigate to the file and (I think) will also accept URL's.

 

Alternatively you could copy the image to the clipboard and access that from within CodeLab.

 

10 hours ago, RefreshedMango said:

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

 

Not sure what you're asking here. Images are generally accessed from the top left corner. Are you asking about copying source [0,0] to destination [0,0]?

 

10 hours ago, RefreshedMango said:

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

 

See the code I posted in you other thread. In it I set CurrentPixel to ColorBrga.Transparent. In the same way you set a pixel to a color, you can set it to transparent. So simply set the pixels in your rectangle to ColorBgra.Transparent.

 

10 hours ago, RefreshedMango said:


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

 

In your Render loop insert a test for rect.Top or rect.Bottom or rect.Left or rect.Right. If any are True the current [x,y] location is on one of the four edges. (Re)color it accordingly.

 

10 hours ago, RefreshedMango said:

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

 

There are links to some excellent tutorials here:

 

https://forums.getpaint.net/topic/109990-how-to-write-an-effect-plugin-tutorialsresources/

 

If you're starting out try ReMake's "First Steps" tutorials!

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...