Re: [NTG-context] Drops Module

2018-12-13 Thread Peter Rolf
Hi Aditya,

thanks for the hint. I run into the same problem some time ago (also
uploaded a new version). Sadly no final fix, because I had a naming
problem (number part) with luajit some days later. The current (local)
version works so far, but is a bit hackish (no time for a clean
solution). I'll look into it on the weekend.


Peter


Am 10.12.2018 um 18:47 schrieb Aditya Mahajan:
> Hi Peter,
> 
> I noticed that the drops module recently stopping running with the error:
> 
> /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: bad
> argument #3 to 'format' (number has no integer representation)
> stack traceback:
>     [C]: in function 'string.format'
>     /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: in
> upvalue 'get_IM_paths'
>     /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in
> field 'shadow'
>     [ctxlua]:1: in main chunk
> 
> This is due to the change in Lua5.3 with respect to floating point
> numbers. The simplest solution is to change '%d' to '%.0f' at
> appropriate places.
> 
> Thanks,
> Aditya
> ___
> 
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Drops Module

2018-12-10 Thread Aditya Mahajan

Hi Peter,

I noticed that the drops module recently stopping running with the error:

/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: bad argument 
#3 to 'format' (number has no integer representation)

stack traceback:
[C]: in function 'string.format'
/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: in 
upvalue 'get_IM_paths'
/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in field 
'shadow'

[ctxlua]:1: in main chunk

This is due to the change in Lua5.3 with respect to floating point 
numbers. The simplest solution is to change '%d' to '%.0f' at appropriate 
places.


Thanks,
Aditya
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] drops module update

2016-01-26 Thread Peter Rolf
Hi,

just a small maintenance update (everything was broken) for the drops
module. Should be working again with the latest versions of ImageMagick
(6.9.2-0+) and ConTeXt (luatex 0.85.0+).

Files (version 2016-01-18) can be found here [the zip file also contains
the documentation (drops.pdf)]

https://spideroak.com/browse/share/indiego/public/ConTeXt/drops/



Have fun,  Peter
___
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
___

[NTG-context] drops module release

2014-12-08 Thread Peter Rolf
Hi,

finally(!?) the release of the drops module for ConTeXt.
The module, the manual (also part of the module) and the example
documents can be downloaded here

https://spideroak.com/browse/share/indiego/public/ConTeXt/drops/

Feel free to copy the files to other servers.

Have fun,


Peter
___
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
___

Re: [NTG-context] drops module release

2014-12-08 Thread Martin Schröder
2014-12-08 13:24 GMT+01:00 Peter Rolf indi...@gmx.net:
 finally(!?) the release of the drops module for ConTeXt.

Which does what?

Best
   Martin
___
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
___

Re: [NTG-context] drops module (draft)

2012-12-08 Thread Peter Rolf
Hi Otared,

thanks for the report. No problems here with my old Acrobat Pro 9.52
(syntax checks shows no errors) or PDF-XChange Viewer 2.5 on Windows7
Ultimate 64-bit.

You can try to compile it on your machine (full source is included), if
you have a recent IM version installed. Sorry, I can't check it with a
newer Adobe version (parallel installation messes up the system and a
installation in a VM does not work).

I guess it's more a problem of the actual viewer (11), than a problem
with the PDF. Still annoying.


Best wishes,  Peter


Am 07.12.2012 19:02, schrieb Otared Kavian:
 Hi Peter,
 
 Thank you for your very nice module.
 For your information, I wanted just to report an issue I noticed with Adobe 
 Reader (Version: 11.0.0 (11.0.0)) on Mac OS X 10.8: when I try to open the 
 file « pile.pdf » (which is in your « examples » directory) Adobe Reader 
 crashes and there is no way to open that file with it. However th eother 
 file, « rotate.pdf » opens without any problem…

 Best regards: OK
 
 On 6 déc. 2012, at 18:08, Peter Rolf indi...@gmx.net 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.

 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.*

 6.7.8-2 to 6.8.0-7 (wrong version info 6.8.0-6): used here, should work
 6.7.6-0 or lower: will fail due to incompatibilities
 7.0.0.0 alpha: untested ('magick' is used instead of 'convert')

 Tested on Windows7 64bit and Debian 6.0.5-i386 (IM compiled from source)


 Happy TeXing!


 Peter
 rotate.pdf___
 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
 ___
 
 ___
 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
 ___
 

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-07 Thread Peter Rolf
Am 06.12.2012 19:05, schrieb Aditya Mahajan:
 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.

