Initial Commit

This commit is contained in:
plane000
2018-04-20 10:15:15 +01:00
parent 49150ccfe4
commit 62101e8e61
2870 changed files with 520122 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
<classpathentry kind="lib" path="library/itext.jar" sourcepath="itext-src.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>processing-pdf</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,292 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=1
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=2
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View File

@@ -0,0 +1,4 @@
eclipse.preferences.version=1
formatter_profile=_processing
formatter_settings_version=12
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>

View File

@@ -0,0 +1,11 @@
This library uses iText 2.1.7, which is the last LGPL/MPL version of the iText project.
We've used iText for several years. The license for iText has changed for subsequent versions and is no longer compatible with Processing, so we're stuck at 2.x.
At the iText site, there's also some [vague wording](http://lowagie.com/itext2) about legal liability for commercial projects using the 2.x series. It's not clear where this leaves us.
Bruno Lowagie did an enormous amount of (free) work with the iText project, and we certainly don't fault him for the new commercial license.
We're using iText in a very limited way--drawing to it like it's a Java Graphics2D object. There might be other options for us in this space, but it's not much of a priority.
Ben Fry, 12 October 2013

View File

@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<project name="Processing PDF Library" default="build">
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete file="library/pdf.jar" />
</target>
<target name="compile" description="Compile sources">
<condition property="core-built">
<available file="../../../core/library/core.jar" />
</condition>
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" />
<mkdir dir="bin" />
<javac source="1.8"
target="1.8"
srcdir="src" destdir="bin"
encoding="UTF-8"
includeAntRuntime="false"
classpath="../../../core/library/core.jar; library/itext.jar"
nowarn="true"
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
../../mode/jdtCompilerAdapter.jar" />
</javac>
</target>
<target name="build" depends="compile" description="Build PDF library">
<jar basedir="bin" destfile="library/pdf.jar" />
</target>
</project>

View File

