pyrochild Posted April 6, 2008 Share Posted April 6, 2008 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? ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted April 6, 2008 Author Share Posted April 6, 2008 **are you using Surface.CreateAliasedBitmap() anywhere? Yes - that is how I am getting the bitmap from the surface. Link to comment Share on other sites More sharing options...
KamoKronos Posted April 6, 2008 Share Posted April 6, 2008 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 More sharing options...
pyrochild Posted April 6, 2008 Share Posted April 6, 2008 **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. ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
KamoKronos Posted April 6, 2008 Share Posted April 6, 2008 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: But when I tried to use it in Custom Brushes, this is what it looked like: 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 More sharing options...
The_Lionhearted Posted April 6, 2008 Share Posted April 6, 2008 KK, I think there's a max-width/height imposed in this plugin. My Gallery Link to comment Share on other sites More sharing options...
Simon Brown Posted April 6, 2008 Author Share Posted April 6, 2008 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. Link to comment Share on other sites More sharing options...
KamoKronos Posted April 6, 2008 Share Posted April 6, 2008 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 More sharing options...
morphedkirby Posted April 6, 2008 Share Posted April 6, 2008 Um, ya, making the brush bigger when you make it doesn't help... thats why you should up the brush size to at least 500. Link to comment Share on other sites More sharing options...
Blooper Posted April 7, 2008 Share Posted April 7, 2008 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: But when I tried to use it in Custom Brushes, this is what it looked like: 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. http://synthastic.deviantart.com http://soundcloud.com/siderealenterprise Lockerz invites are available, PM me Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2008 Author Share Posted April 7, 2008 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... Link to comment Share on other sites More sharing options...
pyrochild Posted April 7, 2008 Share Posted April 7, 2008 send me source. ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2008 Author Share Posted April 7, 2008 send me source. Can I email you this time? Link to comment Share on other sites More sharing options...
pyrochild Posted April 7, 2008 Share Posted April 7, 2008 yeah. you know how to get it from that other place, right? ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2008 Author Share Posted April 7, 2008 yeah. you know how to get it from that other place, right? yes Link to comment Share on other sites More sharing options...
morphedkirby Posted April 7, 2008 Share Posted April 7, 2008 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. Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2008 Author Share Posted April 7, 2008 then wait for a bigger brush size to come out In fact, the new version already has a limit of 5,000. Link to comment Share on other sites More sharing options...
morphedkirby Posted April 7, 2008 Share Posted April 7, 2008 then wait for a bigger brush size to come out In fact, the new version already has a limit of 5,000. Nice. Can I beta test it? xD Link to comment Share on other sites More sharing options...
Simon Brown Posted April 7, 2008 Author Share Posted April 7, 2008 Nice. Can I beta test it? xD The thing will change soon as I sent pyrochild the source to help solve a bug. Hopefully soon it will be released. Link to comment Share on other sites More sharing options...
pyrochild Posted April 7, 2008 Share Posted April 7, 2008 dinner first ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
pyrochild Posted April 8, 2008 Share Posted April 8, 2008 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... ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Simon Brown Posted April 8, 2008 Author Share Posted April 8, 2008 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. Link to comment Share on other sites More sharing options...
Simon Brown Posted April 9, 2008 Author Share Posted April 9, 2008 Or should I just ignore the bug and work on the plugin? Link to comment Share on other sites More sharing options...
pyrochild Posted April 9, 2008 Share Posted April 9, 2008 Ignore it unless it crops up again. ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
oma Posted April 9, 2008 Share Posted April 9, 2008 sabrown are you considering a variable spacing option for future of this plug in? My Deviant Art Gallery Oma's Paint.Net gallery Link to comment Share on other sites More sharing options...
Recommended Posts