Because it's relative simple (I use a working function) , fast (in terms
of rendering speed) and the footprint of the shadow graphics is not that
big (png: one color, only alpha channel differs). Quality is (as you can
see) also not an issue. Mh, there is nothing wrong with bitmaps ;-)

See Type4/Type5 Shadings (Free-Form Gouraud-Shaded Triangle Meshes) on
page 314 of the PDF Reference for the PDF alternative. The problems to
solve are the calculation of the mesh points (think about rounded
squares) and also to find a proper shading function (which sets the
colors). See 'Shadow Internals' at

http://www.imagemagick.org/Usage/blur/#shadow%20internals

Far from trivial (and I'm only an amateur with limited time).

Also: you can 'draw' (command of IM) any shape in IM (SVG paths are
supported) and use the 'shadow' function on that. Theoretically you can
extent drops to support any shape (path or drawing). That's one reason
why I used the more general name 'drops' instead of the currently better
fitting 'boxshadow'. The other reason is, that Hans would never use the
stupid name 'drops' internally. :-D

 In terms of interface, wouldn't it be better if this somehow interfaced
 with the background/overlay mechanism. For example,
 
 \definedropshadow[identifier][...options...]
 
 which will define an overlay that will call ImageMagic with appropriate
 parameters (and caching the results if speed is a concern),
 
 and then
 
 \externalfigure[name][background=identifier]
 
 should draw a dropped shadow around the image
 

Needs some thinking


 Aditya
 ___
 
 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
 ___
 
 

___
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
___


Re: [NTG-context] drops module (draft)

2012-12-07 Thread Peter Rolf
Am 06.12.2012 19:18, schrieb Wolfgang Schuster:
 
 Am 06.12.2012 um 19:05 schrieb Aditya Mahajan adit...@umich.edu:
 
 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 module would be cleaner with a MkIV rewrite and I would drop the option
 to accept each module parameter with \usemodule.

Will look into that. I have to fix several remaining problems (IM
related) first, before I can think about a 'cleanup' :-D

 I would also create a new namespace for the \setupdrops command because
 currently it uses the “module” namespace.
 
 \def\dosetupdrops[#1]%
   {\iffirstargument\getparameters[\??module drops:][#1,{\c!setup=}]\else % 
 never parameter 'setup'
\ctxlua{thirddata.drops.resetdrops()}\fi} % reset all parameters to their 
 default, when no argument is given
 

Ok. Can you explain why that is a problem?


 Wolfgang
 ___
 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
 ___
 

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-07 Thread Peter Rolf
Am 06.12.2012 19:35, schrieb Marco:
 On 2012–12–06 Aditya Mahajan wrote:
 
 I always thought that shadows were possible to do in PDF (after all
 TikZ does it using some type of PDF primitives).
 
 It is. I use MetaPost to draw the shadows using the shading
 mechanism:
 
   withshading(circular, urcorner bottom_left, urcorner bottom_left, radius, 
 0)
   withfromshadecolor \MPcolor{c:transparent}
   withtoshadecolor   col;


Don't mix Type2/3 with Type 4/5 shadings (see my answer to Aditya). They
are all called 'shadings', but only the latter can be used for the
creation of realistic looking drop shadows.

And to repeat myself: there is nothing wrong with bitmaps. Take the best
from both worlds ;-)


 and it works well if placed in an overlay. However, I did not manage
 to get it working in TikZ, it could not display shadings to
 transparent colours (which is very handy for slides where the
 shadings might overlay graphics with a non-uniform colour).
 
 Since you are the PDF expert, I am interested in knowing why you
 choose to go the ImageMagic route.
 
 From my experience shadows made from MetaPost shadings (which uses
 PDF shadings, I assume) are quite low level. It's harder to get the
 angle, distance and shadow size correctly implemented. I think the
 ImageMagick shadings are more high level and ready to use.
 
 
 Marco
 
 ___
 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
 ___
 

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-07 Thread Marco Patzer
On 2012–12–07 Peter Rolf wrote:

 Am 06.12.2012 19:35, schrieb Marco:
  On 2012–12–06 Aditya Mahajan wrote:
  
  I always thought that shadows were possible to do in PDF (after all
  TikZ does it using some type of PDF primitives).
  
  It is. I use MetaPost to draw the shadows using the shading
  mechanism:
  
withshading(circular, urcorner bottom_left, urcorner bottom_left, 
  radius, 0)
withfromshadecolor \MPcolor{c:transparent}
withtoshadecolor   col;
 
 
 Don't mix Type2/3 with Type 4/5 shadings (see my answer to Aditya). They
 are all called 'shadings', but only the latter can be used for the
 creation of realistic looking drop shadows.

Thanks for pointing that out. I will have a look into my code again.

I was (and actually I still am) confused by the different shading
methods provided by MetaFun. I admit that I never read the PDF
reference which means that I don't know the shading internals. I
experimented a little and came up with a working solution to add
some eye-candy to presentations.

 And to repeat myself: there is nothing wrong with bitmaps.

I agree. Even Knuth designed his fonts as bitmaps (at least the
output is a bitmap). However, bitmaps always have a fixed size and
thus are not scalable.

 Take the best from both worlds ;-)

ACK

And thanks for this nice module and especially for the well-written
documentation.


Marco

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-07 Thread Wolfgang Schuster

Am 07.12.2012 um 13:01 schrieb Peter Rolf indi...@gmx.net:

 I would also create a new namespace for the \setupdrops command because
 currently it uses the “module” namespace.
 
 \def\dosetupdrops[#1]%
  {\iffirstargument\getparameters[\??module drops:][#1,{\c!setup=}]\else % 
 never parameter 'setup'
   \ctxlua{thirddata.drops.resetdrops()}\fi} % reset all parameters to their 
 default, when no argument is given
 
 Ok. Can you explain why that is a problem?

It’s bad style to misuse internal namespaces and and you can’t be sure the 
namespaces changes
which lead to problems with the simple slides module which used the 
\setavariables namespace
for a while.

Wolfgang
___
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
___


Re: [NTG-context] drops module (draft)

2012-12-07 Thread Peter Rolf
Am 07.12.2012 13:49, schrieb Marco Patzer:
 On 2012–12–07 Peter Rolf wrote:
 
 Am 06.12.2012 19:35, schrieb Marco:
 On 2012–12–06 Aditya Mahajan wrote:

 I always thought that shadows were possible to do in PDF (after all
 TikZ does it using some type of PDF primitives).

 It is. I use MetaPost to draw the shadows using the shading
 mechanism:

   withshading(circular, urcorner bottom_left, urcorner bottom_left, 
 radius, 0)
   withfromshadecolor \MPcolor{c:transparent}
   withtoshadecolor   col;


 Don't mix Type2/3 with Type 4/5 shadings (see my answer to Aditya). They
 are all called 'shadings', but only the latter can be used for the
 creation of realistic looking drop shadows.
 
 Thanks for pointing that out. I will have a look into my code again.
 
 I was (and actually I still am) confused by the different shading
 methods provided by MetaFun. I admit that I never read the PDF
 reference which means that I don't know the shading internals. I
 experimented a little and came up with a working solution to add
 some eye-candy to presentations.


Nearly everyone loves eye-candy in presentations. It distracts the
observer from the question What am I doing here? ;-)

 And to repeat myself: there is nothing wrong with bitmaps.
 
 I agree. Even Knuth designed his fonts as bitmaps (at least the
 output is a bitmap). However, bitmaps always have a fixed size and
 thus are not scalable.


True. I haven't played around with Photoshop or Indesign for years, but
the old versions also used bitmaps for their drop shadows. If Adobe as
the inventor of PDF does it, ...

 Take the best from both worlds ;-)
 
 ACK
 
 And thanks for this nice module and especially for the well-written
 documentation.

I tried my best (which means it took a long time). :-)

 
 Marco
 
 ___
 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
 ___
 

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-07 Thread Otared Kavian
Hi Peter,