@@ -0,0 +1,194 @@
/**
* PDF Complex
* by Marius Watz (workshop.evolutionzone.com).
*
* Example using PDF to output complex 3D geometry for print.
* Press "s" to save a PDF.
*/
import processing.opengl.*;
import processing.pdf.*;
// Trig lookup tables borrowed from Toxi. Cryptic but effective
float sinLUT[];
float cosLUT[];
float SINCOS_PRECISION=1.0;
int SINCOS_LENGTH= int((360.0/SINCOS_PRECISION));
// System data
boolean dosave=false;
int num;
float pt[];
int style[];
void setup() {
size(600, 600, OPENGL);
frameRate(24);
background(255);
// Fill the tables
sinLUT=new float[SINCOS_LENGTH];
cosLUT=new float[SINCOS_LENGTH];
for (int i = 0; i < SINCOS_LENGTH; i++) {
sinLUT[i]= (float)Math.sin(i*DEG_TO_RAD*SINCOS_PRECISION);
cosLUT[i]= (float)Math.cos(i*DEG_TO_RAD*SINCOS_PRECISION);
}
num = 150;
pt = new float[6*num]; // rotx, roty, deg, rad, w, speed
style = new int[2*num]; // color, render style
// Set up arc shapes
int index=0;
float prob;
for (int i=0; i<num; i++) {
pt[index++] = random(PI*2); // Random X axis rotation
pt[index++] = random(PI*2); // Random Y axis rotation
pt[index++] = random(60,80); // Short to quarter-circle arcs
if(random(100)>90) pt[index]=(int)random(8,27)*10;
pt[index++] = int(random(2,50)*5); // Radius. Space them out nicely
pt[index++] = random(4,32); // Width of band
if(random(100)>90) pt[index]=random(40,60); // Width of band
pt[index++] = radians(random(5,30))/5; // Speed of rotation
// get colors
prob = random(100);
if(prob<30) style[i*2]=colorBlended(random(1), 255,0,100, 255,0,0, 210);
else if(prob<70) style[i*2]=colorBlended(random(1), 0,153,255, 170,225,255, 210);
else if(prob<90) style[i*2]=colorBlended(random(1), 200,255,0, 150,255,0, 210);
else style[i*2]=color(255,255,255, 220);
if(prob<50) style[i*2]=colorBlended(random(1), 200,255,0, 50,120,0, 210);
else if(prob<90) style[i*2]=colorBlended(random(1), 255,100,0, 255,255,0, 210);
else style[i*2]=color(255,255,255, 220);
style[i*2+1]=(int)(random(100))%3;
}
}
void draw() {
if(dosave) {
// set up PGraphicsPDF for use with beginRaw()
PGraphicsPDF pdf = (PGraphicsPDF)beginRaw(PDF, "pdf_complex_out.pdf");
// set default Illustrator stroke styles and paint background rect.
pdf.strokeJoin(MITER);
pdf.strokeCap(SQUARE);
pdf.fill(0);
pdf.noStroke();
pdf.rect(0,0, width,height);
}
background(0);
int index=0;
translate(width/2,height/2,0);
rotateX(PI/6);
rotateY(PI/6);
for (int i=0; i<num; i++) {
pushMatrix();
rotateX(pt[index++]);
rotateY(pt[index++]);
if(style[i*2+1]==0) {
stroke(style[i*2]);
noFill();
strokeWeight(1);
arcLine(0,0, pt[index++],pt[index++],pt[index++]);
}
else if(style[i*2+1]==1) {
fill(style[i*2]);
noStroke();
arcLineBars(0,0, pt[index++],pt[index++],pt[index++]);
}
else {
fill(style[i*2]);
noStroke();
arc(0,0, pt[index++],pt[index++],pt[index++]);
}
// increase rotation
pt[index-5]+=pt[index]/10;
pt[index-4]+=pt[index++]/20;
popMatrix();
}
if(dosave) {
endRaw();
dosave=false;
}
}
// Get blend of two colors
public int colorBlended(float fract,
float r, float g, float b,
float r2, float g2, float b2, float a) {
r2 = (r2 - r);
g2 = (g2 - g);
b2 = (b2 - b);
return color(r + r2 * fract, g + g2 * fract, b + b2 * fract, a);
}
// Draw arc line
public void arcLine(float x,float y,float deg,float rad,float w) {
int a=(int)(min (deg/SINCOS_PRECISION,SINCOS_LENGTH-1));
int numlines=(int)(w/2);
for (int j=0; j<numlines; j++) {
beginShape();
for (int i=0; i<a; i++) {
vertex(cosLUT[i]*rad+x,sinLUT[i]*rad+y);
}
endShape();
rad += 2;
}
}
// Draw arc line with bars
public void arcLineBars(float x,float y,float deg,float rad,float w) {
int a = int((min (deg/SINCOS_PRECISION,SINCOS_LENGTH-1)));
a /= 4;
beginShape(QUADS);
for (int i=0; i<a; i+=4) {
vertex(cosLUT[i]*(rad)+x,sinLUT[i]*(rad)+y);
vertex(cosLUT[i]*(rad+w)+x,sinLUT[i]*(rad+w)+y);
vertex(cosLUT[i+2]*(rad+w)+x,sinLUT[i+2]*(rad+w)+y);
vertex(cosLUT[i+2]*(rad)+x,sinLUT[i+2]*(rad)+y);
}
endShape();
}
// Draw solid arc
public void arc(float x,float y,float deg,float rad,float w) {
int a = int(min (deg/SINCOS_PRECISION,SINCOS_LENGTH-1));
beginShape(QUAD_STRIP);
for (int i = 0; i < a; i++) {
vertex(cosLUT[i]*(rad)+x,sinLUT[i]*(rad)+y);
vertex(cosLUT[i]*(rad+w)+x,sinLUT[i]*(rad+w)+y);
}
endShape();
}
void keyPressed() {
if (key == 's') {
dosave=true;
}
}
void mouseReleased() {
background(255);
}

View File

@@ -0,0 +1,31 @@
/**
* Large Page.
*
* Saves one frame as a PDF with a size larger
* than the screen. When PDF is used as the renderer
* (the third parameter of size) the display window
* does not open. The file is saved to the sketch folder.
* You can open it by "Sketch->Show Sketch Folder."
*/
import processing.pdf.*;
void setup()
{
size(2000, 2000, PDF, "Line.pdf");
}
void draw()
{
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(200, 0, width/2, height);
exit(); // Quit the program
}

