Page 1 of 1

[C++] Access Violation When Setting ImageSource on Rectangle Opacity

Posted: 07 Aug 2018, 16:42
by DigitalKarnage
If i do not set the Image Source, every thing works out fine. However when setting the opacity mask on a rectangle I'm getting an Access Violation within my Render Delegate while trying to accessing the Device of the GetRenderer() cast. The cast works fine, but the GetDevice() throws the AccessViolation
<Button x:Name="button" Margin="4,0,2,0" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
      <Rectangle Fill="#FFB8B8B8" Stroke="Black" Height="14" Width="14">
          <Rectangle.OpacityMask>
                <ImageBrush ImageSource="T_ConnectionSettings.png"/>
         </Rectangle.OpacityMask>
     </Rectangle>
 </Button>
if (RenderDevice* CurrentDevice = ((RenderContext*)RenderView->GetRenderer())->GetDevice())
{ ....... } 

Re: [C++] Access Violation When Setting ImageSource on Rectangle Opacity

Posted: 07 Aug 2018, 21:09
by sfernandez
Hi,

I guess that RenderView variable is the object returned by Noesis::GUI::CreateView function. In that case, if you call RenderView->GetRenderer() that will return a Noesis::IRenderer* object instead of the Noesis::RenderContext* class you are specifying.

The RenderDevice is something you have provided during initialization, so you should have access to that object without using the IView or IRenderer.

Kind regards.