summaryrefslogtreecommitdiffstats
path: root/libass/ass_drawing.c
Commit message (Collapse)AuthorAgeFilesLines
* Ignore extra coordinates in drawingswm42015-03-091-0/+7
| | | | | | | | | | | If there's an odd number of values, ignore the extra value, instead of shifting all values after the next command. While such drawings are boken strictly speaking, VSFilter handles them gracefully, and what libass did before this commit made no sense anyway. Test case: {\an7\pos(0.01,0.7)\c&H5A493D&\p1\iclip(11,m 857379 -744112 l 517759 -744112 517759 -942768 857379 -942768 m 851235 -422238 l 689105 -422238 689105 -620546 851235 -620546 m 679889 -421552 l 517411 -421552 517411 -620894 679889 -620894 -55984 m 860113 425634 l 519459 425634 519459 226640 860113 226640 m 868305 992080 l 465361 992080 465361 793936 868305 793936 m 841343 1317200 l 520145 1317200 520145 1118206 841343 1118206 m 411662 -245762 b 411662 -242373 408918 -239618 405518 -239618 l 342931 -239618 b 339532 -239618 336787 -242373 336787 -245762 l 336787 -308226 b 336787 -311626 339532 -314370 342931 -314370 l 405518 -314370 b 408918 -314370 411662 -311626 411662 -308226 m 414929 -907440 b 414929 -904051 412174 -901296 408785 -901296 l 346198 -901296 b 342798 -901296 340054 -904051 340054 -907440 l 340054 -969904 b 340054 -973294 342798 -976048 346198 -976048 l 408785 -976048 b 412174 -976048 414929 -973294 414929 -969904 m 414417 -585904 b 414417 -582515 411652 -579760 408252 -579760 l 345450 -579760 b 342041 -579760 339286 -582515 339286 -585904 l 339286 -648368 b 339286 -651758 342041 -654512 345450 -654512 l 408252 -654512 b 411652 -654512 414417 -651758 414417 -648368 m 414929 -44997 b 414929 -41597 412174 -38832 408785 -38832 l 346198 -38832 b 342798 -38832 340054 -41597 340054 -44997 l 340054 -107676 b 340054 -111075 342798 -113840 346198 -113840 l 408785 -113840 b 412174 -113840 414929 -111075 414929 -107676 m 415932 261456 b 415932 264845 413178 267600 409788 267600 l 347191 267600 b 343802 267600 341047 264845 341047 261456 l 341047 198992 b 341047 195602 343802 192848 347191 192848 l 409788 192848 b 413178 192848 415932 195602 415932 198992 m 414929 564048 b 414929 567437 412174 570192 408785 570192 l 346198 570192 b 342798 570192 340054 567437 340054 564048 l 340054 501584 b 340054 498194 342798 495440 346198 495440 l 408785 495440 b 412174 495440 414929 498194 414929 501584 m 414929 781136 b 414929 784525 412174 787280 408785 787280 l 346198 787280 b 342798 787280 340054 784525 340054 781136 l 340054 718672 b 340054 715282 342798 712528 346198 712528 l 408785 712528 b 412174 712528 414929 715282 414929 718672 m 414929 1133525 b 414929 1136914 412174 1139669 408785 1139669 l 346198 1139669 b 342798 1139669 340054 1136914 340054 1133525 l 340054 1071061 b 340054 1067661 342798 1064917 346198 1064917 l 408785 1064917 b 412174 1064917 414929 1067661 414929 1071061)}m 0 0 l 1280 0 1280 720 0 720 0 0{\p0}
* Replace FT_Outline with ASS_OutlineDr.Smile2014-11-231-48/+46
|
* Fix incorrect closing of last drawing contourDr.Smile2014-11-231-7/+6
|
* Leave spline evaluation to rasterizerDr.Smile2014-11-231-82/+30
|
* More malloc checkingwm42014-11-171-4/+4
| | | | | | | | | | Use strndup() instead of malloc+copy. Make all code deal with the possibility that ASS_Drawing.text can be NULL (which can happen on allocation failure). Skip fix_collisions() on malloc failure - the lines will overlap, but at least libass won't crash.
* Check more mallocswm42014-11-091-0/+2
| | | | This is just a start and gets most easy ones.
* Correctly close last contour in case of overflowDr.Smile2014-08-261-1/+4
|
* Fix integer overflow in FT_OutlineDr.Smile2014-07-181-0/+4
|
* Simplify drawing text assignmentOleg Oshmyan2014-06-061-25/+6
|
* Introduce ass_drawing_add_chars for adding a whole string at onceOleg Oshmyan2014-06-061-0/+14
|
* drawing: parse numbers as floatsGrigori Goronzy2014-03-151-9/+8
| | | | | | | Parse values as float and convert into 26.6 fixed point. This actually simplifies scaling a bit. Fixes #63.
* Fix limits.h includesGrigori Goronzy2014-02-171-0/+1
| | | | These were missing in several places. Fixes #50.
* Fix \pboOleg Oshmyan2014-01-081-7/+5
| | | | | | | | | | | | | | b61d260b attempted to add support for \p scaling to \pbo. However, while it fixed the exact sample originally reported, it broke \pbo with other \p values, including \p1, by confusing the direction of scaling and the units in which \pbo is measured. In addition, the descenders assigned to drawings have always had a wrong sign, causing lines that contain drawings with \pbo to be shifted in the wrong direction: negative \pbo raised bottom- aligned lines, while positive \pbo lowered top-aligned lines. All errors and fixes have been confirmed with VSFilter.
* drawing: scale pbo according to drawing scaleGrigori Goronzy2012-10-011-2/+4
| | | | Fixes issue #68.
* Clean up includesGrigori Goronzy2011-06-211-1/+0
|
* Use bare outlines for drawingsGrigori Goronzy2011-06-201-45/+17
| | | | | | | This finally gets rid of the nasty hack that manipulated a glyph we somehow got from FreeType. Simplifies drawing handling a bit and decouples drawing code from all font handling and related (fontconfig, etc.) code.
* Fix fontconfig disabled at runtimeGrigori Goronzy2011-02-161-4/+6
| | | | | | MPlayer is able to use this configuration with the -nofontconfig flag; this fixes crashes in case no font is available. Fixes a crash at uninit as well.
* Fix drawing leakage: delay glyph allocationGrigori Goronzy2010-08-091-8/+8
| | | | | | Delay allocation of the "faux" glyph until a drawing is parsed. This helps with fixing a (pretty bad) memory leak and also reduces frame overhead a little.
* Remove debugging leftoversGrigori Goronzy2010-07-291-21/+0
|
* Fix drawing cbox calculationGrigori Goronzy2010-07-291-2/+18
| | | | | | Use extremes of all points fed to the parser, instead of only points that are added to the outline. Fixes a rendering problem reported on IRC and should fix Issue #7.
* ASS_Drawing: do not free glyphGrigori Goronzy2010-07-141-2/+0
| | | | | The glyph is inserted into the cache and freed upon cache reset, so it shouldn't be freed alongside the drawing.
* Fix libass w/o fontconfigGrigori Goronzy2009-10-111-13/+22
| | | | | | | | | Make sure that libass does not crash even if no default font is provided. Additionally, fix crashes related to drawings in this and possibly other unusual cases. Document the default_path and default_family parameters of ass_set_fonts.
* Do not close empty drawingsGrigori Goronzy2009-08-291-2/+4
| | | | | | | | If there are no points (i.e. illegal drawing), do not close the drawing by incrementing the contour counter. Under certain circumstances, this can crash the FreeType stroker. This fixes issue 7.
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-27/+27
| | | | | | Rename all typedefs from the convention foo_bar_t, which can possibly conflict with POSIX types, to FooBar (and ASS_FooBar for public API typedefs). Fix formatting and stray comments while at it.
* Fix drawing parser memory leakGrigori Goronzy2009-07-191-2/+1
| | | | | Always free the drawing glyph in ass_drawing_free; do not double free clip vector bitmap.
* Implement vector clipsGrigori Goronzy2009-07-161-8/+11
| | | | | | | | | Make it possible to use drawings for clipping with \clip and \iclip. parse_tag was extended to parse drawings in \clip or \iclip tags in case parsing them as rectangular clips fails. These clip drawings are later rasterized and used for blending bitmaps, just after bitmaps are assembled into a list in render_text. Currently, the cache is not utilized for storing the parsed drawings or blended bitmaps.
* Message callback funtionalityGrigori Goronzy2009-07-111-2/+4
| | | | | | | | | | | Introduce functionality for providing a message callback that is used for passing messages to the controlling application instead of simply printing them to standard output. The function pointer to the callback is stored in the ass_library_t instance. ass_msg needs access to it, so in many places the library instance needs to be passed around now. The default behavior is the old one: messages of MSGL_INFO or lower are printed to the standard output, prefixed with "[ass]".
* Replace string defines with real stringsGrigori Goronzy2009-07-111-0/+3
| | | | | | Instead of referencing string defines from help_mp.h, use the strings directly in ass_msg. Consequently, help_mp.h is useless and can be deleted.
* Support for underline and strikethroughGrigori Goronzy2009-07-071-1/+1
| | | | | | | | | | | | | | | | | Add support for the underline (\u) and strikethrough/strikeout (\s) properties. This is a bit tricky, since FreeType doesn't offer any method of adding the lines, so you have to draw them yourself. libass uses various information from TrueType tables to get position and size of the lines, does a few simple consistency checks (some fonts might be broken) and if everything is alright, adds new contours for the lines. Sometimes, rendering errors can occur: - Currently, kerning isn't taken into account, which means the lines can overlap a little, leading to small optical glitches. - Some (broken) fonts use the wrong winding direction. In this case, the FreeType stroker will only consider the added lines to be "outside" and only stroke the line instead of the whole glyph.
* Implement drawing mode (\p)Grigori Goronzy2009-07-061-0/+477
Finally implement the drawing mode, which allows drawing of custom vector graphics. Drawings are intercepted in ass_render_event; a hash of the drawing string is generated which is then used for looking up drawings and bitmaps of drawings in the cache. The drawings itself are "fake" glyphs. They are created by parsing the simple drawing description language, evaluating the curves described (lines, cubic beziers and/or a special kind of b-splines) and creating vector outlines. Afterwards, these drawings are (with a few exceptions, e.g. ascender/descender) exactly handled like regular glyphs. Support for vector clippings is still missing, but otherwise the implementation should be complete and compatible with VSFilter. The libass integration of the drawing parsing/processing code is still a bit sketchy and should be refactored. History: WIP: Drawing mode infrastructure WIP: Drawing tokenizer WIP: Parse drawing tokens, call evaluators WIP: Bezier/b-spline evaluator WIP: Final pieces for the drawing mode WIP: Heavy modifications to the drawing parser/tokenizer WIP: Dynamic outline memory allocation WIP: Drawing position fixes WIP: more drawing position fixup (similar to VSFilter now) WIP: Lots of cleanup and fixes for drawings. WIP: Drawing mode integration into ass_render_event