Menu

#13 Request for shadows for custom shapes (box language), overlapping lines in defshape and more

Indefinite
closed
backend (2)
5
2017-11-13
2017-09-12
No

Hi Zoltan,

I've been making myself familiar with the new box language, and liking it so far!

I can definitely see the potential, though the Block Templates feature eludes me still (can you maybe include an example in the documentation?)

Anyway, below is a fragment that I was experimenting with, and I'm having a few issues with it:

  1. This may be the case with shapedef in any language, but I'm having trouble with paths that overlap. I used floating point coordinates as a workaround to allow the small rectangles to appear. Preferably, I just specify whole numbers and the paths merge. I disabled the non-working line through a comment.
  2. A section 2 does not seem to allow open paths, though the documentation suggests that this may work. I disabled the non-working line through a comment.
  3. The custom shape behaves like Peter Pan; it's lost its shadow. The other boxes do get a shadow.
  4. Is there a way to define a specific style for elements of a certain shape? I'd like to define a set of shapes and link a different default fill color to each shape, rather than specifying the color for all blocks/entities or setting the color for every element definition separately.
defshape am.ac {
  ######## Foreground ########

  S 2;

  ######## Shape cutout ########
  M 0 0;
  L 0 20;
  L 20 20;
  L 20 40;
  L 0 40;
  L 0 60;
  L 20 60;
  L 20 80;
  L 0 80;
  L 0 100;
  L 200 100;
  L 200 0;
  E;

  ######## Small upper rectangle ########

  # Issue 1: Does not work correctly and hides part of the shape
  #M 20 20; L -20 20; L -20 40; L 20 40; E;

  # Issue 2: Open paths seem to be closed always
  #M -0.01 20.01; L -19.99 20.01; L -19.99 39.99; L -0.01 39.99;

  # This is a not so elegant workaround
  M 19.99 20.01; L -19.99 20.01; L -19.99 39.99; L 19.99 39.99; E;

  ######## Small lower rectangle ########

  M 19.99 60.01; L -19.99 60.01; L -19.99 79.99; L 19.99 79.99; E;

  ######## Background ########

  S 0;

  ######## Fill shape ########
  M 0 0;
  L 0 20;
  L -20 20;
  L -20 40;
  L 0 40;
  L 0 60;
  L -20 60;
  L -20 80;
  L 0 80;
  L 0 100;
  L 200 100;
  L 200 0;
  E;

  T 25 5 195 95;
};

defstyle block [text.color=white, shadow.offset=5, shadow.color=lgray, shadow.blur=2, fill.color="51,153,255", fill.color2="0,51,204", fill.gradient=up];

col {
    *am.ac A:Application\nComponent;
    space;
    row {
        box B:Service 1;
        box C:Service 2;
    }
}

A--B;
A--C;

Discussion

  • Zoltán Turányi

    • labels: --> backend
    • status: open --> accepted
     
  • Zoltán Turányi

    Hi Martijn,
    Thanks for pointing this out. Indeed, section 2 got closed and in general treated as a contigous surface in general. I will also add a fix to this.
    I have also fixed the shadow issue.
    There is a new release v6.0.1, with some yet undocumented changes to arrows. Please check out.

    As for #4 on your list, templates are exactly for this. with defshape you can only define an outline, an actual shape, which then act as a single background and line. Block templates allow you to take many shapes (blocks) and arrange them in any which way using different color and line. I will return with an example.

     
  • Zoltán Turányi

    Here is an example for templates. Apperently there is some problem with drawing order and attributes, but I will fix that.

    defstyle block [text.color=white, shadow.offset=5, shadow.color=lgray, shadow.blur=2, fill.color="51,153,255", fill.color2="0,51,204", fill.gradient=up];

    template cell two_small_boxes {
    box main [text.gap.left=10, imargin=5];
    box sm1 [width=20, height=main@25%, center=main@vleft, vtop=main@v20%, shadow.offset=0];
    box sm2 [width=20, height=main@25%, center=main@vleft, vtop=main@v60%, shadow.offset=0];
    }

    col {
    copy two_small_boxes as A {
    update main:Application\nComponent;
    update sm1 [color=red];
    }
    space;
    row {
    box B:Service 1;
    box C:Service 2;
    }
    }

    A--B;
    A--C;

     
  • Martijn Schiedon

    Wow! Thank you! I saw your replies come in this weekend, but unfortunately could not respond until now, sorry for that. I really appreciate the example and the troubleshooting that you did. I'll try the new version ASAP.

     
  • Zoltán Turányi

    • status: accepted --> closed
     
  • Zoltán Turányi

    I consider this solved now.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.