* [9fans] How to read/write pixels from Memimage @ 2008-01-25 22:05 Pietro Gagliardi 2008-01-26 14:05 ` Russ Cox 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-25 22:05 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Hello. I'm porting Bell Labs' Pico image language over to Plan 9 to use the Plan 9 native image format (image(6)), and I chose to use Memimage. I'd like to know how to get the 32-bit RGB pixel information out of a Memimage and into a properly allocated array of u32ints, and to do the reverse. Is that possible? Thanks. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-25 22:05 [9fans] How to read/write pixels from Memimage Pietro Gagliardi @ 2008-01-26 14:05 ` Russ Cox 2008-01-26 14:09 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Russ Cox @ 2008-01-26 14:05 UTC (permalink / raw) To: 9fans > Hello. I'm porting Bell Labs' Pico image language over to Plan 9 to > use the Plan 9 native image format (image(6)), and I chose to use > Memimage. I'd like to know how to get the 32-bit RGB pixel > information out of a Memimage and into a properly allocated array of > u32ints, and to do the reverse. Is that possible? Thanks. A good way to answer questions like these is to cd /sys/src/cmd grep -n Memimage *.c */*.c */*/*.c Looking through the output, all of these: /sys/src/cmd/crop.c /sys/src/cmd/resample.c /sys/src/cmd/jpg/writepng.c are examples of programs that use memimages in a byte-at-a-time fashion. Russ ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-26 14:05 ` Russ Cox @ 2008-01-26 14:09 ` Pietro Gagliardi 2008-01-26 14:55 ` Russ Cox 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-26 14:09 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs However, I want to be able to read 32-bit color values. How does Memimage store colors and will the code I use work? I can change it to 24-bit if necessary, but that would make it slower to read files. If I do what these programs say, how will my u32int be arranged? On Jan 26, 2008, at 9:05 AM, Russ Cox wrote: >> Hello. I'm porting Bell Labs' Pico image language over to Plan 9 to >> use the Plan 9 native image format (image(6)), and I chose to use >> Memimage. I'd like to know how to get the 32-bit RGB pixel >> information out of a Memimage and into a properly allocated array of >> u32ints, and to do the reverse. Is that possible? Thanks. > > A good way to answer questions like these is to > > cd /sys/src/cmd > grep -n Memimage *.c */*.c */*/*.c > > Looking through the output, all of these: > > /sys/src/cmd/crop.c > /sys/src/cmd/resample.c > /sys/src/cmd/jpg/writepng.c > > are examples of programs that use memimages > in a byte-at-a-time fashion. > > Russ > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-26 14:09 ` Pietro Gagliardi @ 2008-01-26 14:55 ` Russ Cox 2008-01-26 23:22 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Russ Cox @ 2008-01-26 14:55 UTC (permalink / raw) To: 9fans > However, I want to be able to read 32-bit color values. How does > Memimage store colors and You should be able to answer this by reading the programs I pointed out as well as color(6), image(6), and memdraw(2). If all else fails, you could try writing a simple program and see how far you get. > will the code I use work? Probably not at first (whose code does?), but eventually. > I can change it to 24-bit if necessary, but that would make it slower to read files. > If I do what these programs say, how will my u32int be arranged? The answers to these questions are *in* those programs (not to mention the manual pages!). Given that your reply came in four minutes after my post, it sounds like you didn't actually read the programs I pointed out. The first one on the list, /sys/src/cmd/crop.c, picks up a Plan 9 image file and then walks over every 32-bit pixel looking for a given color. And it's only 211 lines. Between that and the documentation I'd think that would be enough to answer questions about how colors are stored. At the least it should prompt questions that are more specific than "how do I do this?" Read /sys/src/cmd/crop.c, color(6), image(6), and memdraw(2). Russ ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-26 14:55 ` Russ Cox @ 2008-01-26 23:22 ` Pietro Gagliardi 2008-01-27 18:05 ` Skip Tavakkolian 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-26 23:22 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs The code led me to confusion, so I just decided to use wordaddr. It works properly now, and my Pico is now up at /n/sources/contrib/ pietro/pico9.tgz (note the 9). Details are in README.Plan9, test files are in /lib/face/. On Jan 26, 2008, at 9:55 AM, Russ Cox wrote: >> However, I want to be able to read 32-bit color values. How does >> Memimage store colors and > > You should be able to answer this by reading the programs > I pointed out as well as color(6), image(6), and memdraw(2). > If all else fails, you could try writing a simple program and > see how far you get. > >> will the code I use work? > > Probably not at first (whose code does?), but eventually. > >> I can change it to 24-bit if necessary, but that would make it >> slower to read files. >> If I do what these programs say, how will my u32int be arranged? > > The answers to these questions are *in* those programs > (not to mention the manual pages!). Given that your reply > came in four minutes after my post, it sounds like you didn't > actually read the programs I pointed out. The first one on > the list, /sys/src/cmd/crop.c, picks up a Plan 9 image file > and then walks over every 32-bit pixel looking for a given color. > And it's only 211 lines. Between that and the documentation > I'd think that would be enough to answer questions about > how colors are stored. At the least it should prompt > questions that are more specific than "how do I do this?" > > Read /sys/src/cmd/crop.c, color(6), image(6), and memdraw(2). > > Russ > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-26 23:22 ` Pietro Gagliardi @ 2008-01-27 18:05 ` Skip Tavakkolian 2008-01-27 18:55 ` Pietro Gagliardi ` (2 more replies) 0 siblings, 3 replies; 28+ messages in thread From: Skip Tavakkolian @ 2008-01-27 18:05 UTC (permalink / raw) To: 9fans > The code led me to confusion, so I just decided to use wordaddr. It > works properly now, and my Pico is now up at /n/sources/contrib/ > pietro/pico9.tgz (note the 9). Details are in README.Plan9, test > files are in /lib/face/. some book examples are failing: cpu% 8.out 1: new[x,y] = x % y 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-27 18:05 ` Skip Tavakkolian @ 2008-01-27 18:55 ` Pietro Gagliardi 2008-01-27 19:29 ` [9fans] pico Steve Simon 2008-01-27 19:14 ` [9fans] How to read/write pixels from Memimage Pietro Gagliardi 2008-01-27 23:44 ` Pietro Gagliardi 2 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-27 18:55 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs That transformation is in the book? It divides by zero for y == 0. I have to look. I'm working on an update. It adds: r x y w h file (done) Reads a certain rectangle of a file. This makes crop(1)'s -r option three lines of rc or /bin/sh: echo 'r '$1' '$2' '$3' '$4' '$5' new = old w '$6 | pico Simple variables (started) Undo command u (done) Use of RGB24 instead of RGBA32 to make the examples work (done) Using Brdstr instead of Bgetc/Bungetc (this is not working) On Jan 27, 2008, at 1:05 PM, Skip Tavakkolian wrote: >> The code led me to confusion, so I just decided to use wordaddr. It >> works properly now, and my Pico is now up at /n/sources/contrib/ >> pietro/pico9.tgz (note the 9). Details are in README.Plan9, test >> files are in /lib/face/. > > some book examples are failing: > > cpu% 8.out > 1: new[x,y] = x % y > 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd > ^ permalink raw reply [flat|nested] 28+ messages in thread
* [9fans] pico 2008-01-27 18:55 ` Pietro Gagliardi @ 2008-01-27 19:29 ` Steve Simon 2008-01-28 23:36 ` Russ Cox 0 siblings, 1 reply; 28+ messages in thread From: Steve Simon @ 2008-01-27 19:29 UTC (permalink / raw) To: 9fans FYI Byron Rakitzis (of posix rc fame) produced a version popi with the JIT compiler, though sadly his where for cpus which are common cpus these days. Also possibly of interest is the paper from the 10th edition manual http://plan9.bell-labs.com/10thEdMan/pico.pdf And a few fun pictures that where generated http://plan9.bell-labs.com/10thEdMan/v2pix.html -Steve ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-27 19:29 ` [9fans] pico Steve Simon @ 2008-01-28 23:36 ` Russ Cox 2008-01-29 0:30 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Russ Cox @ 2008-01-28 23:36 UTC (permalink / raw) To: 9fans > Byron Rakitzis (of posix rc fame) produced a version popi with the JIT > compiler, though sadly his where for cpus which are common cpus these days. Computers and compilers are fast enough now that you can get away with just feeding code into a C compiler instead of writing a full JIT. And there's no porting to do! I just put a pico on sources that does this - 738 lines, not many of which are the "JIT". 9fs sources cd /n/sources/contrib/rsc/pico mk demo Russ ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-28 23:36 ` Russ Cox @ 2008-01-29 0:30 ` Pietro Gagliardi 2008-01-29 5:30 ` Bruce Ellis 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-29 0:30 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Wow, that's very impressive! open: /tmp/something does not exist (2x) no image lerp no image doug But you have a preview, which I was going to add soon. I am sticking with my code interpreter because I know how to use one (I toiled over hoc. and fossil ate my code up last December) and it doesn't require hooking to a C compiler. I do like the preprocessor idea though. On Jan 28, 2008, at 6:36 PM, Russ Cox wrote: >> Byron Rakitzis (of posix rc fame) produced a version popi with the >> JIT >> compiler, though sadly his where for cpus which are common cpus >> these days. > > Computers and compilers are fast enough now > that you can get away with just feeding code > into a C compiler instead of writing a full JIT. > And there's no porting to do! > > I just put a pico on sources that does this - 738 lines, > not many of which are the "JIT". > > 9fs sources > cd /n/sources/contrib/rsc/pico > mk demo > > Russ > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-29 0:30 ` Pietro Gagliardi @ 2008-01-29 5:30 ` Bruce Ellis 2008-01-29 20:33 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Bruce Ellis @ 2008-01-29 5:30 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs well i agree that russ did a good job but JITs are fun and often make things 10 times faster. brucee On Jan 29, 2008 11:30 AM, Pietro Gagliardi <pietro10@mac.com> wrote: > Wow, that's very impressive! > > open: /tmp/something does not exist (2x) > no image lerp > no image doug > > But you have a preview, which I was going to add soon. > > I am sticking with my code interpreter because I know how to use one > (I toiled over hoc. and fossil ate my code up last December) and it > doesn't require hooking to a C compiler. I do like the preprocessor > idea though. > > > On Jan 28, 2008, at 6:36 PM, Russ Cox wrote: > > >> Byron Rakitzis (of posix rc fame) produced a version popi with the > >> JIT > >> compiler, though sadly his where for cpus which are common cpus > >> these days. > > > > Computers and compilers are fast enough now > > that you can get away with just feeding code > > into a C compiler instead of writing a full JIT. > > And there's no porting to do! > > > > I just put a pico on sources that does this - 738 lines, > > not many of which are the "JIT". > > > > 9fs sources > > cd /n/sources/contrib/rsc/pico > > mk demo > > > > Russ > > > > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-29 5:30 ` Bruce Ellis @ 2008-01-29 20:33 ` Pietro Gagliardi 2008-01-29 20:35 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-29 20:33 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs In the latest update, I tried adding differentiating between color and b/w images. However, I can't test anything because every time I try a line like x new = dennis I get something that ends in "(double-free?)" and then the program crashes, but something like x new x new = do call the error() function. The lexer did not change since I started this update, but it did change when I improved symbol handling. On Jan 29, 2008, at 12:30 AM, Bruce Ellis wrote: > well i agree that russ did a good job but JITs are fun and often > make things 10 times faster. > > brucee > > On Jan 29, 2008 11:30 AM, Pietro Gagliardi <pietro10@mac.com> wrote: >> Wow, that's very impressive! >> >> open: /tmp/something does not exist (2x) >> no image lerp >> no image doug >> >> But you have a preview, which I was going to add soon. >> >> I am sticking with my code interpreter because I know how to use one >> (I toiled over hoc. and fossil ate my code up last December) and it >> doesn't require hooking to a C compiler. I do like the preprocessor >> idea though. >> >> >> On Jan 28, 2008, at 6:36 PM, Russ Cox wrote: >> >>>> Byron Rakitzis (of posix rc fame) produced a version popi with the >>>> JIT >>>> compiler, though sadly his where for cpus which are common cpus >>>> these days. >>> >>> Computers and compilers are fast enough now >>> that you can get away with just feeding code >>> into a C compiler instead of writing a full JIT. >>> And there's no porting to do! >>> >>> I just put a pico on sources that does this - 738 lines, >>> not many of which are the "JIT". >>> >>> 9fs sources >>> cd /n/sources/contrib/rsc/pico >>> mk demo >>> >>> Russ >>> >> >> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-29 20:33 ` Pietro Gagliardi @ 2008-01-29 20:35 ` Pietro Gagliardi 2008-01-29 22:46 ` Russ Cox 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-29 20:35 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs This only happens with black/white images, I ran a color image (boyd) through and it worked fine. I think it's with the run function... On Jan 29, 2008, at 3:33 PM, Pietro Gagliardi wrote: > In the latest update, I tried adding differentiating between color > and b/w images. However, I can't test anything because every time I > try a line like > > x new = dennis > > I get something that ends in "(double-free?)" and then the program > crashes, but something like > > x new > x new = > > do call the error() function. The lexer did not change since I > started this update, but it did change when I improved symbol > handling. > > On Jan 29, 2008, at 12:30 AM, Bruce Ellis wrote: > >> well i agree that russ did a good job but JITs are fun and often >> make things 10 times faster. >> >> brucee >> >> On Jan 29, 2008 11:30 AM, Pietro Gagliardi <pietro10@mac.com> wrote: >>> Wow, that's very impressive! >>> >>> open: /tmp/something does not exist (2x) >>> no image lerp >>> no image doug >>> >>> But you have a preview, which I was going to add soon. >>> >>> I am sticking with my code interpreter because I know how to use one >>> (I toiled over hoc. and fossil ate my code up last December) and it >>> doesn't require hooking to a C compiler. I do like the preprocessor >>> idea though. >>> >>> >>> On Jan 28, 2008, at 6:36 PM, Russ Cox wrote: >>> >>>>> Byron Rakitzis (of posix rc fame) produced a version popi with the >>>>> JIT >>>>> compiler, though sadly his where for cpus which are common cpus >>>>> these days. >>>> >>>> Computers and compilers are fast enough now >>>> that you can get away with just feeding code >>>> into a C compiler instead of writing a full JIT. >>>> And there's no porting to do! >>>> >>>> I just put a pico on sources that does this - 738 lines, >>>> not many of which are the "JIT". >>>> >>>> 9fs sources >>>> cd /n/sources/contrib/rsc/pico >>>> mk demo >>>> >>>> Russ >>>> >>> >>> > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-29 20:35 ` Pietro Gagliardi @ 2008-01-29 22:46 ` Russ Cox 2008-01-30 1:13 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Russ Cox @ 2008-01-29 22:46 UTC (permalink / raw) To: 9fans > I get something that ends in "(double-free?)" and then the program > crashes, but something like This usually means you have freed the same pointer twice or you are passing a pointer to free that was not returned by malloc. If you run acid to get a stack trace to see the context of the free, that is often enough to identify the problem. % acid pid acid: stk() ... ^D % Russ ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-29 22:46 ` Russ Cox @ 2008-01-30 1:13 ` Pietro Gagliardi 2008-01-30 6:53 ` Bruce Ellis 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-30 1:13 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs In this case, it only told me where the program crashed, which told me nothing on why (because a different line or a color image worked). On Jan 29, 2008, at 5:46 PM, Russ Cox wrote: >> I get something that ends in "(double-free?)" and then the program >> crashes, but something like > > This usually means you have freed the same pointer twice > or you are passing a pointer to free that was not returned > by malloc. If you run acid to get a stack trace to see the > context of the free, that is often enough to identify the > problem. > > % acid pid > acid: stk() > ... > ^D > % > > Russ > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-30 1:13 ` Pietro Gagliardi @ 2008-01-30 6:53 ` Bruce Ellis 2008-01-30 23:42 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Bruce Ellis @ 2008-01-30 6:53 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs work it out. it's called debugging. brucee On Jan 30, 2008 12:13 PM, Pietro Gagliardi <pietro10@mac.com> wrote: > In this case, it only told me where the program crashed, which told > me nothing on why (because a different line or a color image worked). > > > On Jan 29, 2008, at 5:46 PM, Russ Cox wrote: > > >> I get something that ends in "(double-free?)" and then the program > >> crashes, but something like > > > > This usually means you have freed the same pointer twice > > or you are passing a pointer to free that was not returned > > by malloc. If you run acid to get a stack trace to see the > > context of the free, that is often enough to identify the > > problem. > > > > % acid pid > > acid: stk() > > ... > > ^D > > % > > > > Russ > > > > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-30 6:53 ` Bruce Ellis @ 2008-01-30 23:42 ` Pietro Gagliardi 2008-01-30 23:55 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-30 23:42 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 256 bytes --] What do you think I've been doing? :-) The problem seems to be in run(), because after run() returns, poolcheck fails. I'll go check it out. On Jan 30, 2008, at 1:53 AM, Bruce Ellis wrote: > work it out. it's called debugging. > > brucee [-- Attachment #2: Type: text/html, Size: 903 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-30 23:42 ` Pietro Gagliardi @ 2008-01-30 23:55 ` Pietro Gagliardi 2008-01-31 7:41 ` Bruce Ellis 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-30 23:55 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 514 bytes --] Well, I got the memory tampering bugs fixed, but a black and white image now does not show correctly. Gonna go back and check and fix. Will report when I put a new version up. On Jan 30, 2008, at 6:42 PM, Pietro Gagliardi wrote: > What do you think I've been doing? :-) > > The problem seems to be in run(), because after run() returns, > poolcheck fails. I'll go check it out. > > On Jan 30, 2008, at 1:53 AM, Bruce Ellis wrote: > >> work it out. it's called debugging. >> >> brucee > [-- Attachment #2: Type: text/html, Size: 1410 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-30 23:55 ` Pietro Gagliardi @ 2008-01-31 7:41 ` Bruce Ellis 2008-02-05 3:01 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Bruce Ellis @ 2008-01-31 7:41 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs more debugging, please tell us about it. yawn. On Jan 31, 2008 10:55 AM, Pietro Gagliardi <pietro10@mac.com> wrote: > > Well, I got the memory tampering bugs fixed, but a black and white image now > does not show correctly. Gonna go back and check and fix. Will report when I > put a new version up. > > > > On Jan 30, 2008, at 6:42 PM, Pietro Gagliardi wrote: > > What do you think I've been doing? :-) > > The problem seems to be in run(), because after run() returns, poolcheck > fails. I'll go check it out. > > On Jan 30, 2008, at 1:53 AM, Bruce Ellis wrote: > > work it out. it's called debugging. > > brucee > > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] pico 2008-01-31 7:41 ` Bruce Ellis @ 2008-02-05 3:01 ` Pietro Gagliardi 0 siblings, 0 replies; 28+ messages in thread From: Pietro Gagliardi @ 2008-02-05 3:01 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Okay, I got everything fixed a few days ago and added some more features (simple arrays, r "long/file/name.1", etc.). The new pico is in the usual place. I'm redesigning my website, so I'm going to have my software available from there too when that's done. On Jan 31, 2008, at 2:41 AM, Bruce Ellis wrote: > more debugging, please tell us about it. yawn. > > On Jan 31, 2008 10:55 AM, Pietro Gagliardi <pietro10@mac.com> wrote: >> >> Well, I got the memory tampering bugs fixed, but a black and white >> image now >> does not show correctly. Gonna go back and check and fix. Will >> report when I >> put a new version up. >> >> >> >> On Jan 30, 2008, at 6:42 PM, Pietro Gagliardi wrote: >> >> What do you think I've been doing? :-) >> >> The problem seems to be in run(), because after run() returns, >> poolcheck >> fails. I'll go check it out. >> >> On Jan 30, 2008, at 1:53 AM, Bruce Ellis wrote: >> >> work it out. it's called debugging. >> >> brucee >> >> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-27 18:05 ` Skip Tavakkolian 2008-01-27 18:55 ` Pietro Gagliardi @ 2008-01-27 19:14 ` Pietro Gagliardi 2008-01-27 23:44 ` Pietro Gagliardi 2 siblings, 0 replies; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-27 19:14 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Well I just found it, and I couldn't believe it. I'm going to look at Gerard's original source for the VAX and see what he does on divide by zero. On Jan 27, 2008, at 1:05 PM, Skip Tavakkolian wrote: >> The code led me to confusion, so I just decided to use wordaddr. It >> works properly now, and my Pico is now up at /n/sources/contrib/ >> pietro/pico9.tgz (note the 9). Details are in README.Plan9, test >> files are in /lib/face/. > > some book examples are failing: > > cpu% 8.out > 1: new[x,y] = x % y > 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-27 18:05 ` Skip Tavakkolian 2008-01-27 18:55 ` Pietro Gagliardi 2008-01-27 19:14 ` [9fans] How to read/write pixels from Memimage Pietro Gagliardi @ 2008-01-27 23:44 ` Pietro Gagliardi 2008-01-28 0:18 ` Pietro Gagliardi 2 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-27 23:44 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Okay, I just found out that division by zero meant a black pixel would be placed, so I am going to add that and upload a new version. On Jan 27, 2008, at 1:05 PM, Skip Tavakkolian wrote: >> The code led me to confusion, so I just decided to use wordaddr. It >> works properly now, and my Pico is now up at /n/sources/contrib/ >> pietro/pico9.tgz (note the 9). Details are in README.Plan9, test >> files are in /lib/face/. > > some book examples are failing: > > cpu% 8.out > 1: new[x,y] = x % y > 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-27 23:44 ` Pietro Gagliardi @ 2008-01-28 0:18 ` Pietro Gagliardi 2008-01-28 1:08 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-28 0:18 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs It's up. On Jan 27, 2008, at 6:44 PM, Pietro Gagliardi wrote: > Okay, I just found out that division by zero meant a black pixel > would be placed, so I am going to add that and upload a new version. > > On Jan 27, 2008, at 1:05 PM, Skip Tavakkolian wrote: > >>> The code led me to confusion, so I just decided to use wordaddr. It >>> works properly now, and my Pico is now up at /n/sources/contrib/ >>> pietro/pico9.tgz (note the 9). Details are in README.Plan9, test >>> files are in /lib/face/. >> >> some book examples are failing: >> >> cpu% 8.out >> 1: new[x,y] = x % y >> 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd >> > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-28 0:18 ` Pietro Gagliardi @ 2008-01-28 1:08 ` Pietro Gagliardi 2008-01-28 1:22 ` erik quanstrom 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-28 1:08 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Another question: in RGB24, how are colors composited: 0x00RRGGBB or 0xRRGGBB00? I can't seem to get a picture that is solid red; just a wacky line art picture. On Jan 27, 2008, at 7:18 PM, Pietro Gagliardi wrote: > It's up. > > On Jan 27, 2008, at 6:44 PM, Pietro Gagliardi wrote: > >> Okay, I just found out that division by zero meant a black pixel >> would be placed, so I am going to add that and upload a new version. >> >> On Jan 27, 2008, at 1:05 PM, Skip Tavakkolian wrote: >> >>>> The code led me to confusion, so I just decided to use wordaddr. It >>>> works properly now, and my Pico is now up at /n/sources/contrib/ >>>> pietro/pico9.tgz (note the 9). Details are in README.Plan9, test >>>> files are in /lib/face/. >>> >>> some book examples are failing: >>> >>> cpu% 8.out >>> 1: new[x,y] = x % y >>> 8.out 181613: suicide: sys: trap: divide error pc=0x000023fd >>> >> > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-28 1:08 ` Pietro Gagliardi @ 2008-01-28 1:22 ` erik quanstrom 2008-01-28 3:23 ` Pietro Gagliardi 0 siblings, 1 reply; 28+ messages in thread From: erik quanstrom @ 2008-01-28 1:22 UTC (permalink / raw) To: 9fans > Another question: in RGB24, how are colors composited: 0x00RRGGBB or > 0xRRGGBB00? I can't seem to get a picture that is solid red; just a > wacky line art picture. read image(6). all the details are spelled out there. (you likely want an alpha channel in your image, so that each pixel is 4 bytes.) - erik ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-28 1:22 ` erik quanstrom @ 2008-01-28 3:23 ` Pietro Gagliardi 2008-01-28 9:24 ` mattmobile 0 siblings, 1 reply; 28+ messages in thread From: Pietro Gagliardi @ 2008-01-28 3:23 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 410 bytes --] On Jan 27, 2008, at 8:22 PM, erik quanstrom wrote: > (you likely want an alpha > channel in your image, so that each pixel is 4 bytes.) Apparently, my RGB24 manipulation was wrong, and now it works like a charm. The next step is to support a construct like new.red and to eliminate the use of undocumented stuff (I peeked in /sys/include/ draw.h and /sys/src/libbio/brdstr.c for some hacks). [-- Attachment #2: Type: text/html, Size: 902 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-28 3:23 ` Pietro Gagliardi @ 2008-01-28 9:24 ` mattmobile 2008-01-28 16:20 ` ron minnich 0 siblings, 1 reply; 28+ messages in thread From: mattmobile @ 2008-01-28 9:24 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs 9fans is not a blog, try blogger.com > > >> (you likely want an alpha >> >> channel in your image, so that each pixel is 4 bytes.) >> > > Apparently, my RGB24 manipulation was wrong, and now it works like a > charm. The next step is to support a construct like new.red and to > eliminate the use of undocumented stuff (I peeked in > /sys/include/draw.h and /sys/src/libbio/brdstr.c for some hacks). > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [9fans] How to read/write pixels from Memimage 2008-01-28 9:24 ` mattmobile @ 2008-01-28 16:20 ` ron minnich 0 siblings, 0 replies; 28+ messages in thread From: ron minnich @ 2008-01-28 16:20 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Jan 28, 2008 1:24 AM, <mattmobile@proweb.co.uk> wrote: > 9fans is not a blog, try blogger.com now now now :-) Why give the guy a hard time, he's actually discussing real coding he is doing :-) ron ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2008-02-05 3:01 UTC | newest] Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-01-25 22:05 [9fans] How to read/write pixels from Memimage Pietro Gagliardi 2008-01-26 14:05 ` Russ Cox 2008-01-26 14:09 ` Pietro Gagliardi 2008-01-26 14:55 ` Russ Cox 2008-01-26 23:22 ` Pietro Gagliardi 2008-01-27 18:05 ` Skip Tavakkolian 2008-01-27 18:55 ` Pietro Gagliardi 2008-01-27 19:29 ` [9fans] pico Steve Simon 2008-01-28 23:36 ` Russ Cox 2008-01-29 0:30 ` Pietro Gagliardi 2008-01-29 5:30 ` Bruce Ellis 2008-01-29 20:33 ` Pietro Gagliardi 2008-01-29 20:35 ` Pietro Gagliardi 2008-01-29 22:46 ` Russ Cox 2008-01-30 1:13 ` Pietro Gagliardi 2008-01-30 6:53 ` Bruce Ellis 2008-01-30 23:42 ` Pietro Gagliardi 2008-01-30 23:55 ` Pietro Gagliardi 2008-01-31 7:41 ` Bruce Ellis 2008-02-05 3:01 ` Pietro Gagliardi 2008-01-27 19:14 ` [9fans] How to read/write pixels from Memimage Pietro Gagliardi 2008-01-27 23:44 ` Pietro Gagliardi 2008-01-28 0:18 ` Pietro Gagliardi 2008-01-28 1:08 ` Pietro Gagliardi 2008-01-28 1:22 ` erik quanstrom 2008-01-28 3:23 ` Pietro Gagliardi 2008-01-28 9:24 ` mattmobile 2008-01-28 16:20 ` ron minnich
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).