Jump to content

Custom Brushes Plugin 5.1.5


Recommended Posts

You said "froze" not "crashed..."

This changes everything ;)

Looks either like you don't have enough RAM to load all of the brushes*

or the plugin was allowing resources to be garbage collected, and then trying to use them

*sabrown, are you keeping all of the full-size bitmaps in memory the whole time? would probably be better only to keep the thumbs in memory, and load the actual brush again only when it's the one in use.

**are you using Surface.CreateAliasedBitmap() anywhere?

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

You said "froze" not "crashed..."

This changes everything ;)

Looks either like you don't have enough RAM to load all of the brushes*

or the plugin was allowing resources to be garbage collected, and then trying to use them

*sabrown, are you keeping all of the full-size bitmaps in memory the whole time? would probably be better only to keep the thumbs in memory, and load the actual brush again only when it's the one in use.

**are you using Surface.CreateAliasedBitmap() anywhere?

Actually, the first time it froze, and then I got impatient and went into Task Manager and ended PDN from there. When I tried it again, I walked away for a bit, and when I came back it said there was a crash.

Link to comment
Share on other sites

**are you using Surface.CreateAliasedBitmap() anywhere?

Yes - that is how I am getting the bitmap from the surface.

CreateAliasedBitmap() creates an aliased Bitmap. Shocking, right? But what Aliased means is that is uses the same locations in memory. Changes to the Surface will affect the Bitmap, and vice versa. The problem is, if the Surface goes out of scope, then of course its memory locations are subject to garbage collection. And if the Surface gets garbage collected, then the Bitmap's data has been "stolen," and if you try to use the Bitmap, then GDI+ is going to shoot off AccessViolationExceptions left and right.

To avoid that, instead of, for example, Bitmap bm = mySurface.CreateAliasedBitmap();, you should use Bitmap bm = new Bitmap(mySurface.CreateAlisedBitmap()); and the new Bitmap will be a copy of the Surface, instead of using the same RAM, so that even if the Surface gets garbage collected, the Bitmap will still be intact and usable.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

Umm, I just found something else. I guess that depending on the size, the plugin resizes the brush or something because I had this brush:

Technetronic_908.png

But when I tried to use it in Custom Brushes, this is what it looked like:

Weird.png

So, umm, is this fixable, or do I have to make the brush smaller?

**Edit**

I tried making the brush smaller, and that didn't work. Then I tried making the width in the same as the height and that worked, except the brush was much smaller than what it should have been, even on 250...

Link to comment
Share on other sites

The solution is to open the brush in pdn, click "expand canvas", making sure "Maintain aspect ratio" is unchecked and making the height what the width is. Then make sure the background is transparent and save it as a brush.

I did that, the problem is that the brushes are too small... I have a wave kinda techno vector that is 2000x2000 (The size it came in) and it comes out way too small when I use it in Custom Brushes...

Link to comment
Share on other sites

Umm, I just found something else. I guess that depending on the size, the plugin resizes the brush or something because I had this brush:

Technetronic_908.png

But when I tried to use it in Custom Brushes, this is what it looked like:

Weird.png

So, umm, is this fixable, or do I have to make the brush smaller?

**Edit**

I tried making the brush smaller, and that didn't work. Then I tried making the width in the same as the height and that worked, except the brush was much smaller than what it should have been, even on 250...

First of all, make sure the brush is a square. Right now, they can't go above 250*250, but hopefully, they'll go up in size soon.

Link to comment
Share on other sites

CreateAliasedBitmap() creates an aliased Bitmap. Shocking, right? But what Aliased means is that is uses the same locations in memory. Changes to the Surface will affect the Bitmap, and vice versa. The problem is, if the Surface goes out of scope, then of course its memory locations are subject to garbage collection. And if the Surface gets garbage collected, then the Bitmap's data has been "stolen," and if you try to use the Bitmap, then GDI+ is going to shoot off AccessViolationExceptions left and right.

To avoid that, instead of, for example, Bitmap bm = mySurface.CreateAliasedBitmap();, you should use Bitmap bm = new Bitmap(mySurface.CreateAlisedBitmap()); and the new Bitmap will be a copy of the Surface, instead of using the same RAM, so that even if the Surface gets garbage collected, the Bitmap will still be intact and usable.

I am currently trying to implement it and have a problem - it turns out the problem is where a graphics object is initialised using that function (!) from where you edited the source to change the image to a surface. So i'm not sure what I can do to replace it. Please help...

KaHuc.png
Link to comment
Share on other sites

This plugin uses SQUARE pngs, then places on the selected area, I believe. You just need to make your long brushes' canvas like 500x500 or 1000x1000; then wait for a bigger brush size to come out. If you are using ABRveiwer, make the exported thumbnail's sizes 500 or 1000. :P

straightupbadass.png

Link to comment
Share on other sites

I can't make the crash reproduce, and I can't see in the code where it could be going wrong. Maybe it was just a fluke? GDI+ gets quite finicky sometimes...

I couldn't replicate it either - but I saw your point and I defiantly don't think producing a graphics object from CreateAlisedBitmap() is a good idea. Try searching for all instances of the function being used.

KaHuc.png
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...