View File

@@ -0,0 +1,38 @@
/**
* Many PDFs.
*
* Saves one PDF file each each frame while the mouse is pressed.
* When the mouse is released, the PDF creation stops.
*/
import processing.pdf.*;
boolean savePDF = false;
void setup() {
size(600, 600);
frameRate(24);
}
void draw() {
if(savePDF == true) {
beginRecord(PDF, "lines" + frameCount + ".pdf");
}
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(mouseX, 0, width-mouseY, height);
if(savePDF == true) {
endRecord();
}
}
void mousePressed() {
savePDF = true;
}
void mouseReleased() {
savePDF = false;
}

View File

@@ -0,0 +1,30 @@
/**
* Many Pages.
*
* Saves a new page into a PDF file each loop through draw().
* Pressing the mouse finishes writing the file and exits the program.
*/
import processing.pdf.*;
PGraphicsPDF pdf;
void setup() {
size(600, 600);
frameRate(4);
pdf = (PGraphicsPDF)beginRecord(PDF, "Lines.pdf");
}
void draw() {
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(mouseX, 0, width-mouseY, height);
pdf.nextPage();
}
void mousePressed() {
endRecord();
exit();
}

View File

@@ -0,0 +1,37 @@
/**
* Mouse Press.
*
* Saves one PDF of the contents of the display window
* each time the mouse is pressed.
*/
import processing.pdf.*;
boolean saveOneFrame = false;
void setup() {
size(600, 600);
frameRate(24);
}
void draw() {
if(saveOneFrame == true) {
beginRecord(PDF, "Line.pdf");
}
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(mouseX, 0, width-mouseY, height);
if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}
void mousePressed() {
saveOneFrame = true;
}

View File

@@ -0,0 +1,33 @@
/**
* Multiple Frames.
*
* Saves one PDF document of many frames drawn to the screen.
* Starts the file when the mouse is pressed and end the file
* when the mouse is released.
*/
import processing.pdf.*;
void setup() {
size(600, 600);
frameRate(24);
background(255);
}
void draw() {
stroke(0, 20);
strokeWeight(20.0);
line(mouseX, 0, width-mouseY, height);
}
void mousePressed() {
beginRecord(PDF, "Lines.pdf");
background(255);
}
void mouseReleased() {
endRecord();
background(255);
}

View File

@@ -0,0 +1,23 @@
/**
* One Frame.
*
* Saves one PDF with the contents of the display window.
* Because this example uses beginRecord, the image is shown
* on the display window and is saved to the file.
*/
import processing.pdf.*;
size(600, 600);
beginRecord(PDF, "line.pdf");
background(255);
stroke(0, 20);
strokeWeight(20.0);
line(200, 0, 400, height);
endRecord();

View File

@@ -0,0 +1,45 @@
/**
* RandomBook
*
* Creates a 768 page book of random lines.
*/
import processing.pdf.*;
PGraphicsPDF pdf;
void setup() {
size(594, 842);
// randomSeed(0); // Uncomment to make the same book each time
pdf = (PGraphicsPDF)beginRecord(PDF, "RandomBook.pdf");
beginRecord(pdf);
}
void draw() {
background(255);
for (int i=0; i<100; i++) {
float r = random(1.0);
if(r < 0.2) {
stroke(255);
} else {
stroke(0);
}
float sw = pow(random(1.0), 12);
strokeWeight(sw * 260);
float x1 = random(-200, -100);
float x2 = random(width+100, width+200);
float y1 = random(-100, height+100);
float y2 = random(-100, height+100);
line(x1, y1, x2, y2);
}
if(frameCount == 768) {
endRecord();
exit(); // Quit
} else {
pdf.nextPage(); // Tell it to go to the next page
}
}

View File

@@ -0,0 +1,2 @@
name = PDF Export
version = 1

View File

