LitDev Extension Discussion (Pappa Lapub) RRS feed

  • General discussion

  • So Opacity for this kind of Shapes should be detectable by any GetShapeColor/GetPixelColor (?) Method, that returns a format like #AARRGGBB, from the #AA alpha value (where 0xFF = 255 = 100%). But did'nt find a similar useable function in all the Extension.xml 's so long. Would be a half workaround to crashing GetOpacity method. Maybe someone finds a suitable extension method for that.

    I never did any extension for this since I figured:

    1. It would be fixed in SB sometime.
    2. The opacity of any shape MUST have been set by the program, so you already know what its is - you may need to store this information when you create or set the opacity for the shape, but it is always knowable.

    If it is useful, then a GetBrush, GetPen or some such would be easy to implement.

    Actually its not quite that simple...

    If you create a shape with colour "Red" and set opacity to 50 you get the same effect as using "#7FFF0000".

    But internally they are stored differently:

    Color "#FFFF0000" and Opacity 0.5

    Color "#7FFF0000" and Opacity 1

    So even though the shape appears the same the brush and opacity are both different.

    We could multiply the hex A value by opacity, but this is not really what is happening and could cause more confusion if for example you have:

    Color "#FFFF0000" and Opacity 0.5

    The returned colour is calculated by multiply the A value by Opacity


    If you then set the same shape with this colour you would have

    Color "#7FFF0000" and Opacity 0.5 which is not the same as it was.

    Sunday, June 1, 2014 10:59 AM

All replies

  • Hi LitDev,
    Yes, thats clear. While SB Shapes properties effect eg.: both (individual) Opacity & (program global) Color,
    this would only effect the Alpha channel of common used Color. Only because it looks the same, it's by far not the same.

    Personally i use Shapes and Opacity less because I'm more on functional apps to perform different duties.
    But generally i would say a GetBrush, GetPen for a given Shape would sure be helpfull esp. for eg. game fans.
    What i would like to see, if you can use some unasked brainstorming ;-), would be a possibility to get the highest current number of an internally stored objecttype like "Button", "TextBox", "ImageList", Arrays
    (to simplify eg. programatically button creation, when it's useful to know, how many buttons are already defined, and which number has to be the next ?. eg. for to add a NumericUpdown via LDCall (makes 1 TB & 2 Buttons more), ...)

    from _savedImages, _arrayMap, _stackMap, _positionMap, _objectsMap, ..

    Just like (similar to) eg.:
    FCControls.GetAllShapes(), FCExtensions.GetAllSubs(), FCExtensions.GetAllVariables()
    ProgramPlus.Variables, ProgramPlus.Subs

    One more question 'a propos' Colors:
    What would you think: Can a Color with an AA value <> FF also be a 'Known Color' ?
    eg. is #8000FF00  -> Green or simply #8000FF00 ??

    Haha, just tried something like: GraphicsWindow.BrushColor = "#80"+"Green"    ' "80"+"Green"
    (stupid and does'nt work: one # to much or at the wrong pos.)

    • Edited by Pappa LapubEditor Sunday, June 1, 2014 9:44 PM typo #8000ff00 is green not red
    Sunday, June 1, 2014 8:41 PM
    1. For the color I was thinking a method that returns a 3 element array (brush color, opacity, pen color).  Its kind of an advanced obscure feature so a slightly more complex method should be OK.
    2. I don't see how a color by name with AA value can be done without specifying both.  I guess a command that could read and parse "#80Green" or "Green.50" and interpret it could be done, but would be a bit ugly.  Perhaps something to get the hex code for named colors?  I think more thought really here.
    3. We can certainly get the current next index for internal Maps.  Because things can be deleted, the next index is not the same as the current count+1. We could get both of these.

    I will look into 1 and 3 at present.

    EDIT - perhaps a new thread for this if it continues to prevent swamping this thread

    Uploaded an unofficial test version for comment

    ZipList method added
    GetNextMapIndex method added
    GetColour method added (gets Brush, Pen and Opacity)

    Sunday, June 1, 2014 9:16 PM
  • Thanks for reply, LitDev.

    So i'll let ToKnownColor("#8000FF00") return "#8000FF00".  And only upper-/lowercase "#FF00FF00", "#00FF00", "FF00FF00" and "00FF00" return Green. Sorry Nonki, further on another thread.

    Sunday, June 1, 2014 10:06 PM
  • Hello LitDev, here's german xml LitDevDe_v1-0-0-104_Test

    Wow, great and thank you so much. Did a lot of tests and all works perfect.

    When running 'LDUtilities.ZipList' within:


    For N = 1 To Array.GetItemCount(ZipFiles)

    ' before with SBUtils.ListZip, as only difference in this line

    'If Text.IsSubText(Text.ConvertToLowerCase(SBUtils.ListZip(ZipFiles[N])),Text.ConvertToLowerCase(SearchFor)) Then

    If  Text.IsSubText(Text.ConvertToLowerCase(LDUtilities.ZipList(ZipFiles[N])),Text.ConvertToLowerCase(SearchFor)) Then

    Find[Array.GetItemCount(Find)+1] = ZipFiles[N]


    (where ZipFiles is an array with ~200 .zip-Paths) i got an error 'LDUtilities.ZipList :  Cannot read that as a ZipFile' from

    // Ionic.Zip.ZipFile --- private static void ReadIntoInstance(ZipFile zf)

    but finally the exact same results (resulting zip-Paths with finds) as before, until after an eternity + 3 mins, i found out via TriD that a named .zip in fact was a .7z. Ups.

    And LDShapes.GetColour, as working solution for crashing Shapes.GetOpacity, pretty shows in a single line that ShapesOpacity and Color-'Alpha' are separate values and independent from each other.

    Also .GetNextMapIndex works as expected and makes life a lot easier.

    And, if someone ever should see a blank IntelliSense after editing an xml, here's the easy solution: how to find my errors in the xml file. The FF variant does'nt take 2 mins, after one's desperate and confused.

    Monday, June 2, 2014 8:42 PM
  • Thanks for XML, uploaded as Version 104

    Monday, June 2, 2014 8:57 PM