These are chat archives for AvaloniaUI/Avalonia

5th
Nov 2015
David Fowler
@davidfowl
Nov 05 2015 07:34
success @grokys
Steven Kirk
@grokys
Nov 05 2015 09:26
Yep, just saw. That will be so useful. Thanks David!
Steven Kirk
@grokys
Nov 05 2015 13:45
IStreamGeometryContextImpl has QuadTo - in WPF this seems to be called PolyQuadraticBezierTo. should we be using WPF's naming?
it seems clearer to me - to me a quad is a shape with 4 corners
i.e. in 3D programming two triangles make up a quad
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 13:52
its actually QuadraticBezierTo
PolyQuadraticBezierTo takes points array as input
Android has cubicTo equivalent of Perspex BezierTo
And quadTo if for quadratic bezier in Android
Steven Kirk
@grokys
Nov 05 2015 13:56
ah ok. so the question is whether we use the WPF naming or the android naming
personally i'd say use the WPF naming as our DrawingContext is taken from WPF
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 13:59
I would stick with WPF naming in this case, but I always find bit confusing BezierTo in WPF
Steven Kirk
@grokys
Nov 05 2015 14:00
ok, how would you improve it?
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 14:02
use the Android names
Steven Kirk
@grokys
Nov 05 2015 14:02
so BezierTo -> CubicTo?
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 14:02
yes
Steven Kirk
@grokys
Nov 05 2015 14:03
would CubicBezierTo work?
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 14:04
yeah this would be even better
and QuadraticBezierTo
Steven Kirk
@grokys
Nov 05 2015 14:04
ok, lets go with those. it's good to have the word "Bezier" in there
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 14:05
This way user knows exactly what kind of curve this is
Steven Kirk
@grokys
Nov 05 2015 14:10
yeah, and if they're new to the API, they can type "Bezier" and get useful intellisense
Wiesław Šoltés
@wieslawsoltes
Nov 05 2015 14:13
Less confusion and more descriptive method names, I have created issue for this
Steven Kirk
@grokys
Nov 05 2015 14:16
thanks! i added it to the alpha3 milestone
Eric Winnington
@ewinnington
Nov 05 2015 15:36
How close will Perspex be to WPF code? Do you get the impression that the drift in class / properties / calls naming will make Perspex harder to migrate to when starting from an existing WPF application?
Weston
@ronnyek
Nov 05 2015 15:59
I mean isnt the xaml parsing literally exactly the same?
eg, same xaml
Andrey Kunchev
@donandren
Nov 05 2015 16:04
hello guys, I want to contribute to perspex project. Last week i've played with it and made android support and want to commit the code
Steven Kirk
@grokys
Nov 05 2015 16:17
@ewinnington it should be pretty close, we try to keep the same naming where it makes sense. i think a bigger problem will be that certain concepts don't carry over at all; our styling system is completely different, we won't have ICollectionView etc
@donandren you probably want to speak to @kekekeks about that - he's currently working on android/ios support i believe
Andrey Kunchev
@donandren
Nov 05 2015 16:19
yes i've noticed droid branch, but it was with very basic support
and i've made almost everything to work
how to reach @kekekeks viw this git room?
Steven Kirk
@grokys
Nov 05 2015 16:20
yeah, he's usually around
have you published your fork containing your changes to github?
Andrey Kunchev
@donandren
Nov 05 2015 16:20
nope this is what i'm wondering how to do it
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:20
@donandren We have some android support in droid branch
Andrey Kunchev
@donandren
Nov 05 2015 16:20
in a branch , but with what name as droid exists
also droid branch is not in sync with the master
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:21
Yep, it's kinda abandoned
Andrey Kunchev
@donandren
Nov 05 2015 16:21
and i've made my changes locally from the master
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:21
We've given up on the idea of using platform-specific drawing backends for mobile
Because it's too problematic to debug
Currently I'm implementing our drawing api using skia
Please, fork the repo and upload your code there
Andrey Kunchev
@donandren
Nov 05 2015 16:23
you mean branch from the perspex one with name Android let's say
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:24
https://github.com/Perspex/Perspex - you need "Fork" button
Andrey Kunchev
@donandren
Nov 05 2015 16:24
ah ok
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:24
It will create a copy of perspex repo for your github account
Andrey Kunchev
@donandren
Nov 05 2015 16:24
i'll try it today or tommorow
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:24
You can push your changes there

What exactly do you mean by

i've made almost everything to work

?

How complete is your rendering backend?
Because that's the hard part
And with android's canvas we can't even run tests properly
Darnell Williams
@Seeker1437
Nov 05 2015 16:27
@kekekeks its not abandoned :O
Andrey Kunchev
@donandren
Nov 05 2015 16:27
it's 90%+ complete
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:28
ImageBrush? Matrix transformations?
Andrey Kunchev
@donandren
Nov 05 2015 16:28
TestApplication is working on android
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:28
Oh, very nice
Andrey Kunchev
@donandren
Nov 05 2015 16:28
only the html label i didn't tested it
matrix transformations i think are working, textbox, lisboxes
Darnell Williams
@Seeker1437
Nov 05 2015 16:29
Nice :D
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:29
matrix transformations can be tested on animations page
Andrey Kunchev
@donandren
Nov 05 2015 16:29
visual brush i haven't work on that
at all
yes animations are working
Steven Kirk
@grokys
Nov 05 2015 16:29
wow, nice work!
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:30
Have you used existing drawingcontext implementation or just created one from scratch?
Andrey Kunchev
@donandren
Nov 05 2015 16:30
drawingcontext implementation
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:30
You should have told us sooner, because we'll likely have to replace that with skia (
Andrey Kunchev
@donandren
Nov 05 2015 16:30
i've made 4 different type of rendering
Darnell Williams
@Seeker1437
Nov 05 2015 16:30
Skia is much beyond me :(
Steven Kirk
@grokys
Nov 05 2015 16:31
i dunno, if we have a working android impl i don't see why we can't keep that too. skia can be an option, as it is for all platforms
it all depends who wants to keep what maintained really...
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:31
We can't run tests
That's the issue
Steven Kirk
@grokys
Nov 05 2015 16:31
right yeah
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:32
Skia can be properly tested, anything based on Xamarin will be tricky
Darnell Williams
@Seeker1437
Nov 05 2015 16:32
Why not exactly?
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:32
Well, how exactly are we supposed to run tests on the build server?
Darnell Williams
@Seeker1437
Nov 05 2015 16:33
Where there is a test framework isn't there, does Xamarin not support it?
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:33
You can run tests on your device
It's not a problem
Integrating tests to the build pipeline is another matter
We need to run tests on CI server
For every commit
To see if nothing got broken
Darnell Williams
@Seeker1437
Nov 05 2015 16:34
Ahhh! yes
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:34
There is another issue
If we depend on Xamarin libs
Darnell Williams
@Seeker1437
Nov 05 2015 16:34
But Xamarin is supposed to be releasing a CI implementation of its own for that.
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:34
Anyone who want to change rendering stuff
Needs xamarin license
Darnell Williams
@Seeker1437
Nov 05 2015 16:35
yeah
Okay so skia will be the way around that
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:35
That's exactly why I decided to use skia instead of native drawing libs
Darnell Williams
@Seeker1437
Nov 05 2015 16:35
Okay, makes sense, I was concerned about use Xamarin initially in the beginning.
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:36
It's fine to use their windowing implementation, since it's thin
And we'll get most of the complex stuff using tinywm
Darnell Williams
@Seeker1437
Nov 05 2015 16:36
Yeah which I really want to play with XD
But my big thing is that if we are going to use skia I can't be of any help anymore I guess
Never used it before
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:38
Well, skia backend is almost complete
Darnell Williams
@Seeker1437
Nov 05 2015 16:38
But as I look thorugh it, I say it's very nice... wasn't there a concern with having to have like a binary for each platform?
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:38
We can provide arm/arm64/i386 builds for android
Mobile binary platforms aren't that fragmented
Darnell Williams
@Seeker1437
Nov 05 2015 16:40
AH so we are mainly purposing Skia for mobile?
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:40
We'll see
Windows and MacOS shouldn't be much of an issue either
Because we'll need only i386/amd64 builds
Darnell Williams
@Seeker1437
Nov 05 2015 16:41
well, windows 10 has arm support, why not add it in?
I only mention it because I know there are people who "Jailbreak" there Windows RT devices to get the desktop functionality, where one could theoretically run an app created with Perspex :O though... we could leave that for another contributor
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:44

well, windows 10 has arm support, why not add it in?

Good luck with that

Anyway, let's see @donandren's code
Andrey Kunchev
@donandren
Nov 05 2015 16:49
very soon i'll commit it
just to test it's building
Nikita Tsukanov
@kekekeks
Nov 05 2015 16:50
Well, for now I need to see the code
Don't have android device nearby at the moment
BTW, do you have experience of building C/C++ stuff for android?
Andrey Kunchev
@donandren
Nov 05 2015 17:08
nope
only with xamarin for android
Darnell Williams
@Seeker1437
Nov 05 2015 17:22
may I see it as well sir?
Andrey Kunchev
@donandren
Nov 05 2015 17:41
finally android version of perspex is pushed to https://github.com/donandren/Perspex
i had to update little bit code in order to handle some recent changes in Perspex
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:31
Have you used any code from current droid branch?
Or just created everything from scratch
Darnell Williams
@Seeker1437
Nov 05 2015 18:32
wow
+1 to @donandren
tooks to be from scratch
looks*
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:33
ArcTo implementation is a stub
But we have our own so that's fine
Darnell Williams
@Seeker1437
Nov 05 2015 18:34
Oh yeah definately from scratch
and I really like it
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:35
@donandren What's the difference between draw types?
Darnell Williams
@Seeker1437
Nov 05 2015 18:35
ah alot of my code was redone
but some of the basic stuff like the extensions stayed :D
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:36
ImageBrush isn't implemented properly, it ignores source/dest rects
But the whole thing looks very good
Darnell Williams
@Seeker1437
Nov 05 2015 18:37
@kekekeks I must say this is pretty good, I wouldn't have gotten this far.
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:37
I'll make a proper review this weekend
Darnell Williams
@Seeker1437
Nov 05 2015 18:38
the draw types are interesting
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:39
@donandren What's the most effective draw type?
Andrey Kunchev
@donandren
Nov 05 2015 18:39
the difference between drawtypes is the way control is rendered simplest is CanvasOnDraw - drawing in onDraw method on the canvas provided from android
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:40
Why did you implemented other types?
Andrey Kunchev
@donandren
Nov 05 2015 18:40
OnPreDraw - bitmap is generated in View.OnPreDraw event then View.OnDraw is rendering the birmatp
Darnell Williams
@Seeker1437
Nov 05 2015 18:40
ah so one could render other ui elements without rerendering the whole thing?
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:41

ah so one could render other ui elements without rerendering the whole thing?

From android's point of view there is one ui element

And partial invalidation should be supported by xplat renderer code, not by platform-specific backend
@donandren You've done awesome work
Andrey Kunchev
@donandren
Nov 05 2015 18:42
BitmapBackgroundRender background thread is rendering bitmap then View.OnDraw is dispaying the bitmap
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:42
Currently perspex isn't thread safe
And isn't ready for background thread rendering
Johan Larsson
@JohanLarsson
Nov 05 2015 18:42
but only one thread no?
Andrey Kunchev
@donandren
Nov 05 2015 18:42
SurfaceViewCanvasOnDraw is using SurfaceView instead View and rendering is on a background thread not ui thread
this is the most performance one
Darnell Williams
@Seeker1437
Nov 05 2015 18:43
THat was why i wanted to use the SurfaceView
Andrey Kunchev
@donandren
Nov 05 2015 18:43
only one thread is used for methods rendering on not ui threads
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:45
Well, RenderVisual is supposed to be called on UI thread
Andrey Kunchev
@donandren
Nov 05 2015 18:45
I've made the different methods to test the performance differences on android
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:45
How did you work around that?
Andrey Kunchev
@donandren
Nov 05 2015 18:46
i''ve override ITopLevelRenderer
IPlatformThreadingInterface.CurrentThreadIsLoopThread and regiter the rendering threads
actualy the one if there is
Darnell Williams
@Seeker1437
Nov 05 2015 18:47
wow this is really amazing. I am just gonna go learn to program now.
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:47
Ehm, so, basically, you are accessing UI objects from multiple threads?
Andrey Kunchev
@donandren
Nov 05 2015 18:48
hm actually on the drawing methods using thread yes
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:48
That's not thread safe
We can't use this method
Andrey Kunchev
@donandren
Nov 05 2015 18:48
sure it was just a test
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:48
The only safe way of using background rendering is to record render commands from UI thread and then pass them to actual renderer on background one
So, basically, for now we can only use Canvas::onDraw, right?
Andrey Kunchev
@donandren
Nov 05 2015 18:49
and BitmapPreDraw
it also on the ui thread
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:50
Is pre-rendering to offscreen surface more efficient?
Andrey Kunchev
@donandren
Nov 05 2015 18:50
the other methods in my tests on simulator and real device also are working
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:50
They are working, but aren't safe
We can't call Visual::OnRender from non-ui thread
Andrey Kunchev
@donandren
Nov 05 2015 18:50
absolutelly
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:51
I'll do a proper review this weekend
But I think that background rendering part should be removed
Is that the only reason why you've replaced ITopLevelRenderer interface implementation?
Johan Larsson
@JohanLarsson
Nov 05 2015 18:53
paket looks awesome
José Manuel Nieto
@SuperJMN
Nov 05 2015 18:53
what? Perspex running on Android? You kidding me?
Andrey Kunchev
@donandren
Nov 05 2015 18:53
actually there is no need to be overwriten i was making some tests but finally there is no change there
José Manuel Nieto
@SuperJMN
Nov 05 2015 18:53
hahaa, when is the world domination?!
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:54
@donandren Please, focus on input handling and simular stuff
I still think that DrawingContext should be implemented by skia
Because of testability and maintainability reasons
In ideal scenario we'll have one rendering backend for all platforms
BTW, android's Canvas is based on Skia
Andrey Kunchev
@donandren
Nov 05 2015 18:57
@kekekeks what do you mean input handling? as currently i've made handling of keyboard and touch events also generating Scroll event from pointer moving.Keybord is showed when textbox is focused
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:57
So input system is complete?
Great
Andrey Kunchev
@donandren
Nov 05 2015 18:57
yes
selection of text in textbox also
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:58
Does window get resized when keyboard is shown?
Andrey Kunchev
@donandren
Nov 05 2015 18:58
nope i haven't worked on that
Nikita Tsukanov
@kekekeks
Nov 05 2015 18:58
I'm not sure how should we handle "textbox under keyboard" scenario
Andrey Kunchev
@donandren
Nov 05 2015 19:01
also i've wrote some device independent pixel support, the way android have it so this can be configured initially use direct Pixel, or use PointUnit.DP so the visual obejct can be physically samo on different size android devices
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:02
How exactly did you implement scaling?
Darnell Williams
@Seeker1437
Nov 05 2015 19:02
Yeah I felt pretty accomplished getting the initial android implementation working I skipped 3 days of work and stayed up 4 days!
Andrey Kunchev
@donandren
Nov 05 2015 19:03
all drawing context coordinates received in drawing context are transformed before drawn
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:03
What about paths?
José Manuel Nieto
@SuperJMN
Nov 05 2015 19:03
People, @ImabrokeDude seems to have worked with the Android platform implementation, too
Andrey Kunchev
@donandren
Nov 05 2015 19:03
also working
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:03
Why haven't you used matrix transformations?
Darnell Williams
@Seeker1437
Nov 05 2015 19:03
that f**k epic :O
José Manuel Nieto
@SuperJMN
Nov 05 2015 19:03
please, collaborate and kick hard!
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:04
Applying scale transform after everything else should have done the trick
We can even do that in xplat layer
Andrey Kunchev
@donandren
Nov 05 2015 19:04
i wanted to have more control of the scaling as later in i can add some rounding and different font scaling logik
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:05
It might break BitmapRenderTarget stuff
If you'll try to render pre-scaled path on unscaled bitmap
Andrey Kunchev
@donandren
Nov 05 2015 19:06
i think it's working properly from my test runs with the test applciation
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:06
I'm talking about general-purpose usage
Why haven't you introduced some decorator level that takes care of scaling?
Well, we'll take care about that later
You did awesome job
Andrey Kunchev
@donandren
Nov 05 2015 19:07
i've introduced IPointUnitService
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:07
Yep, but it's backend specific
Andrey Kunchev
@donandren
Nov 05 2015 19:08
it's backend specific yes, but i didn't wanted to change core code
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:08
We'll move that to xplat part later
Steven Kirk
@grokys
Nov 05 2015 19:13
@donandren i can't believe you did all this without even asking questions in here!
Darnell Williams
@Seeker1437
Nov 05 2015 19:13
he's a pro XD
Steven Kirk
@grokys
Nov 05 2015 19:13
figured it all out yourself!
amazing work
do you have a screenshot you could post here? i haven't got xamarin to try it
Darnell Williams
@Seeker1437
Nov 05 2015 19:15
Im gonna build his project and post it in excitement XD
Andrey Kunchev
@donandren
Nov 05 2015 19:23
yes i'll post screen shots
4.png
7.png
6.png
2.png
1.png
3.png
5.png
Steven Kirk
@grokys
Nov 05 2015 19:25
amazing!!!
mind if i post some of them to twitter? or if you have twitter could you post some and i'll retweet?
Darnell Williams
@Seeker1437
Nov 05 2015 19:27
holy wow it workcs
rotation is broken
on the gs6
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:29
Rotation is the last thing we should care about
Steven Kirk
@grokys
Nov 05 2015 19:30
really fantastic job there!
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:30
SetForegroundBrush is also a stub
argh
Well, I'm not doing well on that front either
Darnell Williams
@Seeker1437
Nov 05 2015 19:32
I will fix it though so it works :|
Andrey Kunchev
@donandren
Nov 05 2015 19:37
don't mind to post them everywhere you want. Also animations are working
Darnell Williams
@Seeker1437
Nov 05 2015 19:39
hey where is reconfigure?
for some reason it is not accessible for me
Steven Kirk
@grokys
Nov 05 2015 19:45
...anyway, this should definitely be merged into the main droid branch
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:45
Ehm
I was thinking about merging directly to master
Steven Kirk
@grokys
Nov 05 2015 19:46
yeah, that too
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:46
It needs some code cleanup, but it works
Steven Kirk
@grokys
Nov 05 2015 19:46
yep
only thing i'm concerned about is that someone maintains it
because as you pointed out we can't really rely on tests
@donandren are you planning on maintaining this long-term?
also @kekekeks and @donandren you need to come to an agreement on how to proceed with this renderer vs skia
i'm happy to have both tbh
Andrey Kunchev
@donandren
Nov 05 2015 19:50
I was not thinking about that untill now, but I can spend some time keeping it in sync with the framework and updated
Steven Kirk
@grokys
Nov 05 2015 19:51
that would be great, because as i said i don't have xamarin, and tbh i'm busy enough with the core stuff!
we can give you access to the main repos
Andrey Kunchev
@donandren
Nov 05 2015 19:52
I have xamarin and may be I can write iOS port with native rendering after some time
Steven Kirk
@grokys
Nov 05 2015 19:52
that would be amazing
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:52
Yep, then we'll have two backends we can't run tests for
Excellent idea, surely
I was planning to finish win32 version of skia backend this weekend
And run all existing tests
The only thing that's left is bitmap/visual brush
Steven Kirk
@grokys
Nov 05 2015 19:54
well yeah, the whole skia/native problem is something you guys need to decide on...
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:55
I like the idea of one uniform backend for most platforms
Instead of 4 different ones
Steven Kirk
@grokys
Nov 05 2015 19:57
yeah, me too, the only problem is the non-managed code. if that ends up not causing problems all good
what do you think @donandren ?
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:58
The only platform I'm concerned about is Linux
Too much fragmentation
If we'll support only Debian/Ubuntu we should be fine
People who want to target other distros can always build native deps from sources
Steven Kirk
@grokys
Nov 05 2015 19:59
also i imagine there's overhead in skia that isn't present on the native/xamarin backend
Andrey Kunchev
@donandren
Nov 05 2015 19:59
one backend is better as idea especially if it high performance enough, but sometimes in the real world you need to touch the native api to get the best of it
Nikita Tsukanov
@kekekeks
Nov 05 2015 19:59
Android Canvas is based on skia
See android sources
Andrey Kunchev
@donandren
Nov 05 2015 20:00
if skia is working good and for all platforms this can be the best solution
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:00
Basically, I'm learning how to use damn thing by reading android sources. Not that much docs
Andrey Kunchev
@donandren
Nov 05 2015 20:01
and how you are accessing skia as it doesn't have c# (or I'm wrong) ? via some pInvoke ?
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:02
I'm implementing Perspex's drawing API in C++
That's the managed<->native bridge
For some stuff I'm accessing unmanaged structs directly
using unsafe and pointers
Andrey Kunchev
@donandren
Nov 05 2015 20:07
great stuff! I haven't written c/c++ from 5,6 years but still remember most of pain that caused me
Johan Larsson
@JohanLarsson
Nov 05 2015 20:20
forgot if I spammed the paket sample here.
Darnell Williams
@Seeker1437
Nov 05 2015 20:21
Wow it's legit, I noticed though on physical devices it has a high battery drain, but its blazing fast
though I bet my implementation probably had a high drain as well
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:31
@grokys Is word-based line wrapping implemented on TextBlock level or provided by platfrom implementation?
Steven Kirk
@grokys
Nov 05 2015 20:31
platform implementation
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:32
Argh
Well, I guess, I have to implement that too
Steven Kirk
@grokys
Nov 05 2015 20:32
ouch
there's nothing in skia for that?
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:32
:)
There is no layout class
Android implements it's own
I have access to raw glyph rectangles
Steven Kirk
@grokys
Nov 05 2015 20:33
hmm, not nice
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:33
Well, wrapping isn't that hard
Steven Kirk
@grokys
Nov 05 2015 20:34
is there a way to call out to the android/ios classes to do it?
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:34
Not from that level
It would be easier to just implement it
Since I already have glyph-based wrapping
I just have to scan for the last space character
And break the line at that point
Steven Kirk
@grokys
Nov 05 2015 20:35
isn't it complicated to implement that when considering internationalization?
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:35
Space characters are always the same
Steven Kirk
@grokys
Nov 05 2015 20:35
ok. i have no idea how arabic, japanese etc work
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:36
Arabic is actually the same thing
They use letter-based alphabet
In japanese wrapping rules are the same
Steven Kirk
@grokys
Nov 05 2015 20:36
how do you know this stuff?!?!
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:36
I. e. "try to not break at the middle of non-space sequence when possible
Well, I've spent two years in Moscow State Linguistic University
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:38

periods and closing parentheses are not allowed to start a line.

They never will

Unless some moron will write space before them
We can just use "break at spaces when possible"
For languages like Thai and Khmer, words run together (with no space between characters that end a word and those that begin another word, as with Latin script). This makes word breaking in such languages a more complex process, since syntax rules require line breaking on word boundaries. Thus for languages like Thai and Khmer, word breaking is based on grammatical analysis and on word matching in dictionaries during text processing at run time.
:O
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:40
Wow
Steven Kirk
@grokys
Nov 05 2015 20:40
i was sure it couldn't be so simple ;)
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:40
Well, let's think about Khmer later
Steven Kirk
@grokys
Nov 05 2015 20:40
haha sure
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:41
"Wrap at space" is good enough for almost every language
Steven Kirk
@grokys
Nov 05 2015 20:42
are you sure there's no existing lib for that sort of thing that works with skia?
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:43
I was googling for a while before I decided to implement FormattedText using low-level stuff
Nikita Tsukanov
@kekekeks
Nov 05 2015 20:55
blob
Close enough
Oh, great. It also accepts baseline as a starting point for text drawing
Argh
hacklex
@hacklex
Nov 05 2015 21:21

"Wrap at space" is good enough for almost every language

As long as spaces are used in that language to break the text into words, yes.

Egor Bogatov
@EgorBo
Nov 05 2015 21:21
I-agree-with-you :)
Nikita Tsukanov
@kekekeks
Nov 05 2015 21:22
Argh
Nikita Tsukanov
@kekekeks
Nov 05 2015 21:23
ARGH
hacklex
@hacklex
Nov 05 2015 21:24
Especially, given some kanji characters can be treated in some different ways (like 123456 -> 12 34 56 or 123 456), each of which would actuall make sense and become a proper japanese word
Egor Bogatov
@EgorBo
Nov 05 2015 21:25
Looks like the CultureInfo should have a property for separator ;-)
hacklex
@hacklex
Nov 05 2015 21:25
looks like there is no separator
Darnell Williams
@Seeker1437
Nov 05 2015 21:26
I think that is implemented on the control level
hacklex
@hacklex
Nov 05 2015 21:26
the task of breaking a text into words is non-trivial for such languages
Strictly speaking, this task is never trivial, but strict speaking requires somewhat more proper (and therefore, more complex) definition of a "word"
Egor Bogatov
@EgorBo
Nov 05 2015 21:27
you can check for those languages and show a messagebox "Learn English, *!"
Darnell Williams
@Seeker1437
Nov 05 2015 21:27
lolol
Steven Kirk
@grokys
Nov 05 2015 21:28
tbh perspex doesn't support RTL or anything yet, so it's probably not feasable to use anything other than western languages
Nikita Tsukanov
@kekekeks
Nov 05 2015 21:28
What a great way to determine the position of a character
Let's measure the string before it
>_<
Darnell Williams
@Seeker1437
Nov 05 2015 21:29
:O
hacklex
@hacklex
Nov 05 2015 21:29
It is just that we do not give an F about analytic word forms
Nikita Tsukanov
@kekekeks
Nov 05 2015 21:30
Well, I'm sure there is some C library that can wrap words properly
We'll just use it
Darnell Williams
@Seeker1437
Nov 05 2015 21:44
you guys are talking about internationalizing instead of localizing right?
Well, I have yet to implement bitmap/visual brushes
And then somehow wire up hardware acceleration
Weston
@ronnyek
Nov 05 2015 22:31
@kekekeks hell yes
me love you long time if you get that squared away
Weston
@ronnyek
Nov 05 2015 22:33
nice
Nikita Tsukanov
@kekekeks
Nov 05 2015 22:33
That was a bit of a nightmare to figure out
Weston
@ronnyek
Nov 05 2015 22:33
you got it drawing at all which is more than I did
=)
but I was trying to wrap it up in interop calls, not actual c++ wrapper
are you building one of those managed c++ wrappers
or?
Nikita Tsukanov
@kekekeks
Nov 05 2015 22:33
Pure C++
Weston
@ronnyek
Nov 05 2015 22:34
ultimately you have to interact with it via .net, right?
Nikita Tsukanov
@kekekeks
Nov 05 2015 22:34
Ehm
Weston
@ronnyek
Nov 05 2015 22:34
I need to polish up my c++ skills
Nikita Tsukanov
@kekekeks
Nov 05 2015 22:34
That's how I call native functions from C#
That technique allows to P/Invoke one single function
Weston
@ronnyek
Nov 05 2015 22:36
nice
and thats compatible with coreclr?
Weston
@ronnyek
Nov 05 2015 22:42
I had a hard time just getting skia building, and it was just kicking out skia.dll
Nikita Tsukanov
@kekekeks
Nov 05 2015 23:11

and thats compatible with coreclr?

yep

I had a hard time just getting skia building, and it was just kicking out skia.dll

Had almost no issues with that. Just had to copy some files from libjpegturbo to build directory

Then it provided me with statically compiled .lib files