Article View: comp.windows.interviews
Article #826Re: Graphic help
From: John Vlissides
Date: Tue, 10 Nov 1992 19:42
Date: Tue, 10 Nov 1992 19:42
47 lines
2060 bytes
2060 bytes
In article <1992Nov7.204220.21840@cs.wisc.edu>, you write:
> I live a simple life. All I want to do is put a rectangle of some
> sort(I'm not picky) into a graphicBlock that I have in my application,
> which was generated by ibuild (3.0.1).
>
> How do I do it? Please, somebody tell me.
>
>
> In my current attempt, I've written the following, which core dumps:
> ----------------
> #include <InterViews/panner.h>
> #include <Unidraw/Graphic/grblock.h>
> #include <Unidraw/Graphic/picture.h>
> #include <Unidraw/Graphic/polygons.h>
> #include <InterViews/strbrowser.h>
> #include <InterViews/button.h>
> #include "Viz.h"
> #include <InterViews/2.6/_enter.h>
>
> Viz::Viz(const char* name) : Viz_core(name)
> {
> int x,y;
> x = y = 100;
> PSBrush *p = new PSBrush(65535,10);
> SF_Rect *r = new SF_Rect(100,100,200,200);
> Picture *pic = new Picture;
>
> r->FillBg(1);
> r->SetBrush(p);
> pic->Append(r);
> graphic->SetGraphic(pic);
> }
>
> This runs just fine, but dumps somewhere after the MonoScene is
> inserted into the application. Why?
Your coredump is probably the result of creating graphics without
specifying a complete set of graphics state. More specifically, you
never set your SF_Rect's (or Picture's) foreground and background
colors. You can specify such graphics state either by supplying the
constructor with a graphic (like stdgraphic in
include/Unidraw/globals.h) from which to copy graphics state or by
calling SetColors, SetBrush, etc. explicitly.
--
John Vlissides / IBM T.J. Watson Research / vlis@watson.ibm.com
Technical Details
Message-ID:
<9211101942.AA22334@aurora.watson.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!stanford.edu!WATSON.IBM.COM!vlisShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!stanford.edu!WATSON.IBM.COM!vlis From: vlis@WATSON.IBM.COM (John Vlissides) Subject: Re: Graphic help Message-ID: <9211101942.AA22334@aurora.watson.ibm.com> Sender: news@shelby.stanford.edu (USENET News System) Reply-To: vlis@watson.ibm.com Organization: Internet-USENET Gateway at Stanford University Date: Tue, 10 Nov 1992 19:42:52 GMT Lines: 47