@@ -0,0 +1,686 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2005-11 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package processing.pdf;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.*;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import processing.awt.PGraphicsJava2D;
import processing.core.*;
/**
* Thin wrapper for the iText PDF library that handles writing PDF files.
* The majority of the work in this library is done by
* <a href="http://www.lowagie.com/iText/">iText</a>.
* <br /> <br />
* This is currently using iText 2.1.7.
* <br /> <br />
* The issue is that versions from the 5.x series were slow to handle lots of
* fonts with the DefaultFontMapper. 2.x seemed a little slower than 1.x,
* but 5.x took up to 10 times the time to load, meaning a lag of several
* seconds when starting sketches on a machine that had a good handful of
* fonts installed. (Like, say, anyone in our target audience. Or me.)
*/
public class PGraphicsPDF extends PGraphicsJava2D {
/** File being written, if it's a file. */
protected File file;
/** OutputStream being written to, if using an OutputStream. */
protected OutputStream output;
protected Document document;
protected PdfWriter writer;
protected PdfContentByte content;
/** Shared across instances because it's incredibly time-consuming to create. */
static protected DefaultFontMapper mapper;
static protected String[] fontList;
/*
public PGraphicsPDF() {
// PDF always likes native fonts. Always.
hint(ENABLE_NATIVE_FONTS);
}
*/
public void setPath(String path) {
this.path = path;
if (path != null) {
file = new File(path);
if (!file.isAbsolute()) {
file = null;
}
}
if (file == null) {
throw new RuntimeException("PGraphicsPDF requires an absolute path " +
"for the location of the output file.");
}
}
/**
* Set the library to write to an output stream instead of a file.
*/
public void setOutput(OutputStream output) {
this.output = output;
}
// /**
// * all the init stuff happens in here, in case someone calls size()
// * along the way and wants to hork things up.
// */
// protected void allocate() {
// // can't do anything here, because this will be called by the
// // superclass PGraphics, and the file/path object won't be set yet
// // (since super() called right at the beginning of the constructor)
// }
@Override
public PSurface createSurface() {
return surface = new PSurfaceNone(this);
}
@Override
protected void defaultSettings() { // ignore
super.defaultSettings();
textMode = SHAPE;
}
public void beginDraw() {
// long t0 = System.currentTimeMillis();
if (document == null) {
document = new Document(new Rectangle(width, height));
boolean missingPath = false;
try {
if (file != null) {
//BufferedOutputStream output = new BufferedOutputStream(stream, 16384);
output = new BufferedOutputStream(new FileOutputStream(file), 16384);
} else if (output == null) {
missingPath = true;
throw new RuntimeException("PGraphicsPDF requires a path " +
"for the location of the output file.");
}
writer = PdfWriter.getInstance(document, output);
document.open();
content = writer.getDirectContent();
// template = content.createTemplate(width, height);
} catch (RuntimeException re) {
if (missingPath) {
throw re; // don't re-package our own error
} else {
throw new RuntimeException("Problem saving the PDF file.", re);
}
} catch (FileNotFoundException fnfe) {
throw new RuntimeException("Can't save the PDF file to " + path, fnfe);
} catch (DocumentException de) {
throw new RuntimeException("Error inside the PDF library.", de);
}
g2 = content.createGraphicsShapes(width, height);
}
// super in Java2D now creates an image buffer, don't do that
//super.beginDraw();
checkSettings();
resetMatrix(); // reset model matrix
vertexCount = 0;
// Also need to push the matrix since the matrix doesn't reset on each run
// http://dev.processing.org/bugs/show_bug.cgi?id=1227
pushMatrix();
}
static protected DefaultFontMapper getMapper() {
if (mapper == null) {
// long t = System.currentTimeMillis();
mapper = new DefaultFontMapper();
if (PApplet.platform == PConstants.MACOSX) {
try {
String homeLibraryFonts =
System.getProperty("user.home") + "/Library/Fonts";
mapper.insertDirectory(homeLibraryFonts);
} catch (Exception e) {
// might be a security issue with getProperty() and user.home
// if this sketch is running from the web
}
// add the system font paths
mapper.insertDirectory("/System/Library/Fonts");
mapper.insertDirectory("/Library/Fonts");
} else if (PApplet.platform == PConstants.WINDOWS) {
// how to get the windows fonts directory?
// could be c:\winnt\fonts or c:\windows\fonts or not even c:
// maybe do a Runtime.exec() on echo %WINDIR% ?
// Runtime.exec solution might be a mess on systems where the
// the backslash/colon characters not really used (i.e. JP)
// find the windows fonts folder
File roots[] = File.listRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].toString().startsWith("A:")) {
// Seems to be a problem with some machines that the A:
// drive is returned as an actual root, even if not available.
// This won't fix the issue if the same thing happens with
// other removable drive devices, but should fix the
// initial/problem as cited by the bug report:
// http://dev.processing.org/bugs/show_bug.cgi?id=478
// If not, will need to use the other fileExists() code below.
continue;
}
File folder = new File(roots[i], "WINDOWS/Fonts");
if (folder.exists()) {
mapper.insertDirectory(folder.getAbsolutePath());
break;
}
folder = new File(roots[i], "WINNT/Fonts");
if (folder.exists()) {
mapper.insertDirectory(folder.getAbsolutePath());
break;
}
}
} else if (PApplet.platform == PConstants.LINUX) {
checkDir("/usr/share/fonts/", mapper);
checkDir("/usr/local/share/fonts/", mapper);
checkDir(System.getProperty("user.home") + "/.fonts", mapper);
}
// System.out.println("mapping " + (System.currentTimeMillis() - t));
}
return mapper;
}
static protected void checkDir(String path, DefaultFontMapper mapper) {
File folder = new File(path);
if (folder.exists()) {
mapper.insertDirectory(path);
traverseDir(folder, mapper);
}
}
/**
* Recursive walk to get all subdirectories for font fun.
* Patch submitted by Matthias Breuer.
* (<a href="http://dev.processing.org/bugs/show_bug.cgi?id=1566">Bug 1566</a>)
*/
static protected void traverseDir(File folder, DefaultFontMapper mapper) {
File[] files = folder.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
mapper.insertDirectory(files[i].getPath());
traverseDir(new File(files[i].getPath()), mapper);
}
}
}
// endDraw() needs to be overridden so that the endDraw() from
// PGraphicsJava2D is not inherited (it calls loadPixels).
// http://dev.processing.org/bugs/show_bug.cgi?id=1169
public void endDraw() {
// Also need to pop the matrix since the matrix doesn't reset on each run
// http://dev.processing.org/bugs/show_bug.cgi?id=1227
popMatrix();
}
/**
* Gives the same basic functionality of File.exists but can be
* used to look for removable media without showing a system
* dialog if the media is not present. Workaround pulled from the
* <A HREF="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4089199">
* bug report</A> on bugs.sun.com. This bug was fixed in Java 6, and we
* can remove the workaround when we start requiring Java 6.
*/
protected static boolean fileExists(File file) {
try {
Process process =
Runtime.getRuntime().exec(new String[] {
"cmd.exe", "/c", "dir", file.getAbsolutePath()
});
// We need to consume all available output or the process will block.
boolean haveExitCode = false;
int exitCode = -1;
InputStream out = process.getInputStream();
InputStream err = process.getErrorStream();
while (!haveExitCode) {
while (out.read() >= 0) {
}
while (err.read() >= 0) {
}
try {
exitCode = process.exitValue();
haveExitCode = true;
} catch (IllegalThreadStateException e) {
// Not yet complete.
Thread.sleep(100);
}
}
//int exitCode = process.waitFor();
return exitCode == 0;
} catch (IOException e) {
System.out.println("Unable to check for file: " + file + " : " + e);
return false;
} catch (InterruptedException e) {
System.out.println("Unable to check for file. Interrupted: " +
file + " : " + e);
return false;
}
}
/**
* Call to explicitly go to the next page from within a single draw().
*/
public void nextPage() {
PStyle savedStyle = getStyle();
endDraw();
g2.dispose();
try {
// writer.setPageEmpty(false); // maybe useful later
document.newPage(); // is this bad if no addl pages are made?
} catch (Exception e) {
e.printStackTrace();
}
g2 = createGraphics();
beginDraw();
style(savedStyle);
}
protected Graphics2D createGraphics() {
if (textMode == SHAPE) {
return content.createGraphicsShapes(width, height);
} else if (textMode == MODEL) {
return content.createGraphics(width, height, getMapper());
}
// Should not be reachable...
throw new RuntimeException("Invalid textMode() selected for PDF.");
}
public void dispose() {
if (document != null) {
g2.dispose();
document.close(); // can't be done in finalize, not always called
document = null;
}
//new Exception().printStackTrace(System.out);
}
/**
* Don't open a window for this renderer, it won't be used.
*/
public boolean displayable() {
return false;
}
/*
protected void finalize() throws Throwable {
System.out.println("calling finalize");
//document.close(); // do this in dispose instead?
}
*/
//////////////////////////////////////////////////////////////
/*
public void endRecord() {
super.endRecord();
dispose();
}
public void endRaw() {
System.out.println("ending raw");
super.endRaw();
System.out.println("disposing");
dispose();
System.out.println("done");
}
*/
//////////////////////////////////////////////////////////////
/*
protected void rectImpl(float x1, float y1, float x2, float y2) {
//rect.setFrame(x1, y1, x2-x1, y2-y1);
//draw_shape(rect);
System.out.println("rect implements");
g2.fillRect((int)x1, (int)y1, (int) (x2-x1), (int) (y2-y1));
}
*
/*
public void clear() {
g2.setColor(Color.red);
g2.fillRect(0, 0, width, height);
}
*/
//////////////////////////////////////////////////////////////
protected void imageImpl(PImage image,
float x1, float y1, float x2, float y2,
int u1, int v1, int u2, int v2) {
pushMatrix();
translate(x1, y1);
int imageWidth = image.width;
int imageHeight = image.height;
scale((x2 - x1) / imageWidth,
(y2 - y1) / imageHeight);
if (u2-u1 == imageWidth && v2-v1 == imageHeight) {
g2.drawImage(image.getImage(), 0, 0, null);
} else {
PImage tmp = image.get(u1, v1, u2-u1, v2-v1);
g2.drawImage((Image) tmp.getNative(), 0, 0, null);
}
popMatrix();
}
//////////////////////////////////////////////////////////////
public void textFont(PFont which) {
super.textFont(which);
checkFont();
// Make sure a native version of the font is available.
// if (textFont.getFont() == null) {
// throw new RuntimeException("Use createFont() instead of loadFont() " +
// "when drawing text using the PDF library.");
// }
// Make sure that this is a font that the PDF library can deal with.
// if ((textMode != SHAPE) && !checkFont(which.getName())) {
// System.err.println("Use PGraphicsPDF.listFonts() to get a list of available fonts.");
// throw new RuntimeException("The font “" + which.getName() + "” cannot be used with PDF Export.");
// }
}
/**
* Change the textMode() to either SHAPE or MODEL.
* <br/>
* This resets all renderer settings, and therefore must
* be called <EM>before</EM> any other commands that set the fill()
* or the textFont() or anything. Unlike other renderers,
* use textMode() directly after the size() command.
*/
public void textMode(int mode) {
if (textMode != mode) {
if (mode == SHAPE) {
textMode = SHAPE;
g2.dispose();
// g2 = content.createGraphicsShapes(width, height);
g2 = createGraphics();
} else if (mode == MODEL) {
textMode = MODEL;
g2.dispose();
// g2 = content.createGraphics(width, height, mapper);
g2 = createGraphics();
// g2 = template.createGraphics(width, height, mapper);
} else if (mode == SCREEN) {
throw new RuntimeException("textMode(SCREEN) not supported with PDF");
} else {
throw new RuntimeException("That textMode() does not exist");
}
}
}
protected void textLineImpl(char buffer[], int start, int stop,
float x, float y) {
checkFont();
super.textLineImpl(buffer, start, stop, x, y);
}
//////////////////////////////////////////////////////////////
public void loadPixels() {
nope("loadPixels");
}
public void updatePixels() {
nope("updatePixels");
}
public void updatePixels(int x, int y, int c, int d) {
nope("updatePixels");
}
//
public int get(int x, int y) {
nope("get");
return 0; // not reached
}
public PImage get(int x, int y, int c, int d) {
nope("get");
return null; // not reached
}
public PImage get() {
nope("get");
return null; // not reached
}
public void set(int x, int y, int argb) {
nope("set");
}
public void set(int x, int y, PImage image) {
nope("set");
}
//
public void mask(int alpha[]) {
nope("mask");
}
public void mask(PImage alpha) {
nope("mask");
}
//
public void filter(int kind) {
nope("filter");
}
public void filter(int kind, float param) {
nope("filter");
}
//
public void copy(int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2) {
nope("copy");
}
public void copy(PImage src,
int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2) {
nope("copy");
}
//
public void blend(int sx, int sy, int dx, int dy, int mode) {
nope("blend");
}
public void blend(PImage src,
int sx, int sy, int dx, int dy, int mode) {
nope("blend");
}
public void blend(int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2, int mode) {
nope("blend");
}
public void blend(PImage src,
int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2, int mode) {
nope("blend");
}
//
public boolean save(String filename) {
nope("save");
return false;
}
//////////////////////////////////////////////////////////////
/**
* Add a directory that should be searched for font data.
* <br/>
* On Mac OS X, the following directories are added by default:
* <UL>
* <LI>/System/Library/Fonts
* <LI>/Library/Fonts
* <LI>~/Library/Fonts
* </UL>
* On Windows, all drive letters are searched for WINDOWS\Fonts
* or WINNT\Fonts, any that exists is added.
* <br/><br/>
* On Linux or any other platform, you'll need to add the
* directories by hand. (If there are actual standards here that we
* can use as a starting point, please file a bug to make a note of it)
*/
public void addFonts(String directory) {
mapper.insertDirectory(directory);
}
/**
* Check whether the specified font can be used with the PDF library.
* @param name name of the font
* @return true if it's ok
*/
protected void checkFont() {
Font awtFont = (Font) textFont.getNative();
if (awtFont == null) { // always need a native font or reference to it
throw new RuntimeException("Use createFont() instead of loadFont() " +
"when drawing text using the PDF library.");
} else if (textMode != SHAPE) {
if (textFont.isStream()) {
throw new RuntimeException("Use textMode(SHAPE) with PDF when loading " +
".ttf and .otf files with createFont().");
} else if (mapper.getAliases().get(textFont.getName()) == null) {
//System.out.println("alias for " + name + " = " + mapper.getAliases().get(name));
// System.err.println("Use PGraphicsPDF.listFonts() to get a list of " +
// "fonts that can be used with PDF.");
// throw new RuntimeException("The font “" + textFont.getName() + "” " +
// "cannot be used with PDF Export.");
if (textFont.getName().equals("Lucida Sans")) {
throw new RuntimeException("Use textMode(SHAPE) with the default " +
"font when exporting to PDF.");
} else {
throw new RuntimeException("Use textMode(SHAPE) with " +
"" + textFont.getName() + "" +
"when exporting to PDF.");
}
}
}
}
/**
* List the fonts known to the PDF renderer. This is like PFont.list(),
* however not all those fonts are available by default.
*/
static public String[] listFonts() {
if (fontList == null) {
HashMap<?, ?> map = getMapper().getAliases();
// Set entries = map.entrySet();
// fontList = new String[entries.size()];
fontList = new String[map.size()];
int count = 0;
for (Object key : map.keySet()) {
// for (Object entry : map.entrySet()) {
// fontList[count++] = (String) ((Map.Entry) entry).getKey();
fontList[count++] = (String) key;
}
// Iterator it = entries.iterator();
// int count = 0;
// while (it.hasNext()) {
// Map.Entry entry = (Map.Entry) it.next();
// //System.out.println(entry.getKey() + "-->" + entry.getValue());
// fontList[count++] = (String) entry.getKey();
// }
fontList = PApplet.sort(fontList);
}
return fontList;
}
//////////////////////////////////////////////////////////////
protected void nope(String function) {
throw new RuntimeException("No " + function + "() for " + getClass().getSimpleName());
}
}