Thank you for your very nice module.
For your information, I wanted just to report an issue I noticed with Adobe 
Reader (Version: 11.0.0 (11.0.0)) on Mac OS X 10.8: when I try to open the file 
« pile.pdf » (which is in your « examples » directory) Adobe Reader crashes and 
there is no way to open that file with it. However th eother file, « rotate.pdf 
» opens without any problem…

Best regards: OK

On 6 déc. 2012, at 18:08, Peter Rolf indi...@gmx.net 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.
 
 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.*
 
 6.7.8-2 to 6.8.0-7 (wrong version info 6.8.0-6): used here, should work
 6.7.6-0 or lower: will fail due to incompatibilities
 7.0.0.0 alpha: untested ('magick' is used instead of 'convert')
 
 Tested on Windows7 64bit and Debian 6.0.5-i386 (IM compiled from source)
 
 
 Happy TeXing!
 
 
 Peter
 rotate.pdf___
 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
 ___

___
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
___


Re: [NTG-context] drops module (draft)

2012-12-07 Thread Hans Hagen

On 12/7/2012 7:02 PM, Otared Kavian wrote:

Hi Peter,

Thank you for your very nice module.
For your information, I wanted just to report an issue I noticed with Adobe 
Reader (Version: 11.0.0 (11.0.0)) on Mac OS X 10.8: when I try to open the file 
« pile.pdf » (which is in your « examples » directory) Adobe Reader crashes and 
there is no way to open that file with it. However th eother file, « rotate.pdf 
» opens without any problem…


I Noticed the same on Windows 8 / Acrobat 11.0 so it's in the pdf.

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
___


[NTG-context] drops module (draft)

2012-12-06 Thread Peter Rolf
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.

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.*

6.7.8-2 to 6.8.0-7 (wrong version info 6.8.0-6): used here, should work
6.7.6-0 or lower: will fail due to incompatibilities
7.0.0.0 alpha: untested ('magick' is used instead of 'convert')

Tested on Windows7 64bit and Debian 6.0.5-i386 (IM compiled from source)


Happy TeXing!


Peter


rotate.pdf
Description: Adobe PDF document
___
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
___

Re: [NTG-context] drops module (draft)

2012-12-06 Thread Aditya Mahajan

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.


In terms of interface, wouldn't it be better if this somehow interfaced 
with the background/overlay mechanism. For example,


\definedropshadow[identifier][...options...]

which will define an overlay that will call ImageMagic with appropriate 
parameters (and caching the results if speed is a concern),


and then

\externalfigure[name][background=identifier]

should draw a dropped shadow around the image

Aditya
___
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
___


Re: [NTG-context] drops module (draft)

2012-12-06 Thread Wolfgang Schuster

Am 06.12.2012 um 19:05 schrieb Aditya Mahajan adit...@umich.edu:

 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 module would be cleaner with a MkIV rewrite and I would drop the option
to accept each module parameter with \usemodule.

I would also create a new namespace for the \setupdrops command because
currently it uses the “module” namespace.

\def\dosetupdrops[#1]%
  {\iffirstargument\getparameters[\??module drops:][#1,{\c!setup=}]\else % 
never parameter 'setup'
   \ctxlua{thirddata.drops.resetdrops()}\fi} % reset all parameters to their 
default, when no argument is given

Wolfgang
___
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
___


Re: [NTG-context] drops module (draft)

2012-12-06 Thread Marco
On 2012–12–06 Aditya Mahajan wrote:

 I always thought that shadows were possible to do in PDF (after all
 TikZ does it using some type of PDF primitives).

It is. I use MetaPost to draw the shadows using the shading
mechanism:

  withshading(circular, urcorner bottom_left, urcorner bottom_left, radius, 0)
  withfromshadecolor \MPcolor{c:transparent}
  withtoshadecolor   col;

and it works well if placed in an overlay. However, I did not manage
to get it working in TikZ, it could not display shadings to
transparent colours (which is very handy for slides where the
shadings might overlay graphics with a non-uniform colour).

 Since you are the PDF expert, I am interested in knowing why you
 choose to go the ImageMagic route.

From my experience shadows made from MetaPost shadings (which uses
PDF shadings, I assume) are quite low level. It's harder to get the
angle, distance and shadow size correctly implemented. I think the
ImageMagick shadings are more high level and ready to use.


Marco

___
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
___

Re: [NTG-context] drops module (draft)

2012-12-06 Thread Hans Hagen

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
___


Re: [NTG-context] drops module (draft)

2012-12-06 Thread Hans Hagen

On 12/6/2012 7:05 PM, Aditya Mahajan wrote:


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.


not so efficient but it shows a bit what bitmaps can do

\starttext

\startluacode
local format = string.format
local concat = table.concat
function document.TestBitmap(nx,ny)
nx = math.round(nx/65536)
ny = math.round(ny/65536)
nx = 2 * math.round(nx/2)
ny = 2 * math.round(ny/2)
local r = { }
local dx = 255/nx
local dy = 255/ny
for i=1,ny/2 do
local n = i*dy
local c = { }
for j=1,nx/2 do
c[#c+1] = format(%02x,j*dx+n)
end
for j=nx/2,1,-1 do
c[#c+1] = format(%02x,j*dx+n)
end
c = concat(c,,1,nx)
r[#r+1] = c
end
for i=ny/2,1,-1 do
local n = i*dy
local c = { }
for j=1,nx/2 do
c[#c+1] = format(%02x,j*dx+n)
end
for j=nx/2,1,-1 do
c[#c+1] = format(%02x,j*dx+n)
end
c = concat(c,,1,nx)
r[#r+1] = c
end
r = concat(r,\r,1,ny)
figures.bitmapimage {
data= r,
xresolution = nx,
yresolution = ny,
}
end
\stopluacode

\defineoverlay
  [BitMess]
  [{\scale
  [width=\dimexpr\overlaywidth+2ex,height=\dimexpr\overlayheight+2ex]

{\ctxlua{document.TestBitmap(\number\dimexpr\overlaywidth,\number\dimexpr\overlayheight)}}}]

\framed
  [width=10cm,
   height=10cm,
   frame=off,
   background={BitMess,color},
   backgroundcolor=white]
  {test}

\stoptext

-
  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
___


Re: [NTG-context] drops module (draft)

2012-12-06 Thread Hans Hagen

On 12/6/2012 7:35 PM, Marco wrote:

On 2012–12–06 Aditya Mahajan wrote:


I always thought that shadows were possible to do in PDF (after all
TikZ does it using some type of PDF primitives).


It is. I use MetaPost to draw the shadows using the shading
mechanism:

   withshading(circular, urcorner bottom_left, urcorner bottom_left, radius, 
0)
   withfromshadecolor \MPcolor{c:transparent}
   withtoshadecolor   col;

and it works well if placed in an overlay. However, I did not manage
to get it working in TikZ, it could not display shadings to
transparent colours (which is very handy for slides where the
shadings might overlay graphics with a non-uniform colour).


I think drops are somewhat different as they might follow different 
rules than circular or linear shades



Since you are the PDF expert, I am interested in knowing why you
choose to go the ImageMagic route.


 From my experience shadows made from MetaPost shadings (which uses
PDF shadings, I assume) are quite low level. It's harder to get the
angle, distance and shadow size correctly implemented. I think the
ImageMagick shadings are more high level and ready to use.


Yes. Of course we can make shading more clever, but to be honest I never 
had the need.


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
___