From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79787 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: drops module (draft) Date: Thu, 06 Dec 2012 20:05:58 +0100 Message-ID: <50C0EC96.70909@wxs.nl> References: <50C0D0F4.3020806@gmx.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354820775 29673 80.91.229.3 (6 Dec 2012 19:06:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2012 19:06:15 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Dec 06 20:06:29 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TggmA-0005QF-4K for gctc-ntg-context-518@m.gmane.org; Thu, 06 Dec 2012 20:06:26 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AC28B102B4; Thu, 6 Dec 2012 20:06:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2sJ6s7PVoDYh; Thu, 6 Dec 2012 20:06:11 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id F1D0C1029D; Thu, 6 Dec 2012 20:06:10 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3ED7C1029D for ; Thu, 6 Dec 2012 20:06:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fDBsV9d+0Pjx for ; Thu, 6 Dec 2012 20:06:05 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id 0983410267 for ; Thu, 6 Dec 2012 20:06:04 +0100 (CET) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qB6IwOnK017375 for ; Thu, 6 Dec 2012 19:58:24 +0100 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.101; Original-Received: from [10.100.1.101] (unverified [10.100.1.101]) by pragma-net.nl (SurgeMail 6.1c) with ESMTP (TLS) id 6539-1713362 for multiple; Thu, 06 Dec 2012 20:05:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=16; city=Zeewolde; latitude=52.3302; longitude=5.5364; http://maps.google.com/maps?q=52.3302,5.5364&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0WIwiWoTL - e7d66b78f584 - 20121206 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:79787 Archived-At: On 12/6/2012 7:05 PM, Aditya Mahajan wrote: > On Thu, 6 Dec 2012, Peter Rolf wrote: > >> Hi all, >> >> a first version of the 'drops'-module (MkIV only) is available at >> >> https://www.wuala.com/indiego/public/ConTeXt/drops/?key=caiCGLasLFmJ >> >> >> Taken from the included documentation.. >> [..] >> 'drops' is a small extension for ConTeXt, that allows you to add drop >> shadows to rectangular regions (so called boxshadows). A working >> installation of ImageMagick (IM) is required to create the shadow >> graphics. The supported color spaces are CMYK, RGB and Gray, the file >> formats are limited to PNG and JPG. >> [..] >> Read the manual for detailed information. > > Nice. > >> The attached example is just a small test file for the 'rotation' >> parameter (a compensation for the object rotation, so that the shadow >> stays at the given direction). You will find other examples in the >> documentation and there is also a 'pile' example with the complete >> source. The 'presets' pdf contains the predefined setups for different >> shadow (or frame) types and it's source is a good starting point for >> your own experiments. >> >> This is a first draft, but most things work quite stable. If you want to >> help, test as much as possible. :-) >> >> *You need a recent version of ImageMagick for this module.* > > I always thought that shadows were possible to do in PDF (after all TikZ > does it using some type of PDF primitives). Since you are the PDF > expert, I am interested in knowing why you choose to go the ImageMagic > route. Some tricks are possible with functions that repeat bitmap patterns in clever ways but I lost the code that does it. If Peter can tell us what graphics are needed we can also make them directly as the img library has that possibility (we use it in mojca's gnuplot module) Anyhow, as you are the math magician, here's a start: \starttext \startluacode local format = string.format function document.TestBitmap(nx,ny) local r = { } local s = 1/nx for i=1,ny do local c = { } for j=1,nx/2 do c[#c+1] = format("%02x",j*s*255) end for j=nx/2,1,-1 do c[#c+1] = format("%02x",j*s*255) end c = table.concat(c,"",1,nx) r[#r+1] = c end r = table.concat(r,"\r",1,ny) print(r) context(r) end \stopluacode \startMPcode draw textext("\bitmapimage[x=100,y=100,color=gray]{\ctxlua{document.TestBitmap(100,100)}}") xsized 10cm ; \stopMPcode \stoptext So, what's needed is some edge related jugling. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________