From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Where do I get my Cairo context from (in GTK3)? Date: Wed, 27 Apr 2016 15:37:18 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <0a9cf35e-45ba-49c1-9d6a-4a0da3457e70@googlegroups.com> <31e4394b-eb85-4d31-bd25-f2bd332c7c9b@googlegroups.com> NNTP-Posting-Host: G7MXAklp0OAVRSdfcmpxRQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:30304 Date: 2016-04-27T15:37:18+02:00 List-Id: On 27/04/2016 15:15, hreba wrote: > I am creating a drawing surface, a new layer for isolating the end user > from GTK. The idea is that the end user gets a constructor for a new > type "Canvas". He has to specify 3 handlers: the first is called once > after the canvas appears on the screen, the second is called after each > resizing, the third one when the canvas needs redrawing. Drawing is done > by calling a series of of standardized drawing procedures (for lines, > arcs etc.) The end user needs no knowledge about connecting handlers, > about cairo contexts or "Stroke" calls. He gets a framework for > technical drawings with a simple user interface. I used another approach. Instead of asking the user to draw anything, I let him create an object, e.g. a line, which will knows how to draw itself. The object is put into a list of objects. This has the advantage that once done objects can be reused. The user need not to care about signals. The objects configuration can be easily serialized (e.g. configuration stored and restored). The objects know how to resize themselves, e.g. linear objects may become larger, but line thickness remain same, some object may wish to keep aspect ratio etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de