Friday, July 1, 2016

true canvas

OK, every time you upload a picture it's just going to be placed on your page. I mean, it's going to be placed on your screen, and your screen is going to be showing a location on your page, so the image will be placed in that location on your page. You can always move it.

Keeping in mind that your page is infinite, infinitely wide, infinitely high, some kind of home location is required, and that is called Square Zero. Loading the home location puts square zero and square zero's contents on the screen. There are options. Should square zero be as wide or tall as the narrowest screen dimension? If it's that size then the entirety of square zero will be visible when the home screen is displayed, so it's a reasonable default. Then if the screen is wider than it is high or higher than it is wide, some parts of squares adjoining square zero will also be on screen. To load this view, then, the program calculates what adjoining squares are also on screen, and loads their content as well.

Some corollaries:

If all of a square is on screen, part or all of anything in that square may be on the screen. If any of a square is on screen, some part of things in it may be on the screen, so the square needs to be drawn. If a square is above or to the left of the screen by less than the square's width, parts of things in it might be on screen. Any square on the screen or left of or above the screen by less than its width needs to be drawn.

At what point is a square not on the screen because it is too large? At no point is a square not on the screen because it is too large. A situation could arise where the corners of four very large squares are on the screen, but this cannot produce the effect of having more than four squares on the screen at once.

Still, it's a complication, and it's revealing some things to me. What has just become clear to me is that the only "thing" that can be placed on this page is a pixel. Well, a pixel is the only thing that can be placed in a square.

When an image is uploaded to the page, its pixels are placed in the appropriate squares for the selected location. There is an upper limit to the number of pixels a square can contain, maybe nine, so drawing a square will always be a compact assignment.

An infinitely wide and narrow or tall and narrow screen can contain an infinite number of squares, so a limit must be imposed on the tallness or narrowness of a screen. By screen I mean a window. No, not a window, a canvas. And a canvas that is sufficiently narrow and wide or tall will, if displayed in its entirety, be invisible. The limit, then, is imposed automatically by the environment, and it should be well within the limits of the computer's ability to calculate.

In this system a square can be divided into smaller squares. The square to be divided is the parent, and its divisions are its children. Children take precedence over their parents. The contents of a child square will be visible in front of the contents of its parent. There is, however, a limit. A very small child, the child of a child of a child of a child of a child of a child of a child, will not be displayed. We thus know that the maximum number of squares larger than the canvas, or larger than the canvas by a certain not very large amount, is four, and the maximum number of squares smaller then the canvas, or smaller than some size a little larger than the canvas, is something like four to the eighth power, which is a large number, but not an unmanageably large one.

Oops. The problem of the very narrow canvas is solved this way: The screen square - we'll call it that, though it's the canvas square - is some square, part of which is on ... we'll call it the canvas ... that is, this square, larger than the longest dimension of the canvas. It is also not larger than, I think, three times the longest dimension of the canvas. The largeness of a square refers to its side length, and is a single number, all of the sides of a square being equal in length. Since parts of as many as four squares of this size could be on the canvas at one time, there is a rule for identifying the actual screen square, or, alternatively, we could speak of a screen square set. Also, it is possible that pixels in squares adjacent to screen squares - those being defined just above - would at times be on the canvas, which extends the screen square set, but objects in screen square size squares not adjacent to the screen squares cannot be on the canvas at all, so the complete screen square set appears, by my calculation, to be limited to ... 9.

My earlier calculation was not correct. The maximum total number of squares that could possibly be on the canvas is the nine screen squares and all their children to the seventh generation, so, 9 + 9*9 + 9*9*9 ... to the seventh power of nine, or maybe the eighth. This would be true regardless of the proportions of the canvas. (I'm noticing that this would produce a reduction in detail in the case of very narrow canvases ... which is not, in fact, a problem.)

One final thought: the canvas is described on a screen, but the canvas can also be larger - taller, wider, or both - than the screen. The true canvas, upon which views of the page are drawn, is the intersection of a screen and a canvas.