After looking around online I found a lot of issues with the renderTarget stuff, mostly about 1.0-2.0, which has all changed again in 4.0. I moved my render target code out of the draw event and tried to create a quick draw in the load event of the button, but now I'm getting no image whatsoever.. Here's what I currently have:
Public Sub Load(Content As ContentManager) Implements IButton.Load texture = Content.Load(Of Texture2D)(_spriteAssetLocation) Dim tempGraphicsDevice As GraphicsDevice = texture.GraphicsDevice Dim tempSpriteBatch As New SpriteBatch(tempGraphicsDevice) Dim renderTarget As New RenderTarget2D(tempGraphicsDevice, Bounds.Width, Bounds.Height) tempGraphicsDevice.SetRenderTarget(renderTarget) tempSpriteBatch.Begin() tempSpriteBatch.Draw(texture, Bounds, Color.White) tempSpriteBatch.End() tempGraphicsDevice.SetRenderTarget(Nothing) scaledTexture = renderTarget End Sub
I figure if it's in the load event I only have to do it the once, then I'll have the scaled texture to compare against.
Edit: Sorry, the above code is giving me a purple square. I was getting nothing at all when I set up 'Preserve Usage,' but that's something I want to avoid doing now anyway.
Edit2: Got it. I was drawing the texture on the render target in a location that it was not viewable on. I set a newbounds rectangle with a location of (0,0) but the width/height of the bounds rectangle and used that in my call to draw the texture on my renderTarget. All working swimmingly now, and my check of texture transparency is working perfectly.