Comments/Ratings for a Single Item
With some extensive testing I've been able to figure out the issue, although I don't understand it. The piece sets that don't work with diagram designer all have an extra carriage return at the end. Remove it, and they work fine. Take a file that works, put an extra blank line after the ?> line, and it breaks. Very odd for whitespace to break code...
The piece sets that don't work with diagram designer all have an extra carriage return at the end.
That makes perfect sense. While the Game Courier scripts create an HTML page, the drawdiagram.php script used by the Diagram Designer produces an image file. If that image file contains any text, even a white space, it is corrupted.
I am referring to a space in the php file that defines the piece set, not the image file created by the script. The diagram designer executes php code to dynamically create and return a binary image, right? Why would whitespace in the php source code of a program affect its output?
Update: Ok, maybe I see. Since the space is outside the ?> it gets incorporated into the output stream?
Ok, maybe I see. Since the space is outside the ?> it gets incorporated into the output stream?
Yes. Unlike Game Courier, which saves an image file to the server, drawdiagram.php simply becomes the image file. So, it's output has to be a pure image file. Since the set file gets included in it, that set file must be free of any text output.
Ok, I have removed extra whitespace from all piece sets and verified that they all now work in diagram designer.
I cant even use it. HELP!!!
I cant even use it. HELP!!!
When you do not even say what you do not understand, or what you have done, or what problem you are having, it is not possible for anyone to help you.
You must invest time yourself if you seriously expect anyone else to invest time to help you.
The central piece is not shown on my screen
Hmmm... This does not make sense to me. The snake image is just a PNG. What browser are you using?
Greg, you can see it?
I'm using Firefox 88.0 on Ubuntu. I saw the snake in the process of creating the diagram, it was still there with the first two dots in the same rank, bit it disappeared mysteriously with the completion of the diagram.
Trying konqueror as an alternative browser, it shows the snake. Strange ...
Yes, I can see it. To confirm, I just checked with Firefox 88.0.1 on Linux Mint and it shows fine there too...
Since the diagram designer is a server-side script that generates and outputs an image file, the browser used should not make any difference.
I can confirm that originally the Snake was not displayed in the diagram that Jörg posted. I looked at the page source, and the diagram was a direct link to the diagram generator, which did contain the S in the intended square in the CGI parameter. But no show... But now it magically appeared, with the same browser (FireFox). There must have been something temporarily wrong on the server, such that the server-side script could not find the Snake image file to compose the entire image.
There must have been something temporarily wrong on the server, such that the server-side script could not find the Snake image file to compose the entire image.
Yes, I made all $dir values relative today, and I had to fix the diagram designer before it would work properly with relative URLs.
I have updated the ability to mark moves. The ! symbol now displays a dot in the last color. So, if you want to use a specific color, you can add it to the list of colors.
The braces can now be used to display multiple items on the same space. Symbols between braces should be separated by spaces. They will be drawn in the order that they appear. So, if you want a dot over a piece, put the piece label first, then after a space, put a # or !.
For editing diagrams from existing pages, it would be useful to be able to load the diagram designer settings from an existing generated URL
You can do that by replacing drawdiagram.php with diagram-designer.php while keeping the rest of the URL the same.
I have a question on using image names in the code argument of the Diagram Designer. The example on the page here only shows an input that uses a single letter per piece, and shows how letters correspond to images on the right. But some piece sets have many more than 26 images. Now I noticed in the URL used for the static image in Central Point Chess that it would also possible to use a piece name in braces instead of a single letter, where the case indicates the color. Like {PAWN} or {king}. But this was for the alfaeriePNG set, which uses all-lowercase names for the images. How would that work for a piece set that uses mixed case, such as Abstract? Would the DD know that it alwasy has to capitalize the first character, and use upper-case W and B prefixes in such a case? And can one mix single-letter encoding with the braces construction?
[Edit] Never mind, I think I figured it out. The use of braces is a general method for allowing multi-character piece names, but the mapping of the names on names of image files is specified by the initialization $pieces array in the sets/*.php scripts. And only in sets/ auto-*.php scripts this mapping is set from all upper- or lower-case full names to the white and black image-file names.
These scripts differ only in the setting of the $dir variable. So I can easily clone those, to make auto scripts for AlfaeriePNG, AlfaeriePNG35, XBoard, XBoard33, Abstract, Motif, MagneticPNG, Utrecht and Utrecht (Small), in which besides using the full names you can also use single-letter IDs for the orthodox pieces (and perhaps some common fairies?) in the code parameter.
Below an example of a diagram using the AlfaeriePNG set:
Yes, it sounds like you figured it out.
Now that I have a better handle on how Alpha values work, I have gotten the Diagram Designer to use and pass them along to the PNG file. I have added a new parameter to drawdiagram.php called bgcolor, which is for the background color used when shrinking an SVG image to a particular size. Its default is FFFFFF00, which is a fully transparent white. When the Alpha value is given in bgcolor, it will just use the generated Alpha values for each pixel. When the Alpha value is not given, it will just color the outer area with a transparent color. The left image uses FFFFFF00 for the background color, and the second uses 666666 for the background color.
There is no difference between using a background color of FFFFFF00 and 00000000. They produce identical results. So, when the background color is fully transparent, its RGB values will not affect the results of the anti-aliasing.
When the Alpha value is above zero and so not fully transparent, the RGB colors do matter. Here is FFFFFF44 on the left and 00000044 on the right. The latter has more solid borders than FFFFFF00, and it has smoother borders than 666666.
Contrary to what I wrote below, GD will now makes the background transparent for any background color that was not fully transparent from the beginning. This keeps it from recoloring the whole space when using an Alpha value above zero.
And if you make all board squares black, you would have the ultimate solid borders, which extend all the way to the square edge.
But if you want more solid outlines than a piece was designed to have, it would be better to make the stroke width an adjustable parameter of the Diagram Designer, just like the fill color. This is trivial to do, by doing a text replacement while the image is still SVG, before rendering it.
25 comments displayed
Permalink to the exact comments currently displayed.
Oh, ok. I guess that makes sense. Unfortunately, that means the diagram designer can't show uncheckered boards, but that's not critical.