 Welcome, I'm Armin Legrand working for Allotropia and I just wanted to talk about multicolor gradients which I had the chance to do at last. So for motivation it's a long missing feature and an office package is not really up to date when you don't have some and I don't know any other package even graphic packages which doesn't support it nowadays. So I filed it as a tender long time ago, the last version was on the 2021 Viki, you can check there, but I already copied that quite for some years and everyone agreed it is necessary but it was never voted strong enough, maybe it's my fault and the text was not understandable enough because I have my head on the technical side maybe a description was just too technical to get voted. I have no idea but it's a too big task to do as a sidekick to daily work so not possible but I thought about the durability of course all the time so I was prepared and then at last support was offered so Michael Meeks offered sponsoring Torsten had Regina had a lot, Heiko did some stuff and anyways I discussed with Heiko nearly at every meeting we had about doing it and how to do it and of course mostly the UI aspects with Heiko. Discussed with many colleagues and all that stuff but now with that support I could really start doing it and it's nearly completely finished I say nearly completely because time and support ran out to do the UI stuff so it's complete in the core you will see but we have no current UI it is a compromise so let's go into changes made commits go from 10th of February to 30th of June I tagged everything with MCGR in big letters I like to do stuff like that I did it also for the system-dependent vendors it's just easy to grab but it's not only done by me Regina helped a lot I really have to thank Regina she was helpful she bombarded me with bugs and stuff and but every every of her mentionings or box was immediately reproducible so really useful I have to give her a big thank you I already did so it's mainly stable just some small stuff was coming up but but nothing big and you can have a look at the commit comments I usually comment quite quite quite a lot and talk about the environment where the changes happen and you can read between the lines about the connections in the office if you want a good good possibility to have deeper understanding of the office components they work together if you ask me so it's 44 commits in total I think maybe not all were tagged correctly so this is first half this is the second half but don't worry we will not continue with that I will first start with lessons learned from doing it because I don't know if I will have time at the end to do it so I do it at the start it changes in refined new code well much simpler safer faster stable less error prone sustainable in single places and in older parts of course but we should really talk about the consequences of stuff like that we should think more about refactoring code if you ask me in the long term this will save much time at nurse and keep people motivated and we are we are fighting to get people into development and our code base is not inviting I would say so it's also much safer and yes I know that it's hard to get commercial funding for stuff like that because you normally you get commercial funding only for fancy stuff which blocks up and shows something and gives you some applause and new feature but in principle we have a building where the fundament is really getting old and we have a shiny front and entrance so it's for the long term it's not good so what came in handy I use just an environment variable name name is not important to just easily be able to test my stuff and to get it in the master early so you can experiment anytime with just one build you can switch it on by putting it in front of your S office starting command I'm sure everyone here knows that and I highly recommend this but you have of course been careful when you don't finish a feature you have to remove your stuff again that's important so let's get to the core changes I have a lot of slides so I will not talk about all of them but most important and interesting ones so of course it's not magic it's just the move from a start color and color to a vector with offset and color so the basic change was not really complicated it has some complicated effects you can have combinations of color stops which are encouraging but that's not the real problems real problems to get it done throughout all the office in principle so this gave a good anchor to identify places need no vector of colors to be compatible I was strongly taking care to always have a start and color fall back so at least virtually because for example the basic core class does really not have a start and color anymore because from the color stop vector you can calculate it now so there's really no member anymore in the basic data class so you need to handle all existing API accesses as fallbacks to it to keep compatible and add new API for vector ready to be used and so the offset part of the vectors just a unified double-value is easiest you don't have to divide anything you can multiply whatever you need when you later have to scale it somehow for you I or whatever number of entries is not limited it's sorted by offsets and multiple entries at same offset are allowed so this requires an order preserving sort to keep it so it's won't be unfortunate and break and not work if entries at the same position would be exchanged by the sort luckily the standard sort doesn't so zero and one not mandatory already mentioned you have to handle incoming stuff for error corrections below zero and above one so just details you can make just a linear linear calculation to get the right start and color I could have also chosen to say it's just an error and ignore input from the user outside of set range but I strongly opt for not throwing away any user input and makes the most usable out of it even if it looks unusable so the color part is basic base gfxp color also in unit range so we will be compatible to everything which comes along precision more than a bit stuff and stuff like that it's getting more actual and more current in this place and stuff like that and one of the big difference to the MS stuff is LibreOffice has a different concept for the transparency so for all fields we have you can additionally define the transparency and that transparency can be linear or gradient in principle it can be anything because the primitive strut struts handle it as scratch context and it's interpreted as luminance where you so you can put in principle everything as transparent we just support since two at the moment so some examples for a vector and how it can get complicated entry read at 0.8 means start and colors read it's not a gradient at all and we I have implemented fallback so that we don't need to render it as fallback so next example minus 0.2 to 0.2 so you compute the start color entry linear interpolation and then you have gradient from 0 to 0.2 and single color at the rest and it just goes on like that and and the 0.5 with three colors shows that the blue is just not used but don't throw it away it's user input and if you want to have turnarounds working just keep it in the background so moved all of this to tooling classes to have it really available on all places you know AP implementations and the rendering stuff and everywhere so I adapted it to our six type of gradients adaption of primitive decompositions for source gradients to get it renderable so this was straightforward but got a little bit complicated because we have just more steps I also added a callback lambda to the tooling to create gradient steps and also changed primitive render so there's no longer something like if necessary 120 primitives created in single color but the callback just gets gets called with color and transformation and you paint your gradient form so gradient forms we currently have is just a unit circle and unit rectangle but we could in principle use any form to draw gradients so also necessary adaption of texture transformations so this was more challenging so it's used currently in slideshow it's like fulfilling shapes with it and 3d objects so it's just a back transformation from a unit coordinate system 0 to 1 to a color and it will be important for texture rendering and system-dependent vendors because that's what graphic systems use nowadays and you give some you give some you give some assist back transformation function and then it can be done in hardware so I added a small buffering because with multiple color sequences it's expensive to do it for every pixel but I just buffered a single entry for the last part and it had a hit rate of over 99% so it pretty much has the same speed as before even with multi-color gradients so I reduced the number of enums there were really three different enums to describe our six gradient shaped possibilities then API changes Regina already talked about it very short we have a color stop we have a color stop sequence also a pretty straightforward and a gradient to derived from the existing gradient which contains contains the initial additional color stop sequence so that's pretty much all what was needed and adapting all implementations was also also more challenging again but I got the API stuff pretty pretty quickly running respect compatibility in place so the tooling methods to convert between you know API format and internal core formats including any handling so you don't have to care if it's gradient or gradient to with the tooling does stuff like that for you to take care of derived you know types so adaptions of you know API with corrections for works all that stuff so then we get to the more important stuff over XML import so there was already import from the basic values in OXML so I could just build on it so called gradient props so they can now directly be used as a gradient to color stop there's this paradigm difference Microsoft has alpha values directly in the gradient so if they are used and not all the same you have to create a color gradient and transfer the gradient on our side and vice versa so so Microsoft also has a color intensity but it has just to be added to the color because our stuff which is similar to it is just in one direction can just land against black completely unusual from my point of view I don't know why this is in place so export as I already said Microsoft has the other ways they have transparency so you need to mix it so it's it's also not rocket science so if you have a color gradient and so transparency is a fixed value you just add to fix value to every step if you have a transparency gradient you do it the other way around you build a Microsoft compatibility gradient with all the same color and the different transparencies it's the only interesting cases really when the two don't match so in most cases they do match because it was imported from somewhere and it we recreated it ourselves but in case it doesn't match it's also not really complicated so if you have your color and transparency and you have some color stops and transparency stops you just have to linearly interpolate fitting values and then you put them together and you have you have what you need for Microsoft and this works surprisingly well and solves the problem so we no longer need the original the grab bag but it's it's there in case but we could now remove it more or less so small excursion Microsoft has one more type of gradient and very interesting we don't support it yet it's past related and it just shrinks the polygon so we could do it a relatively easy for convex polygons but not for car forms and just for your imagination it's like a building with the irregular roof and if you think about how the roof is growing so every every layer of the roof would be a color step so it's that's complicated quickly especially when you have round parts included and numerically it gets in trouble pretty fast I once tried that ten years ago something so not as easy as it looks border property we have a border property it's also not very useful because it's only on one side of the gradient and on the wrong side for the axial one but we have to keep that we can do that now in the gradient stops just by not using zero and one directly but we have to keep the border so if someone changes the border we have to solve somehow integrated so we cannot just get rid of the border entry unfortunately but I added tooling so so you can interpret it in both directions you can create a border from a gradient stop vector and vice versa so we have all tooling we need to export so currently we do with extra step and export in ODF risk border to be more compatible with older offices just looks better so thanks go to Regina she provided completely running prototype so she also took over the need definition change stuff and all that I slightly adapted it to to also have it available for the gradient previous and we added more stuff to import export border axial and color steps in a compatible way so made our file adapted to correctly include stuff but I think I go over since you can read this as you want in the presentation so one interesting thing just just for fun first there was writer and then various said let's have draw in press and calm but the first version of opera device could do nothing fancy at all no gradients not even dashed lines or something this was all put into something called X output device X is not for interface or something some chess were extended and it was all implemented there and later when it was integrated so that the other apps could use the graph nice graphic stuff too it was transferred to our device so it was very simple before that's just as a side note so as SVG in export also adapted you can just read about it this was one of the more difficult parts because the code for the export is a little bit mangled and based on metafile stuff so this was a little bit more complicated but he insisted and I got it working so fast that you really get SVG gradients for the gradient and for the transference even if you combine it so we spare some some asky space in SVG so we have this gradient steps this is also just something we have to reduce a smooth gradient to something like 3 4 5 steps I don't know why it's who liked it whatever but we have it we have to support it so there's tooling to do so but if you think about it you can do that with color stop gradient completely so we can now 100 percent export that stuff also not that bad so PDF export also in the way graphic format exports I talked about the vector formats pixel forms I checked all of them most work also drops just with adapting the primitive decomposition not to forget you also have MTG are multi transference gradient so there were some adaptions needed for to get the correct alpha channel to the pixel exporters but most doable so the point is we have no UI all existing UI works so you can change start colors and color you can add border you can change the gradient type as long as you have a multi-color gradient so where do you get it from you can import it we have some in the prototypes in the area field dialogue hi-co edit them and Regina already had a talk yesterday showing some macros creating them so but of course we need a UI in the long term but I don't don't have to do everything the cross-stuff is working so maybe someone even cheese or something could do it because the API is there and everything is working it's just UI implementation easy I have myself some ideas for the interactive gradient stuff don't know how many people even know about it we have interactive gradients which you can where you can move the orientation of the gradients and stuff directly with the mouse how to find maybe we should offer it more directly so done multi-color gradient feature complete from the staff I could do in the core UNO APM exports made it in time and is in the 7.6 release and no catastrophes came up and nothing fired back so fingers crossed to currently work with them as I said script some Regina examples you can copy paste if you have loaded something you can also store in the prototypes in the area area in the film area by adding using the ad button and then can use it for any new shape you create by just applying that and would be ashamed to not show some pictures just just the technical side would be too boring I think so just in time you see on the on the on the left side I would not resist to also show the 3d functionality but it's just some gradients are used just for testing not nothing special nothing fancy really not useful but just to show more useful for example as Phil style for our text more complicated text stuff make makes it quickly more interesting I don't know if you remember this technical demos for my mean on stuff like said 10 15 years ago say used to gradients like that to make their fonts that's fancy we could theoretically do that now and I could not resist an ad at least two 3d objects so of course it also works with all the custom shapes from Microsoft as one error Regina already sent me when you do this one trick Regina has to to make the 3d extortion that somewhere it's at the auto border it's an error somewhere I have to hunt search but all pretty much working so that's it questions go ahead all right good gradients yes many people don't know that Regina will show in her next presentation I think so there's a mode in draw when you have selected object which has a fill gradient there's a button you can press and you get the interactive gradient tool it is a little error with color boxes at the start and the end and you can drag and drop from the color selector into the color boxes to change the color and you can pick the start or the end of the error rotate the gradient and you can put the back or the front depending on the gradient type and make it shorter or longer and you can for the ones who have x and y offsets you can position it really in the shape and you can do the same for the transplants gradient yeah how long how long are you working with the office and I can still surprise you you're welcome I can show you later if you want okay thank you very much