New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fl_Cairo_Window docs should describe the default coordinate system #358
Comments
Got my example working so assigning myself. Seems the default coordinate space for Fl_Cairo_Window is FLTK's, and one has to watch it with any cairo example code that assumes normalized space (0,0,1,1), which I guess is cairo's default. And the coord space affects functions like line width, so using cairo examples can end up drawing nothing because the line width is too small for FLTK coord space. Ill add some docs to include a working example for both FLTK coord space and normalized space, so folks approaching Fl_Cairo_Window from cairo example code can get things to work too. Should also add a comment the cairo test code about what the cairo_scale(cr,w(),h()) function's purpose, which is to enable cairo's normalized coord space. |
Attaching a patch suggestion to add a new Will follow up with a |
@erco77 I took a stab at this (because it's CMake related) and it works well both with and without Cairo enabled. Here's my patch: I tried your patch ( Unfortunately I don't know of a simple way to "know" (in the Makefile) if FLTK has been configured with or w/o Cairo and I believe the better way to go in That said, feel free to use my CMake patch... |
I suppose if you're going to be removing the cairo lib, then perhaps it'll be a non-issue, as the link would then succeed because the code checks for FLTK_HAVE_CAIRO and shows a dialog. To fix |
Regarding I think the relevant information should be in The |
This could probably be done better by But I need to look deeper into it (probably tomorrow). This is something I need to do anyway for better CMake integration (some parts that are supported by configure are still missing in the CMake generation of fltk-config). |
Attaching a v1 patch fltk-config-v1.patch.txt which seems to solve the issue with But there's more than one way to cook an egg, so it can be changed later when you have some time. |
Ah, just seeing your msg about using configure/cmake to build fltk-config more appropriately. Sounds fine, I'll leave that to you then. Mind if I apply my mods along with the above |
The only problem I see is if
If you think |
I can use |
Since this is the first cairo example in the examples directory, it necessarily involved changes to the Makefile and to fltk-config to properly handle the absence/existance of the cairo libs. TBD: Add docs to the cario widget describing coordinate system and how it differs from the default cairo normalized coordinate system.
Working on adding your cmake patch -- need to test it first. |
OK, committed your cmake patch as 313212b. |
Elaborated on Fl_Cairo_Window's use of FLTK style coordinates, and how this differs from cairo's default native normalized coordinate system, and shows how to switch from one to the other. Also, small comment fix to the cairo example regarding the "X" color.
Sorry for the noise, this statement was included in my proposed patch.
Everything's fine from my POV. I just removed a CMake test statement (cd611e3) which was a leftover from my tests in the CMake patch posted above. |
The Fl_Cairo_Window docs are rather thin. Currently one has to refer to the test programs to understand how to draw anything. (I'm trying to figure this out now)
I'd suggest:
If I get my test program working, I can write the docs and solve this issue, but currently having trouble just drawing an X.
The text was updated successfully, but these errors were encountered: