AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5907 |
r3wp | 58701 |
total: | 64608 |
results window for this page: [start: 52601 end: 52700]
world-name: r3wp
Group: gfx math ... Graphics or geometry related math discussion [web-public] | ||
Maxim: 25-Feb-2010 | in traditional TV signals, the green color you see actually is the luminance of the signal, so if you separate the green red and blue and look only at the green, you will see exactly the same image as a BW tv. | |
Maxim: 25-Feb-2010 | red and blue are calculated as differences from the luminance and are how the color is added to images. These other two channels of color information will in fact take a fraction of the signal bandwith that the luminance takes, and the green is calculated by the different both red and blue have from the luminance channel. which is why the SAME signal is used for both color and black and white TVs | |
Maxim: 25-Feb-2010 | cyphre... use this as a basis: view layout [box 200x200 effect [ draw [ push [ translate 119x119 pen none fill-pen black box -50x-30 50x50 fill-pen blue pen red line-width 3 circle 50x50 25 fill-pen red pen blue circle -50x50 25 fill-pen blue pen red circle -50x-30 25 fill-pen red pen blue circle 50x-30 25 ] ] ]] adding new black, red, blue, black, circles in betwen colors may give very poor results. sometimes 1 pixel width lines practically disapear horizontally! playing around with the line width will also have a different visual impact, since the aliasing will spread the error more or less. as I said, i know part of the issue is related to the screen's rgb sub-pixel channel components but I remember trying some of this in other softwares and the effects weren't as image degrading. to me the main defect is that you will notice a WHITE ringing effect between the red and blue on one side and a black ring on the other. I can understand the black ring, but can't explain the white one, which is why I think it coule be related to gamma issues. also, the black ring seems to be wider than it should & the effect seems the most apparent at ODD line widths, which is a bit strange too... I'm wondering if AGG has an algorithm which is trying to compensate for pixel to pixel color defects and gets it wrong. maybe it could be enhanced to support subpixel aliasing (or gets it wrong if it already does so). | |
Oldes: 25-Oct-2010 | I'm not sure it this is the best group, but anyway, does anybody already has a script which would take block of images as an input and will layer these images into specified area (a new image). Possibly using as less space as possible. | |
Oldes: 25-Oct-2010 | If there is no such a script, I will write it. But better to ask first not to duplicate work. | |
Robert: 25-Oct-2010 | Sounds like a generic optimization problem with constraints. If you are unlucky this is a NP complexity problem. | |
Geomol: 28-Oct-2010 | Looks cool, and seem to be good result with the rectangle packing. I would like to see a PNG version without the artifacts though. :-) | |
Robert: 29-Oct-2010 | Remembers me on the old C64 days, where graphic chars were packed in a bitmap. | |
Maxim: 11-Jan-2011 | you could try looking visually at a few gradient tests just to understand what is happening, you might find a pattern. | |
Gabriele: 12-Jan-2011 | ie, when you are compositing "img" over "bg", you basically do: bg * (1 - img_alpha) + img * img_alpha they are precomputing img * img_alpha (a common tecnique) so that they can then simply do: bg * (1 - img_alpha) + img | |
Maxim: 15-Jan-2011 | here is a simple function to swap channels from any image in R2 channel-copy: func [ raster [image!] from [word!] to [word!] /into d /local pixel i b p ][ b: to-binary raster d: to-binary any [d raster] from: switch from [ red r [3] green g [2] blue b [1] alpha a [4] ] to: switch to [ red r [3] green g [2] blue b [1] alpha a [4] ] either (xor from to) > 4 [ ; when going to/from alpha we need to switch the value (rebol uses transparency not opacity) repeat i to-integer (length? raster) [ p: i - 1 * 4 poke d p + to to-char (255 - pick b p + from) ] ][ repeat i to-integer (length? raster) [ p: i - 1 * 4 poke d p + to to-char pick b p + from ] ] d: to-image d d/size: raster/size d ] | |
Maxim: 15-Jan-2011 | also note that the function returns a new image (it doesn't modify "in-place") | |
Maxim: 15-Jan-2011 | btw, the swap code is not related to Olde's last question, even if it is loosely related... its a gift function for anyone who needs to copy channels (usually manipulating alphas) | |
DideC: 7-Feb-2011 | Does anybody have done or begin a Box2d port in rebol ? | |
BrianH: 8-Feb-2011 | Maybe atan2 should also have a /radians refinement. | |
Steeve: 8-Feb-2011 | I like that one too. Project: func [ {orthogonal projection of a point P on a line AB, return coordinates [x y]} ax ay bx by px py /local sx sy ux uy ratio ][ sx: bx - ax sy: by - ay ux: px - ax uy: py - ay ratio: sx * ux + (sy * uy) / (sx * sx + (sy * sy)) reuse [ratio * sx + ax ratio * sy + ay] ] | |
BrianH: 8-Feb-2011 | AltME is a little slow for me today. | |
Steeve: 8-Feb-2011 | Maybe Brian you could start a wiki page for that purpose | |
TomBon: 10-Feb-2011 | advise on how to colorize individual countries in a worldmap? take a worldmap, draw background borders between the countries and then floodfill the country via a central coordinate. is this a effective approach? | |
DideC: 10-Feb-2011 | My first though is to have a map (an image) of countries where each country has its own color (call it a color-map) and another map of the same size that you display (diplay-map). Then you have a block of pairs [country-name country-color]. So like this you have a relationship in any sense. Click the displayed map => find the corresponding pixel in the color-map => find the country name in the block. To know the edge of the country you want to fill, just find all the pixels of this same color in the color-map and poke the corresponding pixel on the diplay-map. | |
TomBon: 10-Feb-2011 | yes, a precolorized map would make things simpler. thx didec... | |
Group: !REBOL3 ... [web-public] | ||
Sunanda: 10-Mar-2010 | Raising again the now popular subject of error handling, I'd've thought this line of code should always print 'true.... attempt [do "while [] []"] print 'true ....after all, it has no explicit 'RETURNs or 'BREAKs etc. It's just a bit of unarguably bad code wrapped in an ATTEMPT. (Not sure if this is a new test case, or (to Brian) an obvious application of the known issues; I think of it as a bug:) | |
Steeve: 10-Mar-2010 | It fails in the intrinsic part of DO, I guess (which is a mezz). And as we know well, Mezz can't have [throw] attribute currently | |
BrianH: 10-Mar-2010 | Gabriele, I don't think that, which is why I recommended that it be declared not a bug. I was just surprised. I do think that unwinds should not be assignable though, as that is a security hole and part of a greater problem with their operation. | |
Steeve: 11-Mar-2010 | I'm well aware of this, Brian :) >> attempt [do "while [] []"] print 'true And if i can trust my eyes, it''s a DO string! in Sunanda's example | |
Sunanda: 11-Mar-2010 | Not just my word. Brian. If I type.... do "while [] []" ..... in the console (R2 or R3), the _console_ tells me it is bad code. Now, without wanting to reopen all the dicussion that has gone before, at the very least, this establishes that the console is not (in some cases) a good guide to how a line of code will be interpreted in a larger script. Which goes against the traditional advice that the console is your friend -- such as offered here: http://www.rebol.org/ml-display-message.r?m=rmlMGGC | |
BrianH: 11-Mar-2010 | Steeve, I thought you were talking about the while [return 55][print 1] code, which would be affected by the [throw] attribute because it has a return in it. The attempt [do "while [] []"] print 'true does get processed by the intrinsic, but doesn't fail (it works correctly) and wouldn't be affected by [throw] because it doesn't have a return in it. | |
Steeve: 11-Mar-2010 | Then, how do you explain this ? >> attempt [do "while [][]"] ** Script error: block did not return a value ** Where: while catch either applier do attempt ** Near: while [] [] >> attempt [do [while [][]]] == none | |
Sunanda: 11-Mar-2010 | .....Sounds like it needs a RAMBO and a CC report :) | |
Ladislav: 12-Mar-2010 | Sunanda/Andreas/BrianH: check my comment to the CC #1506 containing a B-CATCH/B-THROW example of a dynamic construct allowing an "in time detection" of unhandled throw | |
Andreas: 12-Mar-2010 | And named throw/catch should be easy to add as well, by just keeping a "stack" of handled names | |
Andreas: 12-Mar-2010 | A suggestion: http://bolka.at/share/bug1506-throw.r[temporary URL] | |
Ladislav: 12-Mar-2010 | just a side note: I do not like named throws, because they can be caught by unnamed Catch, but not rethrown from it (the name is unavailable) | |
Ladislav: 12-Mar-2010 | but, anyway, when we are at discussing it, isn't there a proposal to improve the named throw behaviour? | |
Ladislav: 12-Mar-2010 | Is it supposed to actually "emulate" a definitionally scoped catch/throw? | |
Andreas: 12-Mar-2010 | This would then leave us with the "classical" Common Lisp-style use of named catch/throw for non-local exits. And for this use-case, a definitionally scoped name would certainly be the right thing to do, imho. | |
Gregg: 12-Mar-2010 | Maarten and I used a named throw in a proejct for Qtask, but I don't use it much. The question is, *should* we use it more, and what are the scenarios? It does make some handling read cleaner to me. Maybe Carl can say what he envisioned when he designed it. | |
BrianH: 12-Mar-2010 | I never tried to catch a named throw without a named catch. If that is possible, that is a major bug and should be reported. | |
Gregg: 12-Mar-2010 | Is it a bug, or by design though? i.e. it's a general catch. If the name gets lost on a named throw, that seems an obvious oversight in the design. | |
BrianH: 12-Mar-2010 | That sounds like an error that should be reported by the console. A named throw that doesn't have a corresponding named catch should be treated like it doesn't have a catch at all. | |
BrianH: 12-Mar-2010 | Andreas, the meaning of "non-local" we have been using is code that is *not* in a nested block or paren. Instead, the code is in another function, a block defined elsewhere, whatever. Definitional scoping will only work for local code, meaning code that is in nested blocks. We have to define locality relative to the catch, not the throw, because the catch function is what defines the scoping. | |
BrianH: 12-Mar-2010 | Gregg, CATCH is not a general catch: There is already the /quit option that makes it catch more than it normally would. | |
BrianH: 12-Mar-2010 | Steeve, you might be amused to find out that the DO intrinsic currently depends on bug#1509 and does need a [throw] attribute. Though it still wouldn't work with definitional RETURN because of binding issues. C'est la vie. | |
Gabriele: 13-Mar-2010 | Brian, if a simple CATCH should not catch named throws then we need a CATCH/ALL (not sure if /QUIT should be it). | |
Andreas: 13-Mar-2010 | Gabriele, Brian requested such a thing (CATCH/ALL) as bug#1520. | |
Paul: 14-Mar-2010 | Can someone else confirm if they get a problem with the following ajoin [newline "blah" crlf] | |
BrianH: 14-Mar-2010 | (I have a theory, but need confirmation) | |
Paul: 14-Mar-2010 | I would get a double ^ | |
BrianH: 14-Mar-2010 | It means a bug that goes away when you observe it (or go looking for it). Referring to Heisenberg's Uncertainty Principle. | |
BrianH: 14-Mar-2010 | Andreas, I put a comment in bug#1520 that should deal with your concerns. Take a look. | |
BrianH: 16-Mar-2010 | I understand your take on Carl's proposal for a change in RETURN and EXIT scoping, but it needs some work before it can do the job. For one thing, if you have dynamic as an option (or a default) there is still the need for something like R2's [throw] attribute. And if definitional is an option, not the default, then I'm having a lot of trouble justifying that option, especially since it doesn't solve the [throw] issue or bug#1506. It seems to me that the main reason for definitional is to make a simpler default for less advanced developers. If it's an option that the user has to chose, it doesn't serve that purpose. And if it's an option that gets conflated with the option to specify a typespec for the return value of the function, then this is going to get Fork furious about making REBOL more confusing, and he'll be right this time. | |
Ladislav: 16-Mar-2010 | (that looks like illustrating your note, that 'self is a keyword) | |
BrianH: 16-Mar-2010 | Nope, it is not intended, it is a bug. Report it. | |
BrianH: 16-Mar-2010 | It seems that functions don't bind 'self to the code block, but they do reserve it in the function spec. So that's a separate ticket. | |
BrianH: 16-Mar-2010 | And closures don't bind 'self anymore either (I now vaguely remember a ticket related to that). | |
BrianH: 16-Mar-2010 | That seems like more of a gotcha than a bug though. | |
Ladislav: 16-Mar-2010 | >> a: 'self == self >> b: 'self == self >> same? a b == true | |
Ladislav: 16-Mar-2010 | >> a-body: [self] == [self] >> g: func [] a-body >> same? first a-body first body-of :g == false | |
Ladislav: 16-Mar-2010 | >> a-body: [first [self]] == [first [self]] >> g: func [] a-body >> same? first second a-body g == true | |
BrianH: 16-Mar-2010 | >> a-body: [self same? first a-body 'self] == [self same? first a-body 'self] >> g: func [] a-body >> g == true | |
Pekr: 19-Mar-2010 | I noticed the docs are getting a bit prettier too ... some icons, images, right panel menu, etc. | |
Henrik: 19-Mar-2010 | >> extract/index [a b c d e] 2 2 == [b d none] Is the last NONE desirable? | |
Steeve: 19-Mar-2010 | By example, the refinement /index has absolutly no interest. The obvious and regular way with rebol, is to use SKIP or AT as a prefetch. | |
Steeve: 19-Mar-2010 | see. extract/index [a b c d e] 2 2 vs. extract at [a b c d e] 2 the second one is faster and even shorter to write :) | |
BrianH: 19-Mar-2010 | Henrik, the /index option of EXTRACT assumes that there will be something there at the index (record length specified is assumed), and that the R3-style treatment of series bounds is in effect. That means that the programmer is expected to do their own bounds checking, or to not care. The none value is a placeholder for missing data. | |
BrianH: 19-Mar-2010 | Steeve, the second example you gave was missing a 2 on the end. But still, if that is the answer you want then that is a good way to do that. However, since EXTRACT is used for field extraction fron fixed-length records, Henrik's code is correct for that use. He just forgot to put a value in the proper place in the third record, so it returned none. | |
BrianH: 19-Mar-2010 | Your method didn't return a value at all, as if the whole record was missing; not the same thing at all. | |
BrianH: 19-Mar-2010 | As for the reason for the inclusion of the EXTRACT function and its /index option, it is because of how much they are used, even in mezzanine code. There are a lot of functions there for our convenience, even if they would be easy to remake if missing. This doesn't make them less useful. | |
Henrik: 20-Mar-2010 | Actually, I used it on a table header with arbritrary data and simply wanted every second element in the block, regardless of the block content, so the block was not a db record of any known length. Perhaps it should be emphasized that extract/index works best on, or is intended for database records. | |
Henrik: 20-Mar-2010 | To me this is a case of a method that exists for specific use, but is implemented in a general way. That's OK, I suppose, as long as you know Steeve's way to produce an optimized and more correct result. | |
BrianH: 23-Mar-2010 | Internally, there is none. Ladislav is proposing that the internal 'self field in the beginning of all contexts be made optional, with that option taken by MAKE object! (and as a side effect, modules), but not taken by contexts created by functions, closures and binding structural functions. As opposed to allowing the field to be overriden for that other stuff, and not doing the BIND trick with 'self in those cases (as we demonstrated we can do when that problem was fixed for closures). | |
BrianH: 23-Mar-2010 | The potential problem with Ladislav's proposal is that the internal 'self field might be mandatory for a good reason - we don't know. | |
BrianH: 23-Mar-2010 | And functions and closures don't do the BIND trick with 'self, so that's not a problem. | |
BrianH: 23-Mar-2010 | I am suggesting that this ability to turn off BIND's special treatment of 'self be made available as a BIND/no-self option (or whatever else we decide to call it). This would allow us to write mezzanine functions that act like FOR and such, not necessarily in the sense of looping, but in the sense of not treating 'self weirdly. | |
BrianH: 23-Mar-2010 | The only problem that might need Ladislav's proposal is that you can't use the word 'self as a parameter of functions or closures: A duplicate arg error is thrown. And since you can't use that field as a function argument, Ladislav is suggesting that it shouldn't be there at all. While I am suggesting that MAKE function! can just skip that field when checking function arguments at function creation time - a solution that wouldn't require any changes to the internal data model of all contexts. | |
Steeve: 23-Mar-2010 | Actually, I would like to see a real code where it appears to be a problem | |
Steeve: 23-Mar-2010 | Again, i don't see your point, sorry. Can you just show me a snippet of what can't be done ? | |
BrianH: 23-Mar-2010 | If you are writing code in a script, module or object (which means all code) then the way that you refer to the script, module or object's context is with the word 'self. And if that word is overriden, you can't use it. And those context references are used often. | |
BrianH: 23-Mar-2010 | The use case for allowing 'self as a function argument is less pressing, but since the fix is easy (at least my fix is) there is little problem with fixing this. And it will save a lot of support headaches, or at least a FAQ entry: "Why can't I USE [self] [...]?" | |
Steeve: 23-Mar-2010 | ok i see now, but it's not a problem to my mind, I just use another word to pass the object to inner contexts. context [ this: self x: context [ parent: this ] ] | |
BrianH: 23-Mar-2010 | Ah, but that is when you are *expecting* to override the context. Only advanced users expect FOR and such to override the context. And I don't see the problem: It's an easy fix, as was proved when the exact same fix was applied to MAKE closure! in bug#447. There don't need to be any structural changes; just flip a flag in BIND. | |
BrianH: 23-Mar-2010 | Can you show me a use case for doing the special treatment of 'self in FOR and such? Keep in mind that R2 doesn't do this, so it's only worth doing if it's a definite improvement in some significant way. | |
Steeve: 23-Mar-2010 | and sometimes i use this trick too. context [ a: construct reduce/no-set [ parent: self ] ] | |
Ladislav: 23-Mar-2010 | re your question, Steeve: if you ask for the code to be evaluated by For, do you expect, that For binds some words in the block it evaluates in addition to the words you specify? I doubt it, and it makes a problem. | |
Ladislav: 23-Mar-2010 | In case of the Context function you are in a different situation, since you expect it to bind the word 'self | |
Steeve: 23-Mar-2010 | I just have a problem to see how huge is the burden you noticed. I would like to see some real use case at this point. | |
Ladislav: 23-Mar-2010 | context [ a: "OK" foreach a ["out of luck"] [print self/a] ] | |
Ladislav: 23-Mar-2010 | this may be considered a real use case, compare the results in R2 and R3 | |
Ladislav: 23-Mar-2010 | and, it is not a huge problem, I would call it just a gotcha, but do not like it | |
Ladislav: 23-Mar-2010 | the problem is, that such a situation cannot be "hidden" by any number of hacks, but there is an easy and clean solution: just allow the majority of contexts to not contain the word 'self | |
Steeve: 23-Mar-2010 | honestly , i would never do such thing (to be forced to use a path/var just to avoid name collisions) because i know paths are slower to evaluate than immediate words. And I don't do that in R2 too for the same reason. | |
Ladislav: 23-Mar-2010 | this does not have anything in common with paths, and it is a surprise for me, that you do not see it | |
Ladislav: 23-Mar-2010 | I just used a path to illustrate the difference, but I can as well not use path, which I leave as an exercise for the reader | |
Steeve: 23-Mar-2010 | It's surprising me aswell you don't recognize a simple fact: self/a is a path! it's is a bad design to use them when you can avoid it | |
Ladislav: 23-Mar-2010 | I certainly avoid that, when useful. In this case it was useful as a short example illustrating the problem | |
Ladislav: 23-Mar-2010 | Actually, not, the only problem is, that for you it is a "not real-world enough" code. In that case, feel free to find any example, which would be "real world enough" for you, I do not claim to know, what it is. | |
Ladislav: 23-Mar-2010 | But, anyway, just in hope, that the path is really the only problem for you to see it as "real-world", here is another example: c: context [ a: "OK" foreach b ["out of luck"] [d: self] ] same? c d | |
Steeve: 23-Mar-2010 | What's the point to have d: self in the foreach loop ?. As a not bad connoisseur, I would apply the constant propagation rule and remove the d: setting from the loop. Just arousing you, but honestly it's a worse example than the previous one. It would not harm to not have self anymore in FOR/REPEAT loops, I agree. I simply doubt of the usefulness and the urge of such change, because i simply can't imagine use cases that outmatch the usual way of doing things. (.And I think you neither until now) | |
Ladislav: 23-Mar-2010 | This reminds me a good and funny local novel. Just to paraphrase: S: "draw any triangle" L: "here you are" S: "this is not any triangle, it has a right angle!" L: "here is another one" S: "this is not any triangle, it is an isosceles triangle" ...etc, ad infinitum as I said, I do not claim that I know, what is "real-world for you", and I do not see any point in your trying to convince me I am right | |
BrianH: 23-Mar-2010 | this problem cannot be cured" by bind/no-self, since it requires the user to always know, how he wants to bind the words in the block, while such an information is already "automatically available" (as can be proven in R2)" This is not true. In the case of USE, REPEAT, FOR, FOREACH, MAP-EACH and REMOVE-EACH we don't want the hidden 'self to be bound to the code block, but we *do* want the hidden 'self to be there in the context. In case the context persists beyond the execution of the function, it should be like a normal object context. The same goes for closures. Only for functions do the contexts not have indefinite extent (in R3) - they are stack-relative, so don't work beyond the return of the function. However, in the case of your proposal to not have the 'self in some contexts, there is no way to specify that option in MAKE object! syntax, so the user can't tell whether it is the case or not. This is similar to the map! case-sensitivity option - we can't do it because we don't have the syntax. And we don't want to have anything that affects behavior on non-blackbox types that we can't see in MOLD or MOLD/all. |
52601 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 525 | 526 | [527] | 528 | 529 | ... | 643 | 644 | 645 | 646 | 647 |