<< 27-04-2024 >>

00:54:42*def- quit (Quit: -)
00:55:23*def- joined #nim
01:16:09FromDiscord<MDuardo> Is possible to download an specific file from a GitHub repo with the Standard Library?I want a program that downloads Nerds Fonts and installs to use in TermuxRight now I'm doing it with `curl` but I don't want dependencies
01:17:50FromDiscord<MDuardo> Does this work for that?↵https://nim-lang.org/docs/httpclient.html
01:20:01FromDiscord<Elegantbeef> `downloadFile` exists
01:20:03FromDiscord<Elegantbeef> Or you can use `get`
01:25:31FromDiscord<MDuardo> Thank you Beef, very cool
01:26:23FromDiscord<MDuardo> My shameless ripoff of this will be a success↵https://github.com/notflawffles/termux-nerd-installer
01:38:17*def- quit (Quit: -)
01:38:29*def- joined #nim
02:10:53*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
02:13:42*def- quit (Quit: -)
02:14:00*def- joined #nim
02:20:32Amun-RaC project what shoul've been a shell script
02:26:05FromDiscord<zumi.dxy> maybe he's a mad lad
02:26:15FromDiscord<zumi.dxy> what about C as a scripting language
02:28:10FromDiscord<MDuardo> With manual memory management and all that stuff?↵(@zumi.dxy)
02:28:20FromDiscord<Elegantbeef> Exactly!
02:28:24FromDiscord<Elegantbeef> Dynamically load it and leak away
02:29:46FromDiscord<MDuardo> Now I don't know if should keep it in Nim or just make it a Bash script
02:29:55FromDiscord<MDuardo> 🤔
02:34:26FromDiscord<Elegantbeef> Using Nim gives you a crossplatform binary
02:35:57FromDiscord<Elegantbeef> Using bash gives you a headache and forces you to depend on programs
02:35:58FromDiscord<Elegantbeef> Though you're using the stdlib httpclient so yea it also has deps
02:35:59FromDiscord<MDuardo> This would probably be useless in a normal computer
02:35:59FromDiscord<MDuardo> Yeah, but I only need it for Termux↵Which is ARM64
02:36:04FromDiscord<Elegantbeef> Right then write it for the default shell script of termux
02:36:27FromDiscord<zumi.dxy> I tried to use Nimscript↵it isn't good for everything :(↵↵So I just use Nim instead
02:36:55FromDiscord<zumi.dxy> in particular docutils don't work with Nimscript yet
02:38:13FromDiscord<zumi.dxy> I wonder if this is the virtue of actual scripting languages, fast prototyping esp. for quick and dirty scripts
02:38:41FromDiscord<Elegantbeef> You can write normal Nim as fast as scripting languages so who knows 😄
02:39:35FromDiscord<zumi.dxy> Python just so happens to have a rich stdlib and a rich ecosystem, so people end up building megastructures on top of it↵A scripting language↵Even torturing themselves to code somewhere else and use FFI for the tiniest bit of performance
02:40:05FromDiscord<zumi.dxy> Well that's writing, what about compiling
02:40:11Amun-Raalways try to use the right tool for the job
02:40:33FromDiscord<zumi.dxy> Nim is plenty fast to compile, but isn't quite as snappy for scripting purposes
02:41:02FromDiscord<Elegantbeef> It's fine for scripting purposes
02:41:27FromDiscord<MDuardo> Is NimScript slow or something?↵I used it two or three times, works fine for me
02:41:27FromDiscord<zumi.dxy> In reply to @Amun-Ra "always try to use": I mean, obviously↵I think some people say "no such thing as right tool for the job, use Our Thing for everything"↵(but not here thankfully)
02:41:42FromDiscord<zumi.dxy> well it's not slow
02:42:02FromDiscord<zumi.dxy> I just wish it's a little bit "snappier"
02:44:47Amun-RaI've never find a use for nimscript yet, what do you mean by snappier? what nimscript lacks in your opinion?
02:45:13FromDiscord<Elegantbeef> Nimscript lacks a lot of basic features, cannot even cast a set to an int!
02:45:33Amun-Rauch, that's a no go for me
02:45:37Amun-Raouch*
02:46:07FromDiscord<MDuardo> Hope NimScript gets better↵It's a bit basic for now
02:46:25FromDiscord<Elegantbeef> It's not the focus of development so it's not likely
03:36:28FromDiscord<zumi.dxy> You'd be better off just using Nim
03:54:15*SchweinDeBurg joined #nim
05:01:06NimEventerNew thread by take1234: Nim on the go: Smartphone, termux and ... "no" docs., see https://forum.nim-lang.org/t/11501
05:33:39*MacDefender joined #nim
05:36:43*def- quit (Quit: -)
05:37:54*def- joined #nim
05:46:24*def- quit (Quit: -)
05:46:48*def- joined #nim
06:03:28*coldfeet joined #nim
06:17:18*ntat joined #nim
06:48:12*bomb joined #nim
07:09:08*ntat quit (Quit: Leaving)
08:53:52*ntat joined #nim
10:23:46*coldfeet quit (Remote host closed the connection)
10:25:47*KhazAkar joined #nim
10:42:35*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
11:02:46FromDiscord<pmunch> In reply to @zumi.dxy "I just wish it's": For scripting? Maybe try a faster C compiler like TCC?
11:04:44FromDiscord<pmunch> Has anyone implemented a all fields lookup collection in Nim yet? Like give it an object with fields a, b, and c; and it generates byA, byB, and byC lookup procedures for a collection of them?
11:05:52FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=XRAlREIFZSsO
11:06:01FromDiscord<aintea> https://nim-lang.org/docs/options.html
11:06:38FromDiscord<aintea> Also when I just copy paste the code from the docs it works, but when I copy it by hand it doesn't
11:11:24FromDiscord<zumi.dxy> In reply to @pmunch "For scripting? Maybe try": It's still "supported" isn't it? :p
11:22:15FromDiscord<pmunch> What is?
11:29:08FromDiscord<pmunch> In reply to @aintea "Any idea why the": Very strange
11:29:39FromDiscord<aintea> I get this
11:29:50FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=zSwVmmJGNZZM
11:30:12*nyeaa49284230101 quit (Quit: The Lounge - https://thelounge.chat)
11:33:17*nyeaa49284230101 joined #nim
11:35:17FromDiscord<pmunch> Yeah same
11:35:36FromDiscord<pmunch> Which is strange considering it's used just above that
11:36:01FromDiscord<pmunch> I think it might be a generics issue
11:36:21FromDiscord<pmunch> Tried putting it in a template and the error changed
11:37:19FromDiscord<pmunch> Yeah, if you do Option[int] and return type int it works.
11:37:27FromDiscord<pmunch> So definitely a generics issue
11:43:52*coldfeet joined #nim
11:49:47FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=gkIwXqAQrFfD
11:50:11FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=yPpDLohWSEtv
11:50:41FromDiscord<ieltan> Fwiw, `fusion/matching` is a unmaintained package
11:50:53FromDiscord<aintea> oh
11:50:58FromDiscord<ieltan> Nobody touched it since like ages ago like 4-5 years?
11:51:10FromDiscord<aintea> Then why is it in the nim options docs
11:51:12FromDiscord<aintea> (edit) "Then why is it in the nim options docs ... " added "?"
11:51:40FromDiscord<ieltan> Imo it's a oversight and it should be removed from the docs 😅
11:51:48FromDiscord<aintea> If it hasn't been touched in years, it makes sense it's breaking everything
11:52:02FromDiscord<aintea> What's the best way I can match on options then ?
11:52:45FromDiscord<aintea> Except if is_some
11:52:59FromDiscord<aintea> (edit) "is_some" => "isSome"
11:53:01FromDiscord<ieltan> There are some libraries that does it better and are more up to date on nimble
11:53:12FromDiscord<ieltan> Lemme check on my computer cause I'm on my phone
11:53:47FromDiscord<aintea> I will don't worry
11:53:50FromDiscord<aintea> thanks for the answers
12:15:16FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ldpbyfDEwuWa
12:15:26FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=YZUlUjQrxIIa
12:15:29FromDiscord<nocturn9x> _cool_
12:25:13FromDiscord<ieltan> In reply to @nocturn9x "so apparently this line": #internals, ideally with your types
12:25:38FromDiscord<nocturn9x> wish I had the time to delve into that now, might do that this evening
12:25:39FromDiscord<ieltan> I'd say though you shouldn't need the `[]`?
12:25:49FromDiscord<nocturn9x> it's a ref type
12:26:06FromDiscord<nocturn9x> iirc `==` compares pointers for refs?
12:26:36FromDiscord<ieltan> Yeah you're right
12:26:47FromDiscord<nocturn9x> that's not what I need, I need value equality
12:27:01FromDiscord<nocturn9x> hence the deref
12:27:16FromDiscord<ieltan> Yeah that makes sense, my bad
12:33:11*coldfeet quit (Remote host closed the connection)
12:42:16*ntat quit (Quit: Leaving)
12:45:18*def- quit (Quit: -)
12:46:25*def- joined #nim
12:50:43*krux02 joined #nim
13:18:50FromDiscord<wileycoleman> In reply to @isofruit "I'm not aware of": Turns out owlkettle will probably work better for me anyway.
13:20:31*SchweinDeBurg joined #nim
13:22:54*MacDefender quit (Read error: Connection reset by peer)
13:38:23*def- quit (Quit: -)
13:38:51*ntat joined #nim
13:40:05*def- joined #nim
13:43:56*def- quit (Client Quit)
13:44:08*def- joined #nim
14:25:20NimEventerNew thread by thegraynode: Introducing nginwho - An nginx log parser, Cloudflare IP restorer, and untrusted traffic blocker, see https://forum.nim-lang.org/t/11505
14:37:38*xet7 quit (Ping timeout: 268 seconds)
14:50:08FromDiscord<pmunch> In reply to @wileycoleman "Turns out owlkettle will": Otherwise Futhark also works to wrap Gtk
14:50:30FromDiscord<pmunch> I've done it for my Markdown editor project
15:08:11FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=QYipHTkGUtNm
15:08:33FromDiscord<zumi.dxy> (edit) "https://play.nim-lang.org/#pasty=aninNTnFUAEB" => "https://play.nim-lang.org/#pasty=YlolNrjULqtM"
15:08:44FromDiscord<pmunch> Sure
15:10:00*ntat quit (Quit: Leaving)
15:11:06FromDiscord<pmunch> https://play.nim-lang.org/#pasty=HCGOSIznAgoW
15:11:22FromDiscord<pmunch> Pardon the formatting, the playground doesn't do mobile well..
15:12:24FromDiscord<pmunch> For more tricks like this: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html
15:16:38FromDiscord<zumi.dxy> oh dayum, that's handy
15:20:10FromDiscord<pmunch> Yup
15:20:58FromDiscord<pmunch> It ensures that all branches return something, or returns/throw an exception.
15:21:05FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=CpUEhXOIcFaW
15:21:20FromDiscord<the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=JvdCULafVElg" => "https://play.nim-lang.org/#pasty=BNvZAxPZaATm"
15:22:32FromDiscord<the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=mgNyGMskYyxr" => "https://play.nim-lang.org/#pasty=ymeFIWbiouBN"
15:23:04FromDiscord<pmunch> In reply to @PMunch "Like, this feels wrong": And you can stuff is pretty much anything in thero
15:24:17FromDiscord<pmunch> (edit) "is" => "in" | "thero" => "there"
15:24:46FromDiscord<pmunch> @zumi.dxy ^
15:25:22FromDiscord<zumi.dxy> I already knew that it works with `if` and `case` but↵even `try` works 🤔
15:26:36FromDiscord<zumi.dxy> some refactoring may be in order then 😄
15:29:15FromDiscord<the_real_hypno> No one? Sad.↵↵Anyway: above example shows when using "return" is necessary
15:31:54FromDiscord<pmunch> @the_real_hypno I have no idea what you meant. Was that a question for help?
15:32:29FromDiscord<pmunch> In reply to @zumi.dxy "I already knew that": Works with all the block statements
15:32:33FromDiscord<the_real_hypno> I wanted to ask one about my problem but figured out myself while writing it down here
15:33:08FromDiscord<pmunch> You can even do `let x = block:...`
15:33:10FromDiscord<the_real_hypno> But i thought its a good example for when using "return" instead of result is a good thing
15:34:15FromDiscord<zidsal> And my take away after reading that article is that the p in pmunch stands for Peter
15:34:20*ntat joined #nim
15:34:25FromDiscord<pmunch> Ah right, yes return is good for control flow
15:34:40FromDiscord<pmunch> In reply to @zidsal "And my take away": Haha, correct
15:35:28FromDiscord<the_real_hypno> Its even necessary in that example because i allocate a newSeq[char](size) it jumps into the next branch
15:35:50FromDiscord<the_real_hypno> (edit) "Its even necessary in that example because ... i" added "since"
15:36:42FromDiscord<the_real_hypno> And somehow the T is typeof(seq) happily accepts my created sequence
15:37:14FromDiscord<the_real_hypno> Or probably the else
16:16:08*pmp-p quit (Ping timeout: 260 seconds)
16:32:26*krux02_ joined #nim
16:34:53*krux02 quit (Ping timeout: 240 seconds)
16:54:38*xet7 joined #nim
17:14:22FromDiscord<wileycoleman> Is there a simple library that will let me clip rectangular sub images from a larger image file? I have a jpg file that contains the tile surface images for my game. I was looking at Pixie but don't see this capability in the docs. I would like to pluck the individual tile images off and perhaps put them in an array.
17:14:45FromDiscord<wileycoleman> (edit) "Is there a simple library that will let me clip rectangular sub images from a larger image file? I have a jpg file that contains the tile surface images for my game. I was looking at Pixie but don't see this capability in the docs. I would like to pluck the individual tile images off and perhaps put them in an array. ... " added "Ultimately I would use them like this pixbuf: Pixbuf = loadPixbuf("./cereal.jpg")"
17:16:03FromDiscord<wileycoleman> (edit) "loadPixbuf("./cereal.jpg")" => "loadPixbuf(onetileimage) then put this in a picture inside a box or button."
17:16:26*xet7 quit (Remote host closed the connection)
17:21:47FromDiscord<pmunch> SDL would probably work
17:22:25Amun-Raplus SDL_image
17:27:05*rez joined #nim
17:49:10*pmp-p joined #nim
17:54:32*coldfeet joined #nim
18:02:42*bomb quit (Remote host closed the connection)
18:02:50*bomb_ joined #nim
18:07:24*rez quit (Quit: much snoozes...)
18:11:12*bomb_ is now known as bomb
18:21:27strogon14wileycoleman: you can do that with pixie. the documentation is just not very clear about it. You can use masks for cropping images and ImagePaints for copying between image objects.
18:21:27strogon14https://play.nim-lang.org/#pasty=FMyLLUzdKyuY
18:22:09strogon14You can somehat infer that from the tutorial: https://github.com/treeform/pixiebook/blob/master/tutorial.md
18:25:46FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=ZeKfVCRtgAuk
18:26:18FromDiscord<user2m> (edit) "https://play.nim-lang.org/#pasty=zyRxRISsACGP" => "https://play.nim-lang.org/#pasty=fYdrFvMgmRmw"
18:26:18FromDiscord<Phil> sent a long message, see https://pasty.ee/KDeUkuDtPDVX
18:26:25FromDiscord<Phil> I can't really know how many nodes there will be along the way
18:28:34FromDiscord<Phil> The Problem that I see here given nim's static type system is that each Node needs a ref to its parent.↵However, if you have a ref to the parent, you'll also need to contain all of its generic types. Which means your type needs to have all of its generic types and may include another one of its own. And that just stacks along the way
18:28:59FromDiscord<Phil> (edit) "The Problem that I see here given nim's static type system is that each Node needs a ref to its parent.↵However, if you have a ref to the parent, you'll also need to contain all of its generic types. Which means your type needs to have all of its generic types and may include another one of its own. And that just stacks along the way ... " added "as each node might introduce a new generic type or rather you must assume that e
18:29:35FromDiscord<Phil> ... maybe I should ask this in the forum
18:33:04*bomb quit (Remote host closed the connection)
18:39:47FromDiscord<Elegantbeef> Turn it all into closure procedures 😄
18:40:16FromDiscord<Phil> I can't even conceptualize what that would look like
18:40:43FromDiscord<Elegantbeef> Closure generators that capture the data and return a value
18:41:36FromDiscord<the_real_hypno> Is there a way to determine the needed size of a variable inside a sequence which hasnt been specified?↵↵Like, if i do [0x90, 0x90, 0x90] be it array or sequence, its always 3x sizeof(int)
18:41:51FromDiscord<the_real_hypno> while i personally would have expected uint8 so 3x3
18:42:32FromDiscord<Elegantbeef> `0x90u8`
18:42:37FromDiscord<the_real_hypno> or can i possible reject the given values if they have been guessed by the compiler?
18:42:47FromDiscord<Elegantbeef> The first one tells the rest how to type
18:42:50FromDiscord<the_real_hypno> In reply to @Elegantbeef "`0x90u8`": yes but im not on the "writer" side
18:43:03FromDiscord<Elegantbeef> What does that even mean
18:43:54FromDiscord<the_real_hypno> Well, im working with memory writing and reading and try to make it as convienient and secure as possible. And i can see a user doing exactly this: [0x90, 0x90, 0x90]
18:44:07FromDiscord<the_real_hypno> And that would harm, which it shouldnt
18:44:25FromDiscord<Elegantbeef> So write a proc that takes `var openArray[byte]`
18:44:31FromDiscord<Elegantbeef> Though why would the above be an issue?
18:44:48FromDiscord<Elegantbeef> `sizeof(mySeq[0]) mySeq.len` works just fine
18:45:09FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=xTLXArXqIIng
18:45:19FromDiscord<the_real_hypno> but this: ↵ [0x90, 0x90, 0x90]
18:45:26FromDiscord<the_real_hypno> is not uint8
18:45:28FromDiscord<the_real_hypno> its int
18:45:30FromDiscord<the_real_hypno> so its 8
18:45:33FromDiscord<Elegantbeef> or `sizeof(theArray)`
18:47:14FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=mOOCmWMyLYzj
18:47:20FromDiscord<the_real_hypno> 8↵4↵32↵5
18:48:09FromDiscord<the_real_hypno> So i guess since you dont see my problem its probably me doing something wrong 😛
18:52:22NimEventerNew thread by Isofruit: How to implement a generic arbitrary node-graph with unknown number of generic types?, see https://forum.nim-lang.org/t/11506
18:54:50FromDiscord<Phil> In reply to @Elegantbeef "Closure generators that capture": I may just be too mentally dead to imagine how that'd look like, apologies
19:05:38FromDiscord<Elegantbeef> @the_real_hypno you're using `if` not `when`
19:05:59FromDiscord<the_real_hypno> oh my god
19:06:20FromDiscord<the_real_hypno> Thanks, you saved me from a lot of hacky boundary checks
19:07:01FromDiscord<Elegantbeef> Also `T is openArray` I don't think will pass
19:07:18FromDiscord<Elegantbeef> Unless you do `myProc(myArg.toOpenArray(a, b))`
19:08:21FromDiscord<the_real_hypno> It took `seq[array[3, int]] = @[[1, 2, 3], [4, 5, 6], [7, 8, 9]]`
19:08:31FromDiscord<the_real_hypno> but i didnt try something else
19:09:01FromDiscord<Elegantbeef> Right but `assert [1, 2, 3] isnot openArray[int]`
19:09:28FromDiscord<Elegantbeef> `openArray` is not a generic typeclass it's a type containers implicitly convert to
19:10:36FromDiscord<the_real_hypno> I think its even useless to check for openArray type right? As far as i know `if typeof(T) is seq:` already gladly accepts array
19:10:37FromDiscord<the_real_hypno> (edit) "array" => "arrays"
19:10:51FromDiscord<Elegantbeef> No it does not accept arrays
19:11:11FromDiscord<Elegantbeef> `assert [1, 2, 3] isnot seq`
19:11:45FromDiscord<Elegantbeef> Really what you're doing seems best to be done by an intermediate proc
19:11:55FromDiscord<Elegantbeef> Have a proc that does your operations but takes in `addr, size`
19:12:25FromDiscord<the_real_hypno> yes that would have been my next attempt: One proc that can get feed everything
19:12:29FromDiscord<the_real_hypno> and the rest i will define
19:12:38FromDiscord<the_real_hypno> (edit) "yes that would have been my next attempt: One proc that can get feed everything ... " added "(which doesnt get exported)"
19:13:04FromDiscord<the_real_hypno> Or wasnt that what you mean?
19:13:08FromDiscord<the_real_hypno> im open for ideas!
19:15:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RrVBtLQkrKnJ
19:17:28FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=SAqxBKcuDMUJ
19:18:19FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=SXuYvqGyVtcJ
19:21:07FromDiscord<.bobbbob> do I have to call randomize() once per thread or is doing it once globally at the beginning of the program enough?
19:22:05*def- quit (Quit: -)
19:30:31*ntat quit (Quit: Leaving)
19:38:45*def- joined #nim
19:42:27FromDiscord<Elegantbeef> @.bobbbob check if the global rand variable is a threadvar(it probably is)
19:47:38FromDiscord<polylokh_39446> doesn't seem to be: <https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/random.nim#L118>↵how can that be checked with a program?
19:47:54FromDiscord<Elegantbeef> Then you need to init it once
19:48:07FromDiscord<Elegantbeef> Create two threads and check if the address of `state` is the same
19:50:57FromDiscord<Elegantbeef> For example https://play.nim-lang.org/#pasty=HpKWbRRFoDQr
19:53:27FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=dUGsoELeveIb
19:57:07FromDiscord<Elegantbeef> QED https://play.nim-lang.org/#pasty=XxIWVJPCpSlD
19:58:28FromDiscord<polylokh_39446> cool, thanks
20:01:33FromDiscord<wileycoleman> In reply to @strogon14 "You can somehat infer": Thanks that makes sense now!
20:31:06*coldfeet quit (Remote host closed the connection)
20:43:03FromDiscord<wileycoleman> sent a code paste, see https://play.nim-lang.org/#pasty=pzUIkdFlLhcC
20:43:46FromDiscord<wileycoleman> Image doesn't work obviously.
20:43:52FromDiscord<Elegantbeef> You load the image into a pixbuff
20:44:14FromDiscord<wileycoleman> how please?
20:45:24FromDiscord<Elegantbeef> There is the Picture example
20:45:24FromDiscord<Elegantbeef> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/examples/widgets/picture.nim#L178
20:45:56FromDiscord<wileycoleman> (edit) "please?" => "to display a picture with a pixbuf. I can't figure out how to convert an in memory image object to a pixbuf."
20:47:09FromDiscord<wileycoleman> In reply to @Elegantbeef "https://github.com/can-lehmann/owlkettle/blob/3c08d": Yes I saw that example, what is missing is how to plug in an in memory image object...
20:51:08FromDiscord<Elegantbeef> `newPixBuf`
20:51:42FromDiscord<Phil> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/owlkettle/bindings/gtk.nim#L545 ↵One of these might do the trick
20:54:57FromDiscord<Phil> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/owlkettle/widgets.nim#L648↵↵Never mind we have some higher level wrappers
20:57:43FromDiscord<wileycoleman> I will try this later, its seems rather complicated versus loading from a file.
20:58:43FromDiscord<Phil> I will admit it's only mildly higher level than the GTK API itself and that's really not centered around image stuff
21:43:32NimEventerNew thread by Phyton: Compilation Problem: "Error: cannot open C:\..\..\..\lib\system.nim", see https://forum.nim-lang.org/t/11507
22:27:27FromDiscord<can.l> In reply to @wileycoleman "I know how to": You need the overload with a `data` argument: https://github.com/can-lehmann/owlkettle/blob/main/owlkettle/widgets.nim#L660 Not sure if this is helpful, but here is an example where I use newPixbuf to convert the contents of a cairo context to a Pixbuf: https://github.com/can-lehmann/Graphing/blob/main/src/graphing.nim#L977-L982
22:33:10FromDiscord<Elegantbeef> @can.l before I delve into the docs does gtk have a constructor that includes stride?
22:33:29FromDiscord<Elegantbeef> Ah it does I see from phils
22:33:36FromDiscord<Elegantbeef> I should click links 😄
22:34:10FromDiscord<can.l> In reply to @Elegantbeef "<@893965307171979326> before I delve": Maybe rowstride: https://docs.gtk.org/gdk-pixbuf/ctor.Pixbuf.new_from_data.html
22:34:47FromDiscord<Elegantbeef> If that was exposed you could do `cast[ptr UncheckedArray[int8]].toOpenArray(0, len - 1)` and supply `stride = 4` without copying
22:35:24FromDiscord<Elegantbeef> Wait nevermind that's row stride
22:35:24FromDiscord<Elegantbeef> Ugh
22:35:44FromDiscord<can.l> In the graphing app?
22:35:54FromDiscord<Elegantbeef> Yea
22:37:05FromDiscord<can.l> The issue is that on little endian systems, the channel order is exactly oppsoite of what it needs to be 😐
22:37:18FromDiscord<can.l> (edit) "oppsoite" => "opposite"
22:37:55FromDiscord<Elegantbeef> Right, the GTK api should specify order aswell, shame
22:38:29FromDiscord<can.l> Yeah, this should be part of https://docs.gtk.org/gdk-pixbuf/enum.Colorspace.html
22:38:33FromDiscord<Elegantbeef> Should specify order, stride and rowstride to allow loading just `r` from `rgba` or `argb`, ....
22:38:36FromDiscord<can.l> i.e. there should probably COLORSPACE_BGR
22:38:41FromDiscord<can.l> (edit) "i.e. there should probably ... COLORSPACE_BGR" added "be"
22:39:26*nyeaa49284230101 quit (Quit: The Lounge - https://thelounge.chat)
22:41:56*nyeaa49284230101 joined #nim
22:43:38FromDiscord<can.l> cairo also does not have it... https://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
22:43:38FromDiscord<Elegantbeef> I guess even opengl's `glTexStorage` do not have what I mention
22:43:39FromDiscord<Elegantbeef> Equally simple
22:43:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=dDXeyahBpcda
22:43:39FromDiscord<Elegantbeef> Wait that's the wrong proc I realise
22:43:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=FwohqEGtbJwE
22:43:43FromDiscord<Elegantbeef> There we go
22:43:43FromDiscord<Elegantbeef> There's no way to only upload the `r` channel of a texture in opengl aswell so I'm probably living in a pipedream world 😄
22:43:57FromDiscord<Elegantbeef> Opengl does have BGR
22:44:11FromDiscord<can.l> Huh, the bridge just glitched...
22:44:26FromDiscord<can.l> I did not receive all your messages until now.
22:44:34FromDiscord<Elegantbeef> It does that occasionally
22:44:37FromDiscord<can.l> (edit) "I did not receive all your ... messages" added "related to opengl"
22:44:48FromDiscord<can.l> (edit) "I did not receive all your ... related" added "messages" | removed "messages"
22:44:54FromDiscord<Elegantbeef> One day someone can write a proper bridge using my matrix API 🙂
22:45:45FromDiscord<Elegantbeef> In the meantime everyone should use matrix!
22:47:36FromDiscord<can.l> 😄
22:56:20FromDiscord<wileycoleman> sent a code paste, see https://play.nim-lang.org/#pasty=LoPLJfgYdzYr
22:57:41FromDiscord<wileycoleman> However since I want to load a whole lot of these images, it seems inefficient to keep loading from the file every time. I was hoping to load once then crop from that.
23:01:05FromDiscord<Elegantbeef> cache the image then crop it
23:04:27FromDiscord<can.l> You can use an `afterBuild` hook, if you want to assign multiple fields of a viewable based on a common `alltiles` pixbuf: https://can-lehmann.github.io/owlkettle/book/internals/hooks/after_build_hook.html
23:04:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BSsjNmBMbUXs
23:06:44FromDiscord<Elegantbeef> That code expanded will cache all pixbufs you want, including crops of crops
23:06:59FromDiscord<Elegantbeef> Just draw the rest of the owl
23:07:45FromDiscord<Elegantbeef> Though I might be in too deep since i've been caching everything I can for my present project
23:08:03FromDiscord<can.l> sent a code paste, see https://play.nim-lang.org/#pasty=cHcPbUEVbWmw
23:08:44FromDiscord<wileycoleman> Thanks! I will dig into this more later on. I appreciate all the help from everyone.
23:08:53FromDiscord<Elegantbeef> In hindsight I could suggest my kashae 😄
23:09:25FromDiscord<Elegantbeef> `proc loadCachedImage(img: ImageEntry) {.cached.}` would be all that requires 😄
23:09:36FromDiscord<Elegantbeef> Though it of course would always load `path` before cropping
23:13:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=tdqwgpsKYgJI
23:13:48FromDiscord<can.l> oh neat
23:29:46*rez joined #nim
23:42:38*rez quit (Quit: l8r)