World: r4wp
[#Red] Red language group
older newer | first last |
Kaj 8-Feb-2013 [5484] | You're right about LDA #. :-) It's also $A9. I had the same problem, wrote a disassembler in Atari BASIC until I could get hold of an assembler, so also have a considerable part of my brain dedicated to such numbers :-) |
Bo 8-Feb-2013 [5485x2] | With the following code: #include %GTK.reds with gdk [ err: declare struct! [value [g/g-error!]] myimg: load-image "image.jpg" err ] I get the following error: *** Compilation Error: invalid literal syntax: [value [g/g-error!]] If I change it to: err: declare struct! [value [c-string!]] I get the following error: *** Compilation Error: argument type mismatch on calling: gdk/load-image *** expected: [struct! [value [g/g-error!]]], found: [struct! [value [c-string!]]] |
What am I missing? | |
Kaj 8-Feb-2013 [5487x2] | You can't use path notation on types. I've been trying to coerce Doc into implementing that, but he doesn't want to. :-/ |
So you have to use an extra WITH g [...]. You can combine that as WITH [gdk g] [...] | |
Bo 8-Feb-2013 [5489] | Aha! That did the trick! |
Kaj 8-Feb-2013 [5490x3] | By the way, if you only use images, you could do with including only GDK.reds. That would cut down on the dependencies |
Instead of your struct definition, you can use g-error-reference! which is already defined in GLib.reds | |
There's an example of using load-image in GTK.reds in the icon function | |
Bo 8-Feb-2013 [5493x4] | Thanks! When I use load-image, it looks like it is returning a pointer. Is that correct? |
For instance: 00DFD2B8 | |
If 'load-image returns a pointer, how do I know when I have reached the end of the image? | |
Better yet, assuming 'load-image returns a pointer, how do I access the first memory location referenced by the pointer? | |
Kaj 8-Feb-2013 [5497x3] | See the function spec in GDK.reds. It returns a pointer to an image! struct, so if you want to access the image internally, you have to go by that struct definition |
As you can see in the same file, I haven't finished the definition of that struct, because I don't have to look inside the image | |
What is your goal? | |
Kaj 9-Feb-2013 [5500] | Doc, could you bring lex-scope up to date with master? Then I can start testing it |
DocKimbel 9-Feb-2013 [5501] | Done. |
Kaj 9-Feb-2013 [5502] | Thanks! Been anxiously awaiting those fixes |
DocKimbel 9-Feb-2013 [5503] | I'm working on fixing #405 too in the lex-scope branch. Once that done, I will merge it in master if there is no regression. |
Kaj 9-Feb-2013 [5504] | I figured so |
DocKimbel 9-Feb-2013 [5505] | I might add #374 too the list too as it is related to scoping. |
Kaj 9-Feb-2013 [5506x4] | I hoped so :-) |
No build regressions in a full build run | |
Oddly, there's a build regression in a GTK program just for Syllable, which is not even a valid combination | |
I can't replicate it | |
Bo 10-Feb-2013 [5510] | I want to be able to compare two images pixel-by-pixel. |
Kaj 10-Feb-2013 [5511x4] | Ah, that's relatively easy, because you don't have to know the image format. At least not if you can compare byte values instead of strict pixels |
So you only have to look in the GDK/GLib headers to finish the image! struct definition enough to know the data length | |
Have to run | |
Do you only want two know if two images are the same? Then why not just read the files and compare them? | |
Bo 10-Feb-2013 [5515] | Actually, I want to know which pixels are different between the two images. Thanks for the tips! |
Kaj 10-Feb-2013 [5516x2] | You'd have to know GDK's internal image format, then |
Perhaps there are more suitable functions in Oldes' ImageMagick binding | |
Bo 10-Feb-2013 [5518x2] | I'll take a look. |
Looks like ImageMagick will do the trick, if I can just figure how to translate the tutorials from C to Red/System. | |
DocKimbel 11-Feb-2013 [5520] | Kaj: are we good with the fixes in lex-scope branch? If all is fine, I will merge it tonight. |
Kaj 11-Feb-2013 [5521] | Yep, it's starting to look good. I'll build the examples once more |
DocKimbel 11-Feb-2013 [5522] | Great, I'll add a few binding tests from the tickets, then I'll do the merge. |
Kaj 11-Feb-2013 [5523x3] | No build problems |
I'm happy to report that literal arguments work now. For example: | |
cycle: func ["Cycle a series through its index." 'series [word!] /local s ][ either tail? s: get series [ set series next head s first head s ][ set series next s s/1 ] ] | |
DocKimbel 11-Feb-2013 [5526x2] | Nice one! |
Branch `lex-scope` merged in master. | |
Kaj 11-Feb-2013 [5528x2] | It seems that the optional attributes and function description are swapped in Red/System compared to REBOL. Is that intentional? |
http://www.rebol.com/r3/docs/concepts/funcs-defining.html#section-1 | |
DocKimbel 11-Feb-2013 [5530x2] | Yes, it makes it easier and faster to find optional attributes this way. |
We could change it though, it's no significant impact on the compiler. | |
Gregg 11-Feb-2013 [5532] | I believe REBOL allows either order, so it's just the docs that say it has to be that way. |
Kaj 11-Feb-2013 [5533] | I like the REBOL order better in the formatting of the program |
older newer | first last |