DAY 009:_PutImage - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Official Links (https://staging.qb64phoenix.com/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://staging.qb64phoenix.com/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://staging.qb64phoenix.com/forumdisplay.php?fid=49) +---- Thread: DAY 009:_PutImage (/showthread.php?tid=1119) |
RE: DAY 009:_PutImage - james2464 - 11-16-2022 Suppose you want to use _PUTIMAGE _SMOOTH to blur an image....more than once... Would this be possible? If so, how would you go about it? Based on my understanding, this seems impossible but I could be wrong. I attempted it and failed so I thought I'd ask. RE: DAY 009:_PutImage - SMcNeill - 11-16-2022 (11-16-2022, 03:48 AM)james2464 Wrote: Suppose you want to use _PUTIMAGE _SMOOTH to blur an image....more than once... I honestly don't think you can, since hardware images aren't alterable, so you're not going to _SMOOTH them. I think it's basically going to be a onetime process, with you having to write your own smooth routine in case you want to process the same image multiple times. RE: DAY 009:_PutImage - james2464 - 11-16-2022 (11-16-2022, 03:55 AM)SMcNeill Wrote:(11-16-2022, 03:48 AM)james2464 Wrote: Suppose you want to use _PUTIMAGE _SMOOTH to blur an image....more than once... Thanks. Yeah I was kind of hoping there was a way to capture the blurred image but this confirms it. That layer is basically untouchable, and can't be saved and brought back for more rounds of alteration. Trying to get my mind around this, haha. RE: DAY 009:_PutImage - SMcNeill - 11-16-2022 It *can* be, but it's a lot of OpenGL and C-header stuff, from what I remember. Asiash (I'm certain I spelled it wrong), had a working example of reading from the hardware image over at the old forums somewhere, so it's not 100% impossible to do. It's just not something that 99.9998% of the user base is going to want to climb that deep into the rabbit hole to sort out how to do. If you're in that minute group who's interested in sorting it out inside QB64, I wish you well in your endeavor. Gathering info back from a hardware image isn't something that I've ever personally attempted to do in QB64, so you've hit the limits of my personal knowledge and ability to help. Do I know that *OTHER* people can do it? YEP! YEP!! Sure do! Does that mean I have a clue how to do it? NOPE! Not at all. LOL! Steve isn't a complete idiot, but he's also not the keeper of all knowledge either. RE: DAY 009:_PutImage - james2464 - 11-16-2022 Nah, not something I'd be interested in. I like the smooth/blur effect and wondered if this could be increased just by copying it back into another image header by capturing what's on the screen. But the idea that hardware images aren't really there to be seen by the software side, that started to seem like maybe I just didn't understand it completely. But alas it is what it is. I think making a blur algorithm would be a good challenge. RE: DAY 009:_PutImage - bplus - 11-16-2022 (11-16-2022, 03:48 AM)james2464 Wrote: Suppose you want to use _PUTIMAGE _SMOOTH to blur an image....more than once... Sure possible (not thinking with _PutImage and Smooth), several ways take average of 8 pixels surrounding pixel in question. Can do it it over and over until all one color. Or take average of more and more neighbor pixels. You would do this by hand calculations pixel by pixel. This is pretty much how Steve described how Smooth worked. RE: DAY 009:_PutImage - grymmjack - 08-27-2023 @bplus thanks for the keyword of the day series, it's great. Quote:STEP allows you to use the last graphics command (x, y) as the start for the next graphics, a very handy use of step for images is to start with the (x,y) location of the top left corner of the rectangle and -Step(ImageWidth, ImageHeight) instead of adding width to x height to y and finding the absolute position value for the 2nd (x, y).Could you help elaborate on this part: Quote:a very handy use of step for images is to start with the (x,y) location of the top left corner of the rectangle and -Step(ImageWidth, ImageHeight) instead of adding width to x height to y and finding the absolute position value for the 2nd (x, y).Could you possibly show me an example where we are using the absolute position value for the 2nd (x, y) and then how step would fix it? Thanks RE: DAY 009:_PutImage - grymmjack - 08-27-2023 (11-15-2022, 03:25 AM)Pete Wrote: Yep, leave it to Steve to flip us the bird! LOL!!! RE: DAY 009:_PutImage - bplus - 08-27-2023 Quote:Could you possibly show me an example where we are using the absolute position value for the 2nd (x, y) and then how step would fix it? From our very recent code rewrite for FONT.print Code: (Select All) Sub F0NT.print (s$, f() As F0NT, x%, y%, scale%, spacing%) RE: DAY 009:_PutImage - grymmjack - 08-27-2023 (08-27-2023, 11:16 PM)bplus Wrote:AHA! Perfect example. Let me try to explain what I understand in my own words to make sure I grok this.Quote:Could you possibly show me an example where we are using the absolute position value for the 2nd (x, y) and then how step would fix it?
Thanks! I think I understand STEP. It makes the second set of parenthesis args relative to the first set of parenthesis arg. So first set of parens = (dx1, dy1). Second set is implicit dx1+ and dy1+. Right? Can you confirm if I have the right of it for -1 for x and y on both lines 11 and 16? but curious why line 12 has no -1there. Ah! because in the loop we aren't offsetting yfor each pass! the characters are adjacent on the xand SAME on the y. NOW I get it. ALSO something happened when I had to type this out. I realized a thing, might be obvious to others but wasn't to me. Simplify the math and vars to understand WTF is happening. If the code has: dx1% = x% + (i% - 1) * (COLS + spacing%) * scale% simplify pass 1: dx1% = x% + (1 - 1) * (COLS + spacing%) * scale% simplify pass 2: dx1% = x% + (0) * (COLS + spacing%) * scale% simplify pass 3: dx1% = x% + 0 * (COLS + spacing%) * scale% simplify pass 4: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 0 * (9 + 2) * 3 simplify pass 5: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 0 * (11) * 3 simplify pass 6: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 0 * 11 * 3 simplify pass 7: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 0 * 11 * 3in loop iteration 1 dx1% = 0 simplify simulate i% + 1to assert .. so pass 8: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + (1 * 11) * 3 simplify simulate i% + 1to assert .. so pass 9: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + (11) * 3 simplify simulate i% + 1to assert .. so pass 10: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 11 * 3 simplify simulate i% + 1to assert .. so pass 11: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + (11 * 3) simplify simulate i% + 1to assert .. so pass 12: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + (33) simplify simulate i% + 1to assert .. so pass 13: If: x% = 0 : COLS = 9 : spacing% = 2 : scale% = 3 dx1% = 0 + 33in loop iteration 2 dx1% = 33 I know, we can just watch those variables and debug and step through.. For some reason this didn't occur to me either. Thanks @bplus |