How does one use RasterOp when drawing lines, circles, etc? I'd like
to be able to draw and erase resizing rectangles and graphical object handes for example. Thanks. -Carl Gundel http://www.libertybasic.com http://www.runbasic.com _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
On Sat, Dec 24, 2011 at 1:10 AM, Carl Gundel <[hidden email]> wrote:
> How does one use RasterOp when drawing lines, circles, etc? I'd like > to be able to draw and erase resizing rectangles and graphical object > handes for example. Thanks. Any thoughts on this? It just isn't clear to me from the documentation how this is done, and the references to RasterOp in the image suggest to me that it's only good for copying rectangular bitmaps. -Carl Gundel http://www.libertybasic.com http://www.runbasic.com _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
On Wed, Dec 28, 2011 at 12:37 PM, Carl Gundel <[hidden email]> wrote:
Ive done a tiny bit of this... the only useful rasterOp I found is the equivalent of XOR which inverts the black&white pixels - effectively erasing them. So you redraw your existing lines in XOR mode, then update coordinates, and re-draw with normal mode. The net visual effect is your lines move. Its not a 100% perfect solution, but its quite fast and very simple to code.
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Jon,
Yes, that's the sort of usage I'm talking about. With VisualSmalltalk I only need to set the combination rule for a Pen object and then I can draw anything I want directly and the rule will be applied. With VW it seems like if I want to draw a line then I need to create a bitmap and then draw a line on it, and then draw that bitmap onto the destination bitmap using the desired RasterOp rule (number 9 it seems). Seems terribly wasteful and inefficient and I have to write special code to make it happen. -Carl On Wed, Dec 28, 2011 at 4:28 PM, Jon Paynter <[hidden email]> wrote: > On Wed, Dec 28, 2011 at 12:37 PM, Carl Gundel <[hidden email]> wrote: >> >> On Sat, Dec 24, 2011 at 1:10 AM, Carl Gundel <[hidden email]> wrote: >> > How does one use RasterOp when drawing lines, circles, etc? I'd like >> > to be able to draw and erase resizing rectangles and graphical object >> > handes for example. Thanks. >> >> Any thoughts on this? It just isn't clear to me from the >> documentation how this is done, and the references to RasterOp in the >> image suggest to me that it's only good for copying rectangular >> bitmaps. > > > Ive done a tiny bit of this... the only useful rasterOp I found is > the equivalent of XOR which inverts the black&white pixels - effectively > erasing them. So you redraw your existing lines in XOR mode, then update > coordinates, and re-draw with normal mode. The net visual effect is your > lines move. Its not a 100% perfect solution, but its quite fast and very > simple to code. > > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
On Dec 28, 2011, at 2:57 PM, Carl Gundel wrote: > Jon, > > Yes, that's the sort of usage I'm talking about. With VisualSmalltalk > I only need to set the combination rule for a Pen object and then I > can draw anything I want directly and the rule will be applied. With > VW it seems like if I want to draw a line then I need to create a > bitmap and then draw a line on it, and then draw that bitmap onto the > destination bitmap using the desired RasterOp rule (number 9 it > seems). Seems terribly wasteful and inefficient and I have to write > special code to make it happen. > > -Carl > > On Wed, Dec 28, 2011 at 4:28 PM, Jon Paynter <[hidden email]> wrote: >> On Wed, Dec 28, 2011 at 12:37 PM, Carl Gundel <[hidden email]> wrote: >>> >>> On Sat, Dec 24, 2011 at 1:10 AM, Carl Gundel <[hidden email]> wrote: >>>> How does one use RasterOp when drawing lines, circles, etc? I'd like >>>> to be able to draw and erase resizing rectangles and graphical object >>>> handes for example. Thanks. >>> >>> Any thoughts on this? It just isn't clear to me from the >>> documentation how this is done, and the references to RasterOp in the >>> image suggest to me that it's only good for copying rectangular >>> bitmaps. >> >> >> Ive done a tiny bit of this... the only useful rasterOp I found is >> the equivalent of XOR which inverts the black&white pixels - effectively >> erasing them. So you redraw your existing lines in XOR mode, then update >> coordinates, and re-draw with normal mode. The net visual effect is your >> lines move. Its not a 100% perfect solution, but its quite fast and very >> simple to code. RasterOp is the basic unit of BitBlt operations. The wikipedia article on BitBlit (http://en.wikipedia.org/wiki/Bit_blit) actually does a good job of placing this discussion in context (IMO). It notes the XEROX origins of it. It also points this out: "Modern graphics hardware and software has almost completely replaced bitwise operations with mathematical operations such as alpha compositing. This is because bitwise operations on color displays do not produce results that resemble the physical combination of lights or inks. Some software still uses XOR to draw interactive highlight rectangles; when this is done to color images the unusual resulting colors are easily seen." (3rd paragraph) What Jon describes above is just not done that much anymore. Much to my frustration, the VW text editors actually use this technique in some places to show changes in selection (basically redrawing with different colors). This completely messes with composition and invalidation schemes. It's why you see a number of glitches around text editing when combined with other widgets. The VSE implementation is quite dated at this point, and had the added privilege of being primarily Win32 based. Having spent the last 15 minutes browsing around the MSDN / Windows Development / Graphics / Legacy Graphics / GDI folder (http://msdn.microsoft.com/en-us/library/dd145203(v=VS.85).aspx), it would be interesting to learn where/how VSE was mapping a pen-specific raster code to the GDI functions. As near as I can tell, even there, it's just for Bitmaps. It may be that VSE was bitmap buffering all of its drawing operations? There is no CreatePen() variant that I see that does so with any knowledge of raster codes. -- Travis Griggs Objologist Light travels faster than sound. This is why some people appear bright until you hear them speak... _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Thanks Travis,
I'm not trying to fault VW's implementation of this feature. I just need to understand how to make it work for me. I currently have a model where all the drawing actually happens to the display, and it looks to me as though the RasterOp class doesn't work for this. Do I need to draw to an image off-screen and then draw that to the screen? I hope not because then I will need to rewrite a lot of code. Thanks, -Carl On Thu, Dec 29, 2011 at 4:59 PM, Travis Griggs <[hidden email]> wrote: > > On Dec 28, 2011, at 2:57 PM, Carl Gundel wrote: > >> Jon, >> >> Yes, that's the sort of usage I'm talking about. With VisualSmalltalk >> I only need to set the combination rule for a Pen object and then I >> can draw anything I want directly and the rule will be applied. With >> VW it seems like if I want to draw a line then I need to create a >> bitmap and then draw a line on it, and then draw that bitmap onto the >> destination bitmap using the desired RasterOp rule (number 9 it >> seems). Seems terribly wasteful and inefficient and I have to write >> special code to make it happen. >> >> -Carl >> >> On Wed, Dec 28, 2011 at 4:28 PM, Jon Paynter <[hidden email]> wrote: >>> On Wed, Dec 28, 2011 at 12:37 PM, Carl Gundel <[hidden email]> wrote: >>>> >>>> On Sat, Dec 24, 2011 at 1:10 AM, Carl Gundel <[hidden email]> wrote: >>>>> How does one use RasterOp when drawing lines, circles, etc? I'd like >>>>> to be able to draw and erase resizing rectangles and graphical object >>>>> handes for example. Thanks. >>>> >>>> Any thoughts on this? It just isn't clear to me from the >>>> documentation how this is done, and the references to RasterOp in the >>>> image suggest to me that it's only good for copying rectangular >>>> bitmaps. >>> >>> >>> Ive done a tiny bit of this... the only useful rasterOp I found is >>> the equivalent of XOR which inverts the black&white pixels - effectively >>> erasing them. So you redraw your existing lines in XOR mode, then update >>> coordinates, and re-draw with normal mode. The net visual effect is your >>> lines move. Its not a 100% perfect solution, but its quite fast and very >>> simple to code. > > RasterOp is the basic unit of BitBlt operations. The wikipedia article on BitBlit (http://en.wikipedia.org/wiki/Bit_blit) actually does a good job of placing this discussion in context (IMO). It notes the XEROX origins of it. It also points this out: > > "Modern graphics hardware and software has almost completely replaced bitwise operations with mathematical operations such as alpha compositing. This is because bitwise operations on color displays do not produce results that resemble the physical combination of lights or inks. Some software still uses XOR to draw interactive highlight rectangles; when this is done to color images the unusual resulting colors are easily seen." (3rd paragraph) > > What Jon describes above is just not done that much anymore. Much to my frustration, the VW text editors actually use this technique in some places to show changes in selection (basically redrawing with different colors). This completely messes with composition and invalidation schemes. It's why you see a number of glitches around text editing when combined with other widgets. > > The VSE implementation is quite dated at this point, and had the added privilege of being primarily Win32 based. Having spent the last 15 minutes browsing around the MSDN / Windows Development / Graphics / Legacy Graphics / GDI folder (http://msdn.microsoft.com/en-us/library/dd145203(v=VS.85).aspx), it would be interesting to learn where/how VSE was mapping a pen-specific raster code to the GDI functions. As near as I can tell, even there, it's just for Bitmaps. It may be that VSE was bitmap buffering all of its drawing operations? There is no CreatePen() variant that I see that does so with any knowledge of raster codes. > > -- > Travis Griggs > Objologist > Light travels faster than sound. This is why some people appear bright until you hear them speak... > > > > > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |