 All right. Hello everybody. My name is Tim and I go by Fome Guy on the GitHub and Discord. This is going to be the deep dive program So happy Fridays. First of all, we made it through another week together. This has been a pretty good one for me I hope everybody had a good week. Hope everybody has a good weekend coming up I have some fun Friday night Saturday do whatever kinds of things you like So the deep dive program for those that might be new or don't know We're going to be working on circuit python development So circuit python you can learn more at the website right here circuit python org This is basically an implementation of Python that runs on some tiny computers called microcontrollers There's a bunch of pictures of them on this page here So one thing that you can see is there are lots of different shapes and sizes of these microcontrollers some of them have Different peripherals like built-in screens. Some of them have are very small and don't have too many pins Some of them are larger and have lots of pins. Some of them are very basic But also have lots of pins and are very cheap made by the Raspberry Pi company there Some of them have built-in keys. So all different shapes and sizes of these things and we're running Python code on these In order to interface with the other hardware that's connected So, you know, it can connect up to the RGB LEDs can connect up to little speakers, you know buzzers beepers buttons switches, you know knobs like potentiometers and rotary encoders Any kind of little Electronical widget we can connect up with these microcontrollers and then use our Python code to interact with it to you know Know when the buttons get pressed and know when the switch gets flipped to know when the keys are pressed You know the keyboard keys to draw stuff on the screens You know e-ink screens we have as well so you can draw stuff on there and they it stays showing even when the power is taken away so lots of different things that you can do with these and Circuit Python is a project all about making it super easy to write programs that run on these microcontrollers So that's kind of the the high-level thing that we'll be looking at More specifically what I'm going to dive into is the display stuff So more like this device here where it has a built-in display And we're going to work on some stuff related to drawing things on the screen Specifically, I'm going to work on some bitmap tools examples Let me catch up on the chats here real quick. So Beata, how's it going? Happy Friday. Oops. I have the microphone just barely in frame. Don't I let's scoot that just a tad Let me Let me pull up all the chats here. Happy Friday, Tammy. How's it going? See Grover Paul. Happy Friday. How's it going? Thanks for tuning in everybody Yeah, let's see if we can be that markers red that'll give us a Little bit of extra space there. We can see some of the messages so Bitmap tools actually let me also finish up the introduction here. So let's hide this one more thing So yeah, the circuit Python project. This is what we're going to be working on I'll be diving into bitmap tools Which is a particular way of drawing things on the screen a particular way of manipulating images in order to draw them on the screen The circuit Python project though is open source. So anybody can find the project and contribute to it There is a contributing link at the top here So if you do go to circuit python.org and you go to the contributing page This is going to list all the open pull requests and all the open issues And especially the open issues are helpful if you're brand new to the project and you just want to start getting involved Inside the open issues. There is a filter called good first issue, which is where we put stuff that is good For folks that don't have a lot of experience yet or haven't you know necessarily contributed anything to the project before So if you do want to get involved, you can head over to circuit python.org contributing Also, join us on the discord which is linked down below on the screen there a da fru.it Slash discord that channel and collaborate throughout the week about all things circuit Python development related If you just like the project and you want to help support it But you don't necessarily want to get involved in development That is cool, too The way you can do that is by heading over to Adafruit.com and purchasing hardware from them So Adafruit is a hardware and software company based out of New York in the United States They are the company that pays the team that works on circuit python So they pay some folks who work on the team full-time They pay other folks who work on the team part-time such as myself And they are the ones primarily funding the circuit python project So it's an open source project that anybody is allowed to use anybody is allowed to contribute to to modify To do whatever they want with Adafruit funds it by paying the people who work on it So if you want to help support us you can purchase hardware from Adafruit And of course that will help out Definitely all of us that do work on the project do absolutely appreciate that So let me catch up on the chats again lance evil productions Did you use make unity tutorials or something years ago? You kind of remind me of a guy that worked on an indie game I I did not make any unity tutorials I did some android tutorials on youtube like way way way back many years ago And then other than that most of the stuff that I have released is newer circuit python related stuff I don't think there were any game ones in there But I don't remember for sure But definitely not unity if it was because I've never done anything with unity Charlie likes goflourages. How's it going? Hello? Um, all right. So more specifically what I'm getting into today is bitmap tools So, uh, for anybody who doesn't know bitmap tools is a core module That means it's a module that's available inside the core of circuit python It doesn't require any library in order to use it Uh, and it is a module that's basically all about modifying bitmaps in various ways manipulating, uh, bitmaps Um, so there are a couple of different things we can do with it I'll be making some examples that show some of them There are a couple examples that I actually made for this last night So I'm kind of picking up where I left off last night So if the kind of stuff I'm working on today is interesting to you One of the things you can do is head Over to my youtube or my twitch and you can catch yesterday's uh stream from last night where I worked on a very similar Type of thing examples for this bitmap tools. Um, I'll also link it here bitmap tools These are the ones I created last night. There was one for Rotating images and there's one for rotating images, uh, animated. So it will just keep, uh, spinning over and over again Um, and there's also a preview of this I can show. So if you want to see what I'm talking about, you know, if you're a visual person Um, and you want to see what I'm talking about without running it There are a couple examples on here. So, uh, we loaded up our image our bitmap image in this case It's billy the blue led And then we're able to rotate billy, you know, 90 degrees to the left there And draw a new one sideways and then the animated one is this one where billy just spins around and around and around in a circle There, uh, which is kind of fun. So these are a couple examples that I created yesterday And we're going to work on some more today That do other various interesting things with bitmap Excuse me bitmap tools looks like where you spelled that wrong. So that's probably not going to help us find anything I'll also erase this. I actually Think I bookmarked this other, uh, index. Oh, nope too slow. Okay. We'll go this way I think I bookmarked an index page that sometimes I'm quicker at finding stuff on Um, so bitmap tools, here's the docs for it. Um, and again, there's a bunch of different functionality in this so far The function I've been focused on is roto zoom, uh, but there are also others like alpha blend right here This one's dealing more with I think merging two Two images together, uh, you know, sort of transparency wise like You know putting one on top of the other but you know, they're both partially transparent or something um Fill region. This is for filling in rectangles inside of a bitmap with a certain color very efficiently Uh boundary fill this one, uh, this one I actually worked on this one is like a paint bucket fill so you can, um You know, you choose a pixel and then it will like Fill in that pixel and all the surrounding pixels with a certain color And it'll keep like filling outwards until it runs into boundaries. So it'll like fill up any enclosed space With a certain color, uh, and again, all this stuff happens inside a bitmap object Which you can then of course show on the screen, you know using a tile grid On a group just like any old, you know display IO object There's a draw line. So this one will help you draw a line from point A to point B Uh or more specifically from point x1 y1 to point x2 y2 Um, you can make it whatever color you want. I think by using value there. That's kind of a neat one draw lines Uh a ray blit. I'm not actually familiar with this one. This is I think something taken out of uh Arrays maybe like u-lab arrays micro lab Maybe taken data out of there and uh pushing it into a bitmap Uh not actually a hundred percent certain on that one read into reads from a binary file into a bitmap So this would be like loading a bitmap from a file into memory It's like what that one is for Uh dithering function. So dithering is a type of image manipulation. I think it's I don't know exactly the technical definition of it I think it's like making the edges Making the edges sharper or maybe making the edges less sharp Um, I don't know that'll be one I'll be interested to look into and play around with some so Basically bitmap tools does all these things but this page right here is basically the main and only page where I believe at least where it's kind of documented and there aren't many examples Throughout the code So i'm trying to write some examples that we could add to the documentation here We can add them to the repo, uh, which I linked just a moment ago in the discord there Um, and this way, you know, maybe we could add them to a learn guide eventually this way There will be more examples. Um, and you know better resources for people who want to use this core module Um, so that's what i'm up to. Uh, I'm sticking with roto zoom still because roto zoom it turns out is very Very versatile. It can do a lot of uh interesting and different things So I've only scratched the surface. Uh, so far with the two examples. I've done we have lots of room to cover That we can still do with roto zoom. So that's where we're getting going right here. I'm going to plug in my pi portal We're going to go to the camera And I think it should be running one of these. Yeah, this one's running the the angle the 90 degrees or yeah 90 degrees to the left there Um, so we've got one billy. This is the source bitmap billy So this one got loaded from a file on the circuit pi drive And then this bitmap over here. I just created that bitmap in code and then I pasted that Rotated billy inside of it using the roto zoom function Um, let's pull up codepi here. Let's close all these things for now. We might as well. Oh, actually, this is not device workspace We're not going to have a codepi in here Uh, we can close this one. We can open Device workspace. Let's do that new window. Yep Okay All right, so let's close a couple of these. So billy is my bitmap. This is the bmp. This is a regular role Well, not regular. It's an indexed bmp, you know any kind of bitmap that display ios supports um All this functionality will work with any of those bitmaps. I'm just using billy because it was available. I had one It's uh, relatively small so it doesn't take up a lot of memory And we can, you know Manipulated in various ways to see what all the different functionality does Um, so I'll start by doing a quick sort of once over of this one for anybody Um who didn't catch last night's stream and wants to see what this one is I won't necessarily pick through it meticulously because you can watch along with the vod from yesterday to see that But then we'll move on and do some newer ones Um, so quick rundown of how this works for rotating an image We've got our imports up here. You know, we need our imports for like bitmap tools We need display io We need math because we need to convert from Degrees to radians, uh, although I guess if you You know think in radians then you could just use those Uh, personally for me, I tend to when I'm thinking about angles. I always think in degrees so We use math module Down lower a little bit to convert from degrees to radians because that's what the function expects is radians Uh import board so we can access the display imports image load So we can load the bitmap file into memory Uh, you know, just grab the built-in display. I'm using a pie portal. So we're just going to have board.display like normal We're going to load up the billy bmp. So I saved it on my circuit pie drive in a file called billy dot bmp It's just in the root of the drive right over there We're going to load it up with ater fruit image load. We get the Bitmap object we get the palette object from that Once we have our bitmap and our palette object We can then create a tile grid if we want to show the source bitmap on the screen, which in this case we do We elected to so this one here on the left is the source bitmap Now that as optional you could choose not to show the source bitmap on the screen and that's fine as well But in this case, I did go ahead and show it. So we have a tile grid for it We give that tile grid the source bitmap in the source palette This one we're going to now create a destination bitmap object. So we create a new bitmap We're giving it a height and width in this case. I took the height of the source bitmap, which is billy. So that's 41 by 92 I took the height 92 and I Squared that so I made my new bitmap 92 pixels by 92 pixels And then the number of colors that that bitmap is going to have that's the third argument here The number of colors is going to be the same number of colors. That's in the source palette Create a tile grid so we can show the destination bitmap This is where we're calling the actual roto zoom function So this is the one that does the actual rotation for us. We give it the destination bitmap We give it the source bitmap. We tell it the angle we want it to rotate in this case It is 270 degrees Because it goes clockwise. So, you know, we start up here, you know north 12 o'clock on a clock 170 degrees means we're going all the way around here pointing towards the left basically We do need to convert that to radians to pass it to angle And then that's the argument that goes inside roto zoom and actually does the the turning for us For the destination tile grid. I just gave it a, you know, a bigger x there a 100 x in order to scoot it over to the right That way we have Source bitmap on the left destination bitmap on the right Create a group so we can show it on the display Put both of our tile grids in the group and then of course show the group on the display And then with any display i o project you need to put that loop forever Otherwise when it finishes, you know, it will just go back to the repel and you'll no longer be able to see your stuff So we loop forever there that way we can keep seeing our images on the display So that's the basic functionality of rotating an image The next one i'm going to do i think is scaling an image So i'm just going to start editing this file. I think use bitmap tools roto zoom to scale Scale a bmp image Because this also can do scaling for us. So we're going to have Mostly the same setup here but on our Roto zoom call instead of angles we are going to say I think it's actually just scale Yep scale We are just going to say scale and uh, I don't know do we want to go bigger or smaller? Well, we can't really I mean we can like roto zoom will allow us to go bigger But if we go bigger We would actually need to make The destination bitmap bigger or else we would not be able to fit The entire thing um Maybe we should do one smaller and one bigger I like that idea. Let's do one smaller and one bigger. So Let's make our source bit. I mean, excuse me. Let's make our destination bitmap Bigger than the height of the source bitmap Because we want to have more room to be able to scale up billy to a higher A bigger size. So let's say instead of just height and height Maybe we'll call it Times two. Uh, just give ourselves like double the amount of room in both orientations We'll see if that's too big or something. Um You know, we can always tweak it down if we need Give it the old format there another little trick I'm going to do is dest bitmap dot fill and I'm going to tell it to fill the bitmap with the one color Which in my case Happens to be a white color I happen to know because I looked at the palette yesterday And the index the the color that is at index one is one of these white ish colors So I'm going to fill the destination bitmap with ones, which means it's going to basically Color in the background of it with ones, which means we'll be able to see The rectangle that it occupies on the display a little bit easier What's my red? Oh, we put scale here and we didn't ever fill it in. Let's just do 1.0 for now And then of course we'll go and change that To a different size here. Okay So that is how much room we have the white box is our destination bitmap That's nice and big. We got plenty of room that we could scale up billy And show two copies of billy as well one small one and one big one So I'll go ahead and undo the fill because we don't necessarily want that in the finished example But it was helpful to see the size of my bitmap there And just get a visual look at You know what actual size it is. Of course, I know it's 91 pixels times two, but like You know, it's easier to tell what that means when you look at it on the screen kind of um so let's um Let's see here. We should scale one up. I think uh I mean we have room to go all the way to double So yeah, I guess we should go to double or should we go to 1.5? So that it's clear that you can actually use fractions as well I think I actually like that. Um, I mean, I'm even gonna go 1.75. So You know a relatively unround number, uh, you know, so to speak, right this scale the cool one of the cool things about this Is that scale is not limited to integer scaling. So With display io with groups, for instance, uh groups have a scale property, right? Like you can do group dot scale You know equals two, right? This will scale things times two. They'll be twice as big Uh, but as far as I know, this has to be an integer. You can't just go You know scale dot, you know 1.5, right? This one doesn't work. Uh, I don't think um But with the scale inside the roto zoom we can use floats. So we I believe we can say something like this 1.75 Uh run that and there we go. Yeah, we have a new billy which is You know 175 of the size of the old billy. It's not quite double. Uh, you know, essentially Um, so now we've got a nice big one. Let's make a smaller one as well. Uh, maybe we'll do a half size one. So 0.5 Uh, and the cool thing about, you know, another cool thing about roto zoom I'm probably going to say a few more times the cool thing about roto zoom rest assured what I mean is Another one of the cool things about roto zoom because there are many many cool things about roto zoom But another one of them is that we can just keep pasting into the bitmap over and over again, right? We have one single destination bitmap. We can paste into that as much as we want You know, it has a limited size, of course So like eventually we'll be, you know pasting over the top of something else we put in there potentially Um, but we can paste as many times as we want and we're not making new bitmaps each time. So And we're not adding, you know, additional Objects to memory, which is kind of cool I'm going to actually put the fill back. I think let me go back fill this way we can See because we're going to tweak the placement of our big and our little billy. So Desk bitmap.fill we're going to go one call it white. Let's go back here Um, there's our white box. So right now, uh, big billy. I will call, um, this one for now big billy Big billy is perfectly in the center of the white box, which is the destination bitmap I think what I want to do is move big billy over towards the right of the white box. Um And the way we do that And you'll have to bear with me because again, I'm also sort of still learning about this roto zoom So I don't quite Have everything understood a hundred percent of the right way But I believe the way we're going to do that is by changing The o x value and the value that we want is going to be The horizontal pixel location in the destination bitmap where the source bitmap point px py is going to be placed Um, and so I happen to know because I looked into this yesterday Which actually that's another one of the things I'll do on the stream here today is go update this documentation page I happen to know that the default for these o x and o y and p x and p y Are in the centers of the respective bitmaps. Uh, so px and py that is in the center of the source bitmap Which in our case again is the standard billy And then the o x and o y represent a pixel location Within our destination bitmap the big white one and by default if we don't change them They represent the center of that as well So right now we have the center of our source bitmap Aligned with the center of our destination bitmap what we want to do instead is scoot the center Of the point that we paced into our destination. We want to scoot that point towards the right So I think what we need to do is make it something larger than half of The destination bitmaps width I want to try to align it to the right side That's a little bit fancier than we need to be but i'm gonna see if I can get the math right Uh, so if I wanted to align it to the right side, what I would need is basically the width of the destination bitmap minus the width of the Source bitmap times the scale times the scale that we used which is 1.75 I think because destination bitmap dot width would be the right edge Oh, but that's gonna align the center with the right edge So we don't want to come back a full width. We actually want to come back only a half width. So It's kind of weird, but we're gonna go source Bitmap dot width over Over two and then times the scale factor, which is 1.75 Yeah, I think that's what we want So if I understand this right and if I did the math right Our big billy should be right aligned the right edge of the big billy should be on the right edge of the white box Uh, but it's very possible. I didn't so let's see Okay, well, first of all, we can't convert float to end. What if we tried harder? I bet we could if we put our mind to it 35 Uh Okay, these are ints so we'll want to uh We'll want to go into this stuff And it will round it down It will truncate it. I think actually There we go. Oh, and I hit it. Look at that right edge of big billy is on the right edge of the white box Uh, we could also scoot the big billy up or down if we wanted you can see right now again It's it's centered so it was it was previously centered in both the x and the y now it is centered in You know the y the the vertical, uh, but now of course it's over to the right side in the horizontal Um, I think that's what I want though. So let's add a small billy into here. So we're basically just gonna roto zoom again I'm gonna format so this Is not a million miles long I'm gonna copy We're gonna make another one of these This is a little billy. I think it's actually ie, right? Yeah, it is Big billy And we're gonna want to change the the location here. Um, and of course the scale as well. We'll go down to Now let's go half. I think maybe we'll look at a quarter Be curious what a quarter looks like if it's still recognizable, but let's start with a half, uh, the location So by default again, it's gonna be in the center. What we want is I think I want to put it aligned with the left edge this time. So We are gonna use very similar math here, but instead of the width minus this thing, it will actually be zero Plus this thing Which is actually the same as writing just this thing And I think we have extra parentheses now Source bitmap width over two half of the width of the source bitmap and then times our scale which is now 0.5 on this one. Nice. There's our little billy Uh, and again, it's vertically aligned to the center. So it's You know halfway in the middle vertically of the yellow box um We want to leave it there I think I want to move it Uh partially Because I think well, let me take the fill out for one thing. I bet you it looks less weird without the fill Yeah, it totally does. Uh, but I also think I want I think I want them both at the top Yeah, I don't think I want them to float in the middle vertically. I think I'd rather move them both to the top So for That we're gonna use o y we used o x to change the horizontal location we're gonna use o y or as I like to call it oi to change the vertical location oi This one is going to be Very similar truthfully, uh, this is going to be another zero plus because we want to anchor it to the top Which is zero so we actually don't need to write zero plus of course Uh, we will want int we will want We will want, um Source bitmap height Over two we're gonna we want to come I want to come down by I want to go Above zero by half of the source bitmap height Times the scale, uh, maybe we should make scale into a variable and then Not hard code as many of them. I don't know if they're necessary, but I Like these parentheses format Okay, let's see if we got that right for big billy It looks like it i'm gonna turn the fill back on just to be sure This will make it easier to tell Yeah, all right, let's move little billy Uh, here we go oi int Honestly, I Think this one is the exact same Of course with the one difference being the scale is different so it won't be Point uh 1.75 instead it would be 0.5 and I think that that would work the same Indeed it does Maybe we honestly we maybe even have enough room for A medium one I mean, I guess we could put one in at regular size I am gonna do big billy scale equals 1.75 And then just reuse this 0.5 and so this All right, we made normal billy. We want to change the o x for normal billy Uh, I think actually o x we could just leave the default because centering it makes sense to me Maybe not. Maybe we go more to the left Yeah, it is centered, uh, but it would look better halfway between little billy and big billy Um, I don't know that I want to like calculate out the exact point that that is So I think I might just nudge it to the left some But of course we could like You know figure out the total size of the destination and subtract the size of the big billy and subtract the size of the little billy and then figure out The remaining size, you know halfway point, you know Factoring in the size of normal billy. We could figure all of that out. Uh, but I think we'll just I think we will just go int Let's go nice and easy. Let's just say desk bitmap dot width Over two Which is what it will start with and then we will just nudge it Minus 10. Let's say see what that gets us A little more. Let's turn the fill back off And try minus 20 Getting closer. We're real close. I think maybe 24 Again, it's not an exact science. If we wanted it exact, I would go do the math, but I think like this is pretty good Uh, we just put that Yeah, I'm pretty close to the middle um Yeah Do we want to keep the source billy? Maybe we should not have the source billy on this one Just to show that like you don't have to show it if you don't want especially since we do already have a normal size billy. So We don't necessarily You know, we we have two since we're showing the source Yeah, I think I'll uh, I think I'll hide the uh the source bitmap on this one. So um We can basically just not create a source tile grid if we want, you know, we don't we don't need to do that We can just not create it We don't add it to the group and boom doesn't show And we just have the destination So this is cool, too You can use roto zoom like you know, you can load up a sprite sheet and then Just like paste chunks out of it into your destination bitmap on your screen Uh and keep your sprite sheet in memory Of course, you never you know on a sprite sheet. You never really want to show the whole thing as one thing You always want to cut little bits of it out and Put them on the display like this. So um I think only other thing maybe let's not do a hundred x. Um, I don't know. Maybe let's just call it 1010 Give it a little bit of padding from the wall, but not a whole lot You know, that looks pretty good. I think Okay Let's fill in any comments on this one. We can take out this. Let's get it ready to put inside of that examples repo um The date the name roto zoom to scale a bitmap Uh, I guess we could be a little more specific scale a bitmap um See scale a bitmap image and show multiple Sizes of it On the display, uh, we're not using math on this one Because we don't have any angles You can mix and match this stuff too though. So like you can have, you know, big billy 1.75 scale You can also rotate it with angle on here. So You know, you can like take your image and put it in whatever, you know, size and shape and configuration you need Uh, which is, you know, makes this thing super powerful um I don't do we want to keep this whole explanation Yeah, I think so. I maybe even want to just add though roto zoom Takes from source bitmap Puts into destination bitmap. I don't know. There's probably a much better way to word this Looks like I was trying to be fairly concise, but it might Be better to be more descriptive or just more verbose rather like try to describe it better Because I mean, it's it's taking I mean, I guess in this case, it's taking the entire source bitmap Putting it into the destination bitmap Manipulated in various ways in our case scale and location Default values for x y locations. So that part's actually not true anymore Default values for the x y locations are not used Clipping is not used Clipping is not used So the whole source image is Put into the destination bitmap Angle argument. Yeah, we're not using angle argument So instead I think we'll say scale scale argument multiply the size of the Multiply multiply the size of the Source bitmap Times the scale factor source bitmap times the scale factor So then we've got our big billy our normal size billy and our little billy Move the Destination image tile grid Out of the corner Corner a little bit a little bit. What's wrong with a little bit? Reduce redundancy Okay, I guess I have no arguments And create the group to show the tile grids add the tile grids to the group in this case We are only showing one the destination one. So I guess we could go singular Add the group to the display loop forever so you can enjoy your image fairly capital Although it is apropos for a little billy to be a lowercase l isn't it a new line here It doesn't matter too much, but Well, it's still clear that this like more verbose description applies to all of these roto zoom Function calls here. All right, cool. So I think we take this code Make let's run it again. You know, I never did load up my uh serial today. Let's restart it. Just make sure it's looking good Yeah, and so now we can take this code. We're gonna put it into the example circuit python module examples This is a repo over in the circuit python org. It's got a bitmap tools folder. So we're gonna make a new one in here bitmap tools Scale emp multiple. Do we want to specify multiples? I think we'll just say scale bmp Maybe we should be saying roto zoom in the name of these I'd eventually change the names. We'll see This is gonna be in here It just uses the same billy so we don't need a new image for it The line at the end. Yeah All right, we're looking good there Make a branch Can you do animated zoom from small to large? Yes, you can. Yeah, you sure can. I'll uh, I'll show you an example of that here in just a minute Uh, check out. Let's call it Bitmap tools scale Trick python main node track Okay Let's push this one so we can create a pr from it. Uh bitmap tools rotate Bitmap tools scale example Yeah, I'll do a scale animated because I did rotate and I did rotate animated Um, so it makes sense actually to do a scale and a scale animated Uh, so we'll let's come back here. I think we will maybe only use one You know stamp of it. We'll just have one that grows big and small Uh, we'll Put it back in the center. I think of the destination bitmap I don't think we need to move it over to the side if we're only gonna have one Um, we will call this the I think current scale current scale And why don't we start it on one start it on one When we started on point five where we want to start it Yeah, we might as well. Let's start on point five. We can always tweak it later We go current scale here Uh 10 Yeah, that's fine 10 10 still We're not gonna be touching the top left edge of the destination target anymore So it's gonna feel farther away than that So let's draw it once There it is right now We just have a point five scale billy here and it's static Of course, it's not moving or doing anything inside of our loop down here. We will go for scale In range Should call this actually initial scale initial scale Realistically we could just hard code it, but I'll leave it for now for scale in range. Um I think I almost want to use ints instead of floats I think I could do something like range 0.5 You know 2.0 Count by point one You can do something like that. Maybe we'll give that a try actually Although I do think we're not, um It's not inclusive on the far end Right point five 2.0 0.1 We're floating it. I guess you can't do that. Okay Uh, so yeah, we have no choice for that. So instead let's go, uh, let's go from Let's go from five to 20 Counting by one, which is default And I that's actually gonna go from Actually gonna go from five to 19. I think is that right? So we'll go 21 because we want to get up to 20 Could you not start with the slider in the center so Small to the left and larger to the right Not sure what you mean. Sorry With the slider. I don't we don't have a Not sure what you mean by the slider. We can put it anywhere that we want though So we could put it on the left. We could put it on the right We could move it as we scale it, you know, we could make it so When it's on the left it's small and as it scales up it also moves towards the right Um, we could do all kinds of that stuff if that's if that covers what you're asking about. Sorry though I'm not a hundred percent sure For scale in range five to 20. We're gonna go We're gonna do two things. We're gonna go, uh Dest bitmap dest bitmap dot fill with zero to blank out the previous frame So that it's gonna basically Cover over whatever we drew last time And then we're gonna roto zoom again Inside here From desk to source scale is going to be scale over 10 Be 10, right? Uh, so this will loop from five to 20 Will basically mean this is going to scale from 0.5 to 2.0 Going by 0.1 scale. So, you know 10 percent each chunk we could change the numbers here to make it Smoother if we wanted we are gonna snap from 20 back down to five We could make another for loop going the other way. Let's just make sure it actually works before we get that far though Uh, huh rerun it Oh, yeah, look at that live Coming to you live and in action billy to led Billy billy billy But this reminds me of is like a monster truck thing or something I guess it goes with the slider widget you discussed a month ago, but no worries. Oh, okay the slider. Yeah, okay I do know what you're talking about. Sorry. I didn't uh Didn't think back to that one. You could yeah, you could that'd be a good example actually I think that one would go more probably as an example in the slider repo than the core module one, but you totally could set it up to where you have A slider and when you move the slider back and forth It changes the Size of the bitmap so billy in our case, right? You definitely could uh You could hook it up to do a slider with that both the on-screen slider like I was using Um, I was using a display. I owe widget slider. Let me use the other browser here Uh, you could also actually though if you wanted to go crazy with it You could use a physical slider too, uh, because there are like slider You know this kind of thing You could use one of these as well, uh and change the size of your bitmap with this which would be kind of fun too Uh, okay, so we're scaling up. That's doing pretty good. I I want a little bit better resolution and slow it down a bit. So instead of five to 20. What if we said, um Hmm What if we said Do we just add a zero and a zero and a 100? That's gonna give us more resolution, right? Okay, I'm gonna look away from the camera All right, it's getting pretty flashy at the big, uh It's getting pretty flashy at the big sizes actually Let me try without fill see what that looks like I will say to the camera here. This camera is not perfect. It doesn't necessarily keep up with it um So it is possible that there's like artifacts that we see on the screen here that are not necessarily actually on the pie portal screen Uh sometimes that does happen. This is kind of an interesting effect where new billy just comes out of the The middle there, but old billy is still there. Maybe what we could do is call fill after This is done looping since we're getting bigger each time We're gonna be overwriting whatever was In the previous frame anyway in this case so we could only fill afterwards Yeah, and if we wanted to go the other way so it would like I'll say bigger and smaller basically we could uh Just run this puppy in reverse although I think the bounds are probably different if we run it in reverse Because we would want to start on 200 Maybe we're going maybe we're going bigger than two. Maybe we're actually going to 2.1 Well 2.9, I guess 2.09 Maybe we should start on 2.09, which would be 209 And then down to it's I think it's uninclusive of this so I guess we're gonna want 49 instead of 50 That right when in doubt replica. Let's see what we get here print scale Uh gordy g right now you're scaling from 0.5 to 2.09. Okay You get that right. Yeah, and this one does go 50 so we do want 49 here Yeah, I think when I changed it to the hundreds I didn't account for the fact that we're gonna still go to 209 originally. We were going from 5 to 20 Um, but I got that extra resolution. I may still go back 100 might be too much. Maybe we could uh back it off some This will scale us down from the big size to the small size though We don't have the fill so I guess it's probably gonna They'll show us the big one Not quite exactly what I was thinking Very interesting It doesn't keep showing us the big one, but it does like smear the edges of it kind of there Does this like the outermost Bit of it Infability. Yeah Dexter, how's it going? Drive 50 201 and then 249 minus one I like I kind of like this effect. Actually, it looks like he's getting sucked into a vortex or something A black hole consuming Billy or something going on here We could call fill in between each time I suspect it's gonna start getting flashy if we do that again though This would remove the vortex effect, but probably make it a little bit blinky Yeah, you see there every every little bit there it starts kind of blinking on us Maybe we could make it better with I don't know if you can set that other than at the initialization Turn off auto uh auto refresh After you initialize the display Yeah, thank you I don't think we're We find anything with this Auto refresh is a property And it's boolean We can set it to false So after we show we could say display dot auto Refresh equal false. I don't know if this is actually going to make it better But it's maybe worth a try So we'll say we want to refresh Each time we scale up We want to refresh each time we scale down After we fill but we can do the fill and the scale down in one In one frame so to speak we don't refresh in between each of those this way Maybe it'll be a little less blinky Okay, so for one thing it's definitely slower But kind of a lot slower Personally we had kind of a spur of speed there Slower going well, okay. I guess that makes sense. It's slower going down Then it is going up, but that makes sense. I guess because it takes time to fill zero Go back to the smaller range here five and 20 Give it only 10 20 five and 21 20 and Four we got to do this one too Currently running a rotation script on a fun house. Billy is getting dizzy. Nice Whoa Boing Boing I like that. That's pretty cool. Auto refresh is in C Yeah, well, I mean it's a property that's the I mean it's implemented in C in the core But it exposes a python property for us to call or not call of course it's property but set to true or false Yeah, this one's kind of cool. I think we're going to keep this one how it is And use this one as the next example It is still slower When it's going down then it is going up. Let me try without fill maybe it Maybe it's not as flashy this way. Let's take a look right. We don't need fill because of the flashiness We need fill because we don't want the vortex We need fill I mean, I guess we could fill in here as well and then it would be the same speed going both ways A little bit more chunky that way Still pretty good though I think those hiccups are the camera too I was looking at this last night like where it paused there for a second I think that's either my camera or my network. I think on the pie portal screen itself If you look at it directly, I don't think that pause happens And actually if I'm honest, I don't feel like it looks quite as chunky on the screen itself as I do coming through the camera there Sorry, I killed the angle for you all but I'm looking at it more straight on Yeah, that's pretty nice actually. I kind of like the way that looks But that's why it's slower When you refresh yourself Well, I mean, I think when you call refresh like this, it's calling the same I mean, I don't really know. Truthfully, we'd have to go look inside display my my instinct my gut guess is that when you call refresh like this Uh, it's calling the same code and see that auto refresh is calling. It's just that auto refresh is calling it As fast as it can essentially or as fast as it wants to Um, whereas here, we're only explicitly calling it after we have modified The stuff we're showing So with auto refresh true Sometimes it will call refresh when we have not actually changed anything yet And so it'll do some amount of work To draw something But we didn't change anything so it's actually the same thing it already drew This way we never do any work to refresh until after we have Definitely changed what's on the display Um And so that's why I think this one goes faster is because we're not wasting time Refreshing when we haven't changed anything yet I would be curious actually to compare this one. Truthfully Because now that we're back on five and 20 it may not be nearly as big of a Noticable thing truthfully. Okay. No, it is much flashier Much flashier. So this definitely looks a lot better And in this case, I think some of those extra flashes are when it's doing that refresh even though it didn't need to So it's like it's ending up redrawing a bunch of pixels that were already They were already drawn with the thing they needed Uh, but this way it's only drawing them after we actually make a change Like this one. This is nice bouncing Billy. I like the uh, is the name of this one Auto refresh has additional logic to look for changes. Oh, okay. Okay, so it does some checking to see if it Uh, to see if I mean it seems to cause the extra blinkiness here So that's kind of the symptom That uh seems to come from the auto refresh. I will say though Everything I did say so far about it. This is all like how I think it works And it's definitely not something that I have looked into Uh, so definitely don't take what I what I say is like it is definitely for sure this way Um, that is kind of my guess. Uh, one of these days I will kind of do a More thorough read through of display. I once I kind of Grock the c code a little better Um, and then maybe I will have a more concrete idea But that that's kind of how I think it works with regards to the refreshes And then you know symptomatically we can see it is definitely making it more flashy Um causing that blinking to go on Whereas this one's like pretty darn smooth You know if we I wonder what it would be like if we just did like Well, that doesn't make any sense does it? Yeah, I guess it does times two here We go double not quite times 10 Of course, we're gonna have the same problem here where we get bigger than 20. Let's see what it looks like though. I'm curious This is one of the fun things about playing with, uh, you know visual stuff is you can just kind of like Weak values and see what happens sometimes it draws cool stuff But it's worth a try So this will give it like double the number of Frames that you know not frames, but like the number of sizes in between like while it's going up and down, you know What was this on I've okay 20 times two four times two Minus one Yeah, we would stay on minus one. I think Yeah, I don't want to stay on minus one. We don't want to times that by two So this will basically make each size change smaller. It's not you know, it's it's changing by 5% each time instead of 10% each time So it's making twice as many changes which Ultimately does make it slower But it makes it smoother as it's getting bigger and smaller But I think I actually like the previous one better This one is nice as well in its own way But I think I like the other one the faster one better because it feels more bouncy Feels like it's bouncing And I think that's in fun Fun thing the way it looks the way it feels when you watch it This one feels kind of like boing boing Like Billy's on a pogo stick or something jumping out at you You could also do easing if you wanted, you know, you could add like acceleration at the beginning or the end so that it kind of like Coasts in at the end or speeds up at the end. You can kind of give it that feel of Speed up or slow down at the beginning or end Auto for auto refresh is asynchronous with your code change. Yeah 50 so moving it by fives Is that the same method? Does it work out different 50? 201 5 249 minus 5 And then over 10 or No, we would need to be over a hundred. I think right over a hundred. Yeah, I think we need over a hundred So it'll swing. Yeah You do it. You could have it Speed up and slow down like a sine wave I don't have a sense of that. Is that one slower or faster? I don't quite have a sense of it It feels a tad slower to me But it also does feel a bit smoother again kind of like that same trade-off we saw before but not quite as extreme though this one does seem A little bit faster than the one we had the times two A little bit faster and a little bit less smooth but to me it does feel A hair more smooth and slower than the previous one we did With the 20 and the 5 Then you can just change the step size And again, I I wasn't watching the screen that time, but I believe those pauses those actual like where it's not moving for a second I believe that is in the camera and the streaming Software that's bringing the camera feed to my screen which and then in turn is feeding into obs and going out to you all Um, and I believe that that link between the camera and my pc is where The pause is at not on the actual pipe portal If I watch it, I've watched it for several cycles now and it has never done the pause I only ever see that on the display um Okay, I think I'm gonna I think I am gonna go back to the five and the 20 just because it's smaller numbers Um, and hopefully it's easier. Whoa That back please Do cut I'm sure if I really needed undo or redo Probably messes up my history doesn't it? Not that bad Okay I'm gonna leave it on this one just because they're much smaller numbers. So hopefully it's Very very clear what it's doing. Yeah, this one is totally faster The hair faster and more chunky too like the individual Changes are easier to see I think But it does have that nice boingy effect, which I do like um Okay, so we got our empty line All of our stuff we should have some comments Kind of just say loop forever We are going to enjoy our image still but our we're also looping for the purpose of changing the size of our image now Not just for the purpose of continuing to show it which is kind of splitting hairs, but Let's see here we're gonna loop Loop from 0.5 scale Let's just say loop loop from 0.5 To 2.0 scale factors empty the destination bitmap clear out the previous Lee drawn frame based in Billy At the current scale size our loop A lot from colorado. How's it going? Love the factory. Thanks for tuning in happy friday We got some we got some boingy boingy billies here at the billy led Boing it in and out like this which is kind of fun Okay, do this one refresh the display. Uh, so we want to To Refresh the display to draw our changes loop from 2.0 down to to zero point five Scale factors Next we could say step size 0.1 And technically it's one but then because we're dividing step size 0.1 destination bitmap this is basically the same stuff You know one thing we could do that would be faster than this instead of because our destination bitmap is big remember when we had the When we had desk bitmap filled in Well, it's gonna cover up if we do it now Remember though, this is big right? This is the the height times two and the width Well in the and the height times two the other way We have a bunch of blank space out here. That's part of our bitmap That it is not visible to us, right? We only care about where billy's at here these pixels out here We're not doing anything with when we say fill zero It's actually taking time. I think to paint those pixels on the outsides as well You know what we could do instead of fill zero we could actually um We could actually use fill region which we looked at in the docs earlier Uh fill region right here to only paint the rectangle that billy occupied at the previous scale factor Um that way we would not be spending time changing those outer pixels Which are never gonna actually be anything different anyway That would speed us up just a hair. I don't well. I say just a hair. I don't know exactly what the uh What the actual visual effect would be but I do know that well I think that that should be a little bit more efficient Um, so this should start going a little bit faster and a little bit smoother If we did it that way But I don't know for sure if I want to because I also kind of want to keep The example focused Um And the thing we are showing here is more so the roto zoom than it is The fill or the fill region or anything else like the roto zoom Is the thing where you should be isolating and showing And so even though I do think that would squeeze a little bit more performance out I think it makes the example more complex and thus not as good of an example So we'll have another example that is fill region and then if we wanted to maybe we could have an advanced one That uses both fill region and roto zoom to actually try to get the most bang for the buck that it possibly can But for this one, I want to keep it basic. Yeah, so we're gonna go Same thing here paste in billy At the current scale size from our loop Refresh the display so it will draw our changes There we go right like that Hello from europe. Oh, how's it going axl magnus. Thanks for tuning in. That's awesome to uh to know we've got folks in europe watching Um, I don't know the time difference, but if you're interested in this kind of content, I also stream Uh in the mornings on saturdays. So like tomorrow morning, but of course when I say morning, I mean morning my time um You know, I keep meaning to I keep meaning to uh to make one of these things that will count down for me Time countdown. I don't remember the name of this page. There's a page that This is it actually time and date work from home boxing basketball dragons new years narek Text only oh that is some fancy text there, huh? tomorrow I just want tomorrow Hour is at 10 a.m. My time I didn't say 10 and 10 a.m. Oh, it's 24 hours. I see Location of event. Yeah, I mean it's on the internet. I guess right One what is that 1001 minutes? How is that helpful? This one's a lot What is oh is that in binary? What is going on with that? Must be binary or something or like hex me Hex or something anyway 16 hours 40 minutes from now um If that is a more reasonable time to watch from europe I'll be around tomorrow streaming similar type of stuff and i'm around at this time every week on saturdays So whatever time zone it is in your place 16 hours 40 minutes from now. Ah, you got the f1. Yeah, no worries there. I hear you Uh, I hear you there. It is tough to compete. I definitely cannot drive nearly that fast and there's no competition here. So Uh, I definitely hear you there just programming lots of programming I could program fairly fast sometimes but not as fast as some of the folks here on twitch Although we're on twitch and youtube now. I suppose I need to like bookmark this so it shows up every week. So I just have this thing And I can show it uh for tomorrow um Okay, I think we got this one knocked out and wait. Do we have anything else we want to do? I think we're pretty good Got comments on everything Roto zoom initial scale Yeah, I'm feeling pretty good Let's save it. Let's copy it. Let's put it over in the repo Uh, this will be bitmap tools scale animated what The other one go If I think this is because I didn't fetch main before I made this branch I've already committed now. Haven't I need Um, let's just go fetch data fruit. Nope circuit python update circuit python And merge circuit python main into Bitmap tools scale But I love to have a beer at midnight on friday is watching a real coder in action. Nice I'm happy to have you around watching out. I'm glad there's uh Glad I can provide some coding Entertainment or inspiration or just something to watch for fun. Um Now we got our other stuff. I think what we'll do is let's make one called bitmap tools It's map tools tools uh scale BMP animated dot pi Yes, add it. Let's paste it boom save it. There it is now Yeah, this has pre-commit, but not um I'll run it, but I think it does not actually I'm not sure what all it does might not actually be Doing pilot or everything on all the code. I'm not actually sure pre-commit run What is this fix into files actually did catch quite a bit of stuff the Come to see so some of it's going to be lack reformatting So that portion of it will actually just uh pass the second time Oh, that did actually do a fair amount of changes though Okay, I did One to two changes in each of these I guess Kind of animated we did still fail a couple of things here to pilot Might as well fix those up. I think it wants bored before a lot of this stuff Image load should be before bitmap tools I agree with that one, but pilot uh Pilot tends to win my disagreements with it. What do we got here math should be before board? Please just I don't know. Could you just organize them in the order you want that'd be cool Is this a to fruit image load be before display i o so it's like it wants bored before Image load, but it wants image load before display. Oh and bitmap tools Have that right that doesn't make any sense to me No, but what board let's just be fixing one at a time It's even possible to get these in an order that it likes party import Image load should be before bitmap tools Not what we had before like we're going in circles Yeah, am I crazy here? We're just going in circles We're juggling imports Oh, no, we got it. We landed. Okay Okay Pardon me All right, we made it Constant name big billy scale doesn't conform to some stuff I guess you could make it shouty if you want Uh, is that a control ship? Not done that I guess Uh undo There's like a two uppercase, but I don't know how to do it Jet well, I mean, I guess I could always just refactor Up a new thing Refactor big big Billy scale Normal billy scale more import orders who we can uh Use the same one closer I think we made it Yeah, okay end of line end of file um Yeah, okay, so we're gonna make a new commit even though we changed a bunch of other stuff, unfortunately I guess I means I probably didn't run pre-commit yesterday and I should have but format Rotate examples scale Example format rotate And scale samples Go foamy guy when we push a Map tool scale new branch under foamy guy. Yep push it Make a new pr for it. If anybody want shing is interested You'll be able to grab my code from the pr And also if anybody is interested you could leave a comment or a review on the pr That would definitely be most appreciated If you do try it out especially So we're gonna go github circuit python Get near the top of the list here Make a pr for this map tool scale examples And format bitmap tool Other things pilot gets grumpy about are things that I don't understand why it matters. Yeah Yeah, I definitely agree with that The import order especially it doesn't I don't I don't quite get I don't get the order it's trying to figure out like to me I don't even understand the pattern truthfully to me It feels like if anything it would be like maybe it wants all libraries after all built-in modules But in this case what we ended up with is like Board which is a built-in module first then image load which is a library And then bitmap tools and display or both of which are built-ins And I don't I have no idea why that is what it likes I don't even see the pattern of like maybe understand it It might think that this import bitmap tools is this folder bitmap tools So it thinks this is like local to the project accidentally But it's not actually it's a folder that holds examples Though the name of the folder was chosen to match the name of the module In this case maybe is confusing it. Maybe this should be examples Maybe each of these should be bitmap tools underscore examples digitalio underscore examples That might Make it not as if my theory about why it's confused about these is correct That might fix it and so board comes first because board is not in here So it knows that it's definitely not local to this project Yeah, that's my guess actually It is still weird that it that it cares and it's also weird that it's confused because this is not importable Because it doesn't have an init pi inside of it. So it should And realistically it should be looking in here and seeing that there's no init pi and deducing that it Can't be imported and that that means that This thing is not talking about this thing which means it's But what are you playing with buddy? Right. Be cat. Just knocked this mouse in a ball right over here Back to him. Are you ready? Yeah Not very interested after we threw it took all the fun out of it. I guess But those folders don't have yeah. Yeah, that's what I was thinking is like I don't know why it I mean, that's my guess I could still be wrong about my guess But that's what I'm thinking because that's the only pattern I can see is that bitmap tools and display So Belong to this project If you Don't understand that they don't actually which I guess it doesn't I would I would think it would be smart enough to look for a init pi though. So I am a little surprised and uh Perhaps untrusting of that theory that is my best theory, but it still could be wrong and The fact that it doesn't have a init pi Makes me think maybe it is wrong because it should be checking for that I would think that seems like a pretty good base level check two new examples, uh one showing A scaled image At three different sizes sizes and another showing uh animated At showing an animation and image up and And basically just like my pr yesterday, I'll go ahead and include the uh A little video of this one and a little image of the other one So I can take a video with this thing called peak Already pretty much sized perfectly for the pi portal because that's the last thing I recorded I think we'll start when it's small, but it's actually going to count down to three So I'm not going to get it right. So I guess I'll just click it like here and see what we get Nope I'm pretty close. I guess And we don't need this to be too long A couple seconds is good Billy scale animation Let's see here. I suspect the order the let's see the order I suspect that the order requirements are influenced by Libraries and modules that import other libraries and modules under the covers or maybe the same ones perhaps I guess that's the other side of convention over configuration though Like my code base at work has some files in it whose names start with test underscore. Oh my goodness Yes A million thousand times percent. Yes I have run into this exact problem I create files test underscore something like Test some part of my system and it's like a script that I'm using to test something, but it's not A pie test. It's not a unit test. It's not expecting to be run by a test runner and the IDE is like This is a test. Do you want to run it with the test runner? And I'm like no No, I just want to run it and I want to have the word test in its name And I want you to stop bothering me about it And it's like nope Best I can do is offer to run it as a test Take it or leave it And I'm like leave it. That's what I've been trying to say the whole time That just offers again. This doesn't seem to have saved I'm in the right folder, which would I'd be part of the reason why Here we are Yeah, the test name I'm with you on the test name Is pylon actually trying to do some kind of just dependency resolution under the hood? That would seem to be really complicated I do not know the answer to that pylon Is definitely more complicated than Than I know about I'll do that for sure Put our mouse in the video. All right, though Yeah, we don't need this one Put a picture as well. This one'll be easy. We can just grab the camera Uh, I'll take the code back from Scale BMP Take a little screen snip of that one Here we go Hey, where's the image? Oh, it took my video away Actually just because it's not by its own Uh, another thing I want to do related to this effort is inside the core. So right at home for a deep dive podcast. Um See, let me catch up on the chat here as well Fairly knowledgeable, but I recall there's uh, some resources listed in there circuit pass them to Pencil resolution is a hard problem. I would want to bite. I wouldn't want to bite that off My own code if I could avoid it. Yeah, I'm I'm with you. Definitely. There is there's a thing called pi Um, gosh, what is the name of that thing actually? I remember the name of it now Um, there's a python module that figures out The dependencies for you like you point it at a code file And it will uh It can like it parses the code and it returns to you a list of The imports basically um So it's like programmatically giving you access to what imports a chunk of code are going to have that's what we use um for the learn guide system that, um There's a utility that takes uh, well that generates screenshots of All of the project files for each project every project inside the learn system Um, every circuit python project at least it this thing this tool generates screenshots of what the file system would look like If you put that project's files On your circuit pie drive and it it uses this python library whose name escapes me Uh, that looks up the imports for you. It's a pretty slick thing. I do think circuit has something as well Maybe you know what I think it's called find imports actually my phone find imports Yeah, this I'm pretty sure this is it. Yeah This thing is super cool. If ever I found myself trying to solve that problem I would be like Let's use this uh, let's not trust me to make code that does this correctly Just look at how many command line options I sort. Yeah Have to download without a config asset database. Yeah Okay, so let's make this pr Oh, we already did make this pr actually. Yeah, so if anybody watching wants to try out the new scale examples You can find them here And also anybody watching is free if you would like please feel free to leave a a comment or a review If you do try it out, let us know if it worked or if you had trouble or what device you tried it on that sort of stuff All that kind of stuff is always helpful If you will uh, if you want to get involved, um You know, that's that's always helping us having folks look over Look over changes a little bit test them out Just let us know if it worked for you like whatever level you're comfortable with all of those are Are all very helpful for us. So If anybody is so inclined then Have fun with that. I think the other thing I'll do is one of the things I want to do as part of this effort is actually Also update the docs. Um to try to make the docs better. So For one thing is we could have an example here in the docs, which I think would be good But i'm not sure that i'm quite ready to do that yet because realistically we could probably have a couple examples here because roto zoom again is a very you know dynamic Utility right it it does a lot of different things like we have You know four examples already and we've only touched the the angle and the scale And the o x and the oy We haven't even touched pretty much any of the other input configurations. We have so There's quite a bit more stuff it can do And so I think maybe multiple small examples probably makes the most sense kind of like the ones i'm building But we'll have to figure out how we want them formatted in here I don't want to quite add those quite yet, but one thing I do want to do I think is uh Fix up a couple of these definitions a bit like I think we could include the default values here um And in a couple of these places actually we can include the default values and then also we could include The information that tells you what the default values do because like in the case of zero x and zero y the default values are actually none But then of course it's useful to know that what none does is actually default to the center of the destination bitmap Thanks for pulling back the covers of bitmap tools hadn't looked at it before. Yeah for sure I'm happy to I'm happy a to dive through this stuff some more myself just because this is helping me learn about it But also I'm especially happy to help other folks get interested get involved take a first look at it and You know see if it's a utility that might be helpful for your for you someday So that's good to hear. Thanks for the feedback. Appreciate it see grover Kind of like parsing elf and stm kubemann for monitoring trending variables. I'm not familiar with much of that stuff If I couldn't say too much, let me x out these boxes. We don't quite need this gigantic one box thing here Okay, so I think yeah, that's one thing I'm going to do is um On this roto zoom I think ox and oy we're gonna say Uh default defaults to none which Causes it to use half The midway use the midway Use causes it to use the midway point Oh, okay. I see here's where we get tripped up a bit. We got to do this midway point of I guess really we should stay horizontal Horizontal midway point of the destination Bitmap He falls to none Which causes it to use the horizontal midway point of the destination bitmap Same thing here, but it's going to be vertical midway point He falls to none Which causes it to use the vertical Well, how come sometimes it just automatically does that but other times it doesn't vertical midway point of the destination Bitmap Bitmap bitmap bitmap. There we go um px and py Basically have the same kind of logic going on right here px py This is where I learned about this actually is in the code here There's comments that says none convert to source height over two So this is actually how I figured out what these do And I thought it made a lot of sense to include these in the doc strings that way they'll show up in the uh in the docs pages And also consequently in the stubs, which means inside the ide if you keep your stubs up to date What is the largest bitmap it can load good question lovely a72 It's going to depend entirely on memory. So it's going to be a different answer for different devices And it's also going to be a different answer depending on What else your program does? Um, so unfortunately that may not be a super helpful answer Generally speaking Most devices can hold a bitmap that is the size of the display Um, so this pi portal titano is 480 by 320 I believe there is enough memory to hold a bitmap That fits the display Uh, I don't know how many colors you can fit within that bitmap. There may be some limitation there On smaller devices such as this pi portal standard. This is the regular pi portal Uh, this one is only 320 by 240, which is actually quite a few less pixels than the titano So it can definitely hold At least one bitmap that is the size of the display. I know that for certain because I've done it on that device um But yeah, it basically there is no like One size fits all answer Um, it depends on how much memory your device has and it depends on what other stuff your program puts into memory Basically your limit though is the memory of the circuit python device that you're running on which is It is still a microcontroller. So this is like in the scale of kilobytes somewhere I don't know the exact size and it's different on different devices, but Got a couple kilobytes basically for uh for playing around with there. Yeah, for sure. Good question Um So px and py we're gonna do the same thing defaults to none which causes It to use the Did this one again where it didn't give me this part Well, we don't want spaces. I don't know if we want spaces versus tabs. I guess we'll find out Defaults to none which causes it to use the horizontal Sontal midway way point in the source Bitmap this one is instead of the destination bitmap Basically the same thing here defaults to none which causes it to use the Vertical why though does it not give me these this is crazy I swear one of the times I pressed enter it gave me this. I don't know. It's not Depends where it's at. I guess it's not figuring it out for these ones Um defaults to know which causes it to use the vertical We should keep the same adjective An adjective. I don't know we should use the same word as we did up there basically Uh a couple others we can do actually uh none converts to 0.0 for the angle Angle of the rotation defaults to none Which is 0.0 radians radians or no rotation scale scaling factor defaults to 1.0, which is the same as the source size Defaults to well it actually defaults to none technically it defaults to none which Gets treated as We want to be technical Gets treated as 1.0 Or same as original Source size, okay, let's run make html because this will build the docks Not here it won't though Well, I don't think I'm not actually sure up here. It should we don't want to be on this branch though I'll tell you that let's make a branch get fetch Adafruit Get check out dash b Bitmap tools no, let's say roto zoom roto zoom docks weeks improvements improvements From Adafruit main No track No track it. All right. There it is much better Uh, we fetched first Ah Didn't pull do I have to I don't have to pull because I did fetch And I don't remember do I have to pull or not? Am I going to be behind main? I don't think it should matter unless there's like merge conflicts even if I was behind main So these are actually the only ones with extra Notes down here. So these are the ones I'm most sure about the sort of defaults and the default behavior of I think I'll leave the rest for now, but I feel like this is a pretty good improvement anyway because Even myself last night. I was looking at the docks trying to figure out how like what these things did And this extra bit of information. I eventually found it inside the core code But if I had found it in the docks, I would have gotten my stuff figured out a little bit quicker With a speed hit, is it trivial to grab external bmp's? Or use an external video buffer Not sure I know the answer to that one Is it trivial to grab external bmp's? Do you mean like grab the uh bmp from the web or something like that when you say external bmp's? um I'm also not super familiar with graphics stuff in general. So I'm not sure I understand external video buffer truthfully Like I have my level of understanding of graphic stuff is very high level like I've done some uh android development You know with graphics stuff integrated and I've done the circuit python development, but it's You know all of my knowledge is pretty centered around those two platforms android and uh And circuit python I don't necessarily have a deeper understanding of all the concepts of different ways that graphics have been done on computers over time um So we can run make html Off chip memory, I gotcha. So on a like a different device basically not on the main chip So like loading it from an sd card or something for instance If I understand what you mean In which case um That is the case I do think it's fairly fast to load it from a from like an sd card or something like that I haven't tried specifically um But I think it's fairly quick. I don't think it's like noticeably any faster than uh The coming from circuit pi um I don't know if this is a legitimate viewer over in the youtube here. I can't uh I can't read your messages. So and I'm not sure if they're Appropriate or spam or what I don't really know what's going on with those. Sorry, so I'm gonna go ahead and hide those If you want to uh ask questions or anything like that English would be best. That's the only language I can speak unfortunately, so Apologize if you're trying to speak a different language It may be something I didn't understand and I do apologize for that But if you do have questions or anything if you can put them in English in the chat I'll be happy to answer or if you just have something you want to share Otherwise you can do it that way as well math jacks. Oh, yeah, we had this last time, right? This is happening I don't know what the root cause of that is but if I recall right, we still got a good build last time so it was You know a warning not an error. I guess it's uh, it's telling us this is a problem But it's not stopping it from working Not index in index Index, okay, this is it But we want to do that probably killed the chat. Sorry about that. There you go bitmap tools section of bitmap manipulation tools roto zoom o x defaults to none which causes it to use the What? defaults to none which causes it to use the vertical midway point of the destination bitmap Or did the last part of ox go? I spy I'm missing one of these My little eye Okay That's interesting. So the docs is looking for this thing slash slash pipe We're off by one character here now too, which is going to bug me. So I'm going to fix it and cancel this Try again on the sd card Topic front another thing to consider is like there's ate a fruit sd card the library There's also I think built-in sd card i o And I think there might even be one other thing that's built in I think there might be two ways to read sd cards built in and one that's a library So there's actually there's kind of a few different options some of them may at this point rely on the other ones and uh Honestly personally, I'm not too up on which which is which and which one's best and If the higher level ones actually use the best lower level ones or whatever so I don't have all those details um, there's probably a guard a guide about it out there somewhere some kind of documentation if you look in the docs for sd card I o my guess is it should have the lowdown But I think those different ways of like connecting to and reading the sd card can result in different speeds as well I believe there is one of those things that is kind of like fastest most efficient the newest one Um, unfortunately, I don't recall exactly which one it is. There's also. Yeah, there's also this idea of sd i o i o Which also kind of comes into the mix somehow, but again, I'm not Where it's at there it is um I'm not it's not I don't know the full picture here basically which one is which and what they mean, but That I do believe factors in as well different ones can be faster or slower for reading So there's probably one that would read the bitmap the fastest All right, let's get this refreshed There we go. That's looking a lot better already Defaults to none which causes it to use the horizontal midway point of the destination bmp vertical pixel location in destination bitmap Where source bitmap point px py is placed Defaults to none which causes it to use the vertical midway point of the destination bid map Under px and py Horizontal pixel location in the source bitmap that is placed onto the destination bitmap at ox and oy Defaults to none which causes it to use the horizontal midway point of the source bitmap Vertical pixel location in the source bitmap that is placed into the destination at ox ory Defaults to none which causes it to use the vertical midway point of the source That sounds good angle we change as well angle of rotation in radians positive clock clockwise direction, defaults to none, which gets treated as zero, zero radians, or no rotation scale, scaling factor, defaults to none gets treated as 1.0 or same as original source size. Nice, I like it. Yeah, that stuff would have been helpful to me yesterday. So I assume that it will be helpful to somebody at some point in the future. So we'll save that. We will run pre-commit, pre-commit, run, run, a. All right, we passed it. We will go ahead and commit. I don't know why that's different. I'll undo that one. These are the changes we want. We're just gonna do only those changes. I'll leave the other one unchecked, which means it won't be part of my commit. Improving, roto, zoom, docs, doc strings, argument. Think maybe we have pre-commit installed as well, which means it runs again. Of course, we just passed it in it, or we just ran in it, passed it anyway, so it shouldn't do anything the second time, but here's our one commit with our one set of changes here inside of init. All the rest of these are listed here because these are all commits since the last time that I updated the foamy guy fork. I tend to only update whenever I make a new branch like this in order to make a PR, so since the last PR I made, all of these are changes into main. So we're gonna push that. That's gonna go to foamy guy, roto, zoom, docs, improvements, and we'll go make a PR from that. And then we're probably gonna wrap it up pretty quick after that, so if anybody does have any other questions, comments, ideas, anything they wanna share, now would be the time in the last couple of minutes here, so let's head over to circuitpython repo, github, eta fruit, circuitpython. We'll make the PR from this. Improving roto, zoom, arguments, argument, doc strings. Pretty good. The ox and the oy, we got the pics and the pie, got the angle and the scale. Rings, not a word. Word, isn't it? I think it's a word. We're just gonna pretend it's a word. I updated a few of the argument doc strings to include the default, default values and behavior. You know what, I didn't run as make, but I guess pre-commit runs make translate, doesn't it? Well, we didn't add any strings either, though. Did we? No, yeah, because we're only doc strings. Yeah, we shouldn't, I think we shouldn't and there shouldn't be any translations that it needs, I don't think. So yeah, the actions now, this is gonna make it build all the different builds of circuitpython, so it's gonna take it a while. We definitely won't sit here and wait for it to finish. Yeah, I think that's about where I'll wrap it up for now. And I'll be back tomorrow morning, my time, which is in 15 hours and 56 minutes, roughly, assuming I put all this stuff in correctly. 10 a.m. central time tomorrow, if not. I'll be back streaming. I'll drop links in the Discord, the live broadcast chat, which is on the screen right there. I'll drop the links to my Twitch and the YouTube video for tomorrow's stream. We'll probably be working on this same kind of stuff. I still wanna knock out a couple more of the different things that RotoZoom can do. Like I still haven't touched the clip stuff yet for either destination or source. Haven't done any of that stuff yet. Haven't done any skip index yet. So we'll play with those things. We'll build the examples for them. I think that's probably one of the things we'll work on tomorrow. And I still wanna do examples for the rest of these functions as well. So Alpha Blend, fill region, boundary fill, draw line. I'll have to figure out more of what a Rablet does before I can do that one. Read into is kind of the same, truthfully dither. I definitely wanna learn about that one. So I probably won't get to all these tomorrow, but working on a couple more of these examples will probably be what I am up to when I am around and stream tomorrow. If anybody wants, you can check in on that. Thanks again to everybody who watched. Appreciate all of you hanging out. Definitely had fun. Hopefully this was interesting and or educational. Hopefully some folks learned about bitmap tools. You can definitely do lots of neat stuff inside display with this. So I'm excited to learn more about it and get more examples for it out there so we can get more folks using it. And yeah, again, thanks everybody for watching. Have a good night. Hope everybody has a good rest of the day today. Has a good tomorrow weekend, all that stuff. And yeah, I'll catch you all next time. Which again for me will be tomorrow if you wanna follow along. So I'll see you then. Thanks.