From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 29853 invoked from network); 6 Jan 2021 20:45:24 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 6 Jan 2021 20:45:24 -0000 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by 1ess; Wed Jan 6 15:13:38 -0500 2021 Received: by mail-wm1-f46.google.com with SMTP id 190so3419267wmz.0 for <9front@9front.org>; Wed, 06 Jan 2021 12:13:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:to:cc:subject:date:in-reply-to:mime-version :content-transfer-encoding; bh=8Wb3wVQovs96vNoVk3KdH4Q318cCix0vcpNTBDUt6XQ=; b=DUkLkkZ5Rnjp4iya8BHbZpb6AHqOGixoIRNTFh8rUu1o5Thkat87f7uc+VypqoDYDg gwkD883By++KUiZV/NbiKArCKbO0i7LTHOPj9ZqkMtRwdaJbdDLnoAYtvLXEIdl9wrHH nJonGPNzIGY8jBNjqMejqjOy/VjSiHWscjIge1FZzs6j5McvjEDlXKCRbi4NBKME1+nk cwO77Ad7B6Bvx0wTluqphEEP95UcrzmlGeSaYC4RRoRex621Ppc0po3EeAPWmokPgRBE 9SNyyU0p3tBOPLYK9O+w56WK3E/aehLajgD1Xj9U+yqeIy/0GltjLtzv9AQfwdC1FzfA Qe7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:to:cc:subject:date:in-reply-to :mime-version:content-transfer-encoding; bh=8Wb3wVQovs96vNoVk3KdH4Q318cCix0vcpNTBDUt6XQ=; b=txofm7bvpBt2BO6RDPeE/S8eqdqinxZam8vU/wmk2byKmendro23K9EK5SJ7RfHXLN nnET2/aIPYtQvyVBZXNxxaoRL2iJKx6m0g1lz/iNUDkM8UEf9SgX6fWXWz4PwbAI3Vw0 VRfKbpA2jTvfs5Las3drYyLvbtEQzXysLAWsjBfpP+kMx2jtEabnGOEhPJcEJZ2S6ZgV fx9cg334pq8KKGBic0OV62SuiYH/MkiAEQ/FSqy2Zq7zYcRuWrEiRJFH4bdJh7AxwZXV 8gHO5R1wLrhib9iszJqeuEmkYAjHKhlbgvL+M+QpzhP+2kBwKsJSi2VI+7lWXZEDuFlN PaYg== X-Gm-Message-State: AOAM533DFR9FG2XfpyYFx+Ss2/gr9IAmiSph/QuK/L7B+cgrAunoe7ti H1YNiLbGCWLfUQmdHL0KhZ6lvKp530s= X-Google-Smtp-Source: ABdhPJyxQ01A+d2mkTvu5KmpIPoX4BPi7YSESKVOBsMJ1JtIPI847GPSnb8RZUKInAD9O+WbFyk3fQ== X-Received: by 2002:a7b:c212:: with SMTP id x18mr5130513wmi.113.1609964009343; Wed, 06 Jan 2021 12:13:29 -0800 (PST) Return-Path: Received: from hades (lfbn-idf1-1-101-190.w82-124.abo.wanadoo.fr. [82.124.189.190]) by smtp.gmail.com with ESMTPSA id 94sm4532807wrq.22.2021.01.06.12.13.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jan 2021 12:13:28 -0800 (PST) From: telephil9@gmail.com X-Google-Original-From: pme@gmail.com Message-ID: <4B76AD7B3AC5B196F7B00CE810077C1D@gmail.com> To: 9front@9front.org, telephil9@gmail.com CC: 9front@9front.org Date: Wed, 06 Jan 2021 21:13:27 +0100 In-Reply-To: <517CFBCF8E3172A9CDB922A8128A4AE8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: secure flexible grid database property manager Subject: [9front] Re: [PATCH] libdraw: add bezierpts Reply-To: 9front@9front.org Precedence: bulk Hi, It seems my mail has gone unnocited. Ping ? Thanks --phil Quoth telephil9@gmail.com: > Hi, > > Happy new year to everyone! > > This patch exposes a new bezierpts function similar to the current bezsplinepts. > Note that this merely makes it visible as it was already present in libdraw. > === > diff -r f020e57da8d6 sys/include/draw.h > --- a/sys/include/draw.h Thu Dec 17 20:26:38 2020 -0800 > +++ b/sys/include/draw.h Fri Jan 01 16:48:33 2021 +0100 > @@ -436,6 +436,7 @@ > extern Point stringsubfont(Image*, Point, Image*, Subfont*, char*); > extern int bezier(Image*, Point, Point, Point, Point, int, int, int, Image*, Point); > extern int bezierop(Image*, Point, Point, Point, Point, int, int, int, Image*, Point, Drawop); > +extern int bezierpts(Point, Point, Point, Point, Point**); > extern int bezspline(Image*, Point*, int, int, int, int, Image*, Point); > extern int bezsplineop(Image*, Point*, int, int, int, int, Image*, Point, Drawop); > extern int bezsplinepts(Point*, int, Point**); > diff -r f020e57da8d6 sys/src/libdraw/bezier.c > --- a/sys/src/libdraw/bezier.c Thu Dec 17 20:26:38 2020 -0800 > +++ b/sys/src/libdraw/bezier.c Fri Jan 01 16:48:33 2021 +0100 > @@ -98,12 +98,23 @@ > } > > static void > -bezierpts(Plist *l, Point p0, Point p1, Point p2, Point p3) > +_bezierpts(Plist *l, Point p0, Point p1, Point p2, Point p3) > { > bpts(l, p0, p1, p2, p3); > appendpt(l, p3); > } > > +int > +bezierpts(Point p0, Point p1, Point p2, Point p3, Point **pp) > +{ > + Plist l; > + l.p = nil; > + l.np = 0; > + _bezierpts(&l, p0, p1, p2, p3); > + *pp = l.p; > + return l.np; > +} > + > static void > _bezsplinepts(Plist *l, Point *pt, int npt) > { > @@ -167,7 +178,7 @@ > Plist l; > > l.np = 0; > - bezierpts(&l, p0, p1, p2, p3); > + _bezierpts(&l, p0, p1, p2, p3); > if(l.np == -1) > return 0; > if(l.np != 0){ > @@ -211,7 +222,7 @@ > Plist l; > > l.np = 0; > - bezierpts(&l, p0, p1, p2, p3); > + _bezierpts(&l, p0, p1, p2, p3); > if(l.np == -1) > return 0; > if(l.np != 0){ > === > > Updated man page: > === > diff -r f020e57da8d6 sys/man/2/draw > --- a/sys/man/2/draw Thu Dec 17 20:26:38 2020 -0800 > +++ b/sys/man/2/draw Fri Jan 01 16:49:11 2021 +0100 > @@ -103,6 +103,8 @@ > int end0, int end1, int radius, Image *src, Point sp, > Drawop op) > .PB > +int bezierpts(Point p0, Point p1, Point p2, Point p3, Point **pp) > +.PB > int bezspline(Image *dst, Point *pt, int npt, int end0, int end1, > int radius, Image *src, Point sp) > .PB > @@ -603,6 +605,16 @@ > in > .IR dst . > .TP > +\f5bezierpts(\f2a\fP, \f2b\fP, \f2c\fP, \f2d\fP, \f2pp\fP) > +.I Bezierpts > +returns in > +.I pp > +a list of points making up the open polygon that > +.I bezier > +would draw. > +The caller is responsible for freeing > +.IR *pp . > +.TP > \f5bezspline(\f2dst\fP, \f2p\fP, \f2np\fP, \f2end0\fP, \f2end1\fP, \f2thick\fP, \f2src\fP, \f2sp\fP) > .I Bezspline > takes the same arguments as > === > > --phil