int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "clip2.crow",
"clip0.crow",
"clip1.crow",
"0.crow",
<?xml version="1.0"?>
-<Container Fit="true" Margin="20" Background="SkyBlue" CacheEnabled="false"
+<Container Fit="true" Margin="20" Background="SkyBlue" CacheEnabled="true"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=LightGray}"
MouseLeave="{Background=SkyBlue}">
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=Blue}"
MouseLeave="{Background=Yellow}">
- <Container Width="200" Height="200" Margin="0" Background="LimeGreen" CacheEnabled="false"
+ <Container Margin="50" Background="LimeGreen" CacheEnabled="true"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=Gray}"
MouseLeave="{Background=LimeGreen}">
- <Label Left="30" HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="false"
+ <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="true"
MouseEnter="{Background=DimGray}"
MouseLeave="{Background=BlueCrayola}"
Margin="1" Text="{drawing}" Background="BlueCrayola"/>
--- /dev/null
+<?xml version="1.0"?>
+<Group Fit="true" Margin="50" Background="LimeGreen" CacheEnabled="true"
+ HorizontalAlignment="Right" VerticalAlignment="Bottom"
+ MouseEnter="{Background=Gray}"
+ MouseLeave="{Background=LimeGreen}">
+ <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="true"
+ MouseEnter="{Background=DimGray}" Width="100"
+ MouseLeave="{Background=BlueCrayola}"
+ Margin="10" Text="{drawing}" Background="BlueCrayola"/>
+ </Group>
\ No newline at end of file
<None Include="Interfaces\clip1.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\clip2.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
Rectangle rb = Slot + Parent.ClientRectangle.Position;
ctx.Save ();
- Clipping.clearAndClip (ctx);
+ //Clipping.clearAndClip (ctx);
ctx.Translate (rb.X, rb.Y);
onDraw (ctx);
break;
}
}
- public override Rectangle ContextCoordinates(Rectangle r){
- return r + ClientRectangle.Position;
- }
protected override void onDraw (Context gr)
{
g.Paint (ref gr);
}
}
-
- public override void Paint(ref Context ctx)
+ protected override void UpdateCache (Context ctx)
{
- if ( !Visible )
- return;
+ Rectangle rb = Slot + Parent.ClientRectangle.Position;
- if (CacheEnabled) {
- if (bmp == null)
- RecreateCache ();
- }
+ using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
+ Context gr = new Context (cache);
+
+ //Clipping.clearAndClip (gr);
+ base.onDraw (gr);
- if (Clipping.count > 0) {
- using (ImageSurface cache =
- new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, Slot.Width * 4)) {
- Context gr = new Context (cache);
+ foreach (GraphicObject c in children) {
+ if (!c.Visible)
+ continue;
+ c.Paint (ref gr);
+ }
- Clipping.clearAndClip (gr);
- Rectangle rBack = Slot.Size;
- Background.SetAsSource (gr, rBack);
- CairoHelpers.CairoRectangle (gr, rBack, CornerRadius);
- gr.Fill ();
+ #if DEBUG_CLIP_RECTANGLE
+ Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
+ #endif
- foreach (GraphicObject c in children) {
- if (!c.Visible)
- continue;
- Rectangles childClip = Clipping.intersectingRects (ContextCoordinates (c.Slot));
- if (childClip.count > 0)
- c.Paint (ref ctx);
- }
- #if DEBUG_CLIP_RECTANGLE
- Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
- #endif
+ gr.Dispose ();
- gr.Dispose ();
- }
- }
- base.Paint (ref ctx);
+ ctx.SetSourceSurface (cache, rb.X, rb.Y);
+ ctx.Paint ();
+ }
}
#endregion
using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
Context gr = new Context (cache);
- child.Clipping.clearAndClip (gr);
+ //Clipping.clearAndClip (gr);
base.onDraw (gr);
if (Clipping.count > 0) {
updateTime.Stop ();
drawingTime.Start ();
#endif
- Debug.WriteLine (redrawClip.ToString ());
- lock (redrawClip) {
- if (redrawClip.count > 0) {
- #if DEBUG_CLIP_RECTANGLE
- redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
- #endif
- redrawClip.clearAndClip (ctx);
- //Link.draw (ctx);
- foreach (GraphicObject p in invGOList) {
- if (!p.Visible)
- continue;
-
- ctx.Save ();
- Rectangles clip = redrawClip.intersectingRects (p.Slot);
+ //Link.draw (ctx);
+ foreach (GraphicObject p in invGOList) {
+ if (!p.Visible)
+ continue;
- if (clip.count > 0)
- p.Paint (ref ctx);
-
- ctx.Restore ();
+ ctx.Save ();
- }
- ctx.ResetClip ();
- #if DEBUG_CLIP_RECTANGLE
- redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));
- #endif
- redrawClip.Reset ();
- }
+ p.Paint (ref ctx);
+
+ ctx.Restore ();
}
+
#if MEASURE_TIME
drawingTime.Stop ();